spiral / testing
Spiral Framework testing SDK
Fund package maintenance!
spiral
Installs: 211 011
Dependents: 53
Suggesters: 1
Security: 0
Stars: 7
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.8
- spiral/auth-http: ^3.14.8
- spiral/boot: ^3.14.8
- spiral/console: ^3.14.8
- spiral/core: ^3.14.8
- spiral/events: ^3.14.8
- spiral/http: ^3.14.8
- spiral/mailer: ^3.14.8
- spiral/queue: ^3.14.8
- spiral/scaffolder: ^3.14.8
- spiral/security: ^3.14.8
- spiral/session: ^3.14.8
- spiral/storage: ^3.14.8
- spiral/tokenizer: ^3.14.8
- spiral/translator: ^3.14.8
- spiral/views: ^3.14.8
- symfony/mime: ^6.0 || ^7.0
Requires (Dev)
- spiral-packages/league-event: ^1.0.1
- spiral/code-style: ^2.2
- spiral/dumper: ^3.3
- spiral/framework: ^3.14.8
- 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.