spiral / testing
Spiral Framework testing SDK
Fund package maintenance!
roadrunner-server
Installs: 116 659
Dependents: 53
Suggesters: 1
Security: 0
Stars: 8
Watchers: 4
Forks: 4
Open Issues: 9
Requires
- php: >=8.1
- ext-json: *
- mockery/mockery: ^1.5
- nyholm/psr7: ^1.5
- phpunit/phpunit: ^9.6 || ^10.0
- spiral/auth: ^3.14.3
- spiral/auth-http: ^3.14.3
- spiral/boot: ^3.14.3
- spiral/console: ^3.14.3
- spiral/core: ^3.14.3
- spiral/events: ^3.14.3
- spiral/http: ^3.14.3
- spiral/mailer: ^3.14.3
- spiral/queue: ^3.14.3
- spiral/scaffolder: ^3.14.3
- spiral/security: ^3.14.3
- spiral/session: ^3.14.3
- spiral/storage: ^3.14.3
- spiral/tokenizer: ^3.14.3
- spiral/translator: ^3.14.3
- spiral/views: ^3.14.3
- symfony/mime: ^6.0 || ^7.0
Requires (Dev)
- spiral-packages/league-event: ^1.0.1
- spiral/dumper: ^3.3
- spiral/framework: ^3.14.3
- spiral/nyholm-bridge: ^1.3
- spiral/roadrunner-bridge: ^2.2 || ^3.7 || ^4.0
- vimeo/psalm: ^5.9
Suggests
- ext-gd: Required to use generate fake image files
- brianium/paratest: Required to run tests in parallel (^6.0).
README
Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.1+
- Spiral framework 3.0+
Documentation on how to install and use the package can be found on the official documentation page - Testing — Getting Started
Spiral package testing
There are some difference between App and package testing. One of them - tou don't have application and bootloaders.
TestCase from the package has custom TestApp implementation that will help you to test your packages without creating extra classes.
The following example will show you how it is easy-peasy.
Tests folders structure:
tests
- app
- config
- my-config.php
- ...
- src
- TestCase.php
- MyFirstTestCase.php
TestCase configuration
namespace MyPackage\Tests; abstract class TestCase extends \Spiral\Testing\TestCase { public function rootDirectory(): string { return __DIR__.'/../'; } public function defineBootloaders(): array { return [ \MyPackage\Bootloaders\PackageBootloader::class, // ... ]; } }
License
The MIT License (MIT). Please see License File for more information.