https://github.com/spiral/testing
Spiral Framework testing SDK
https://github.com/spiral/testing
php php7 spiral-framework testing testing-tools
Last synced: 8 months ago
JSON representation
Spiral Framework testing SDK
- Host: GitHub
- URL: https://github.com/spiral/testing
- Owner: spiral
- License: mit
- Created: 2022-02-02T22:33:57.000Z (over 4 years ago)
- Default Branch: 2.x
- Last Pushed: 2025-09-26T19:07:57.000Z (9 months ago)
- Last Synced: 2025-10-10T08:35:20.893Z (8 months ago)
- Topics: php, php7, spiral-framework, testing, testing-tools
- Language: PHP
- Homepage: https://spiral.dev/docs/packages-testing
- Size: 229 KB
- Stars: 7
- Watchers: 3
- Forks: 4
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spiral Framework testing SDK
[](https://packagist.org/packages/spiral/testing)
[](https://packagist.org/packages/spiral/testing)
## Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.1+
- Spiral framework 3.15+
Documentation on how to install and use the package can be found on the official documentation
page - [Testing — Getting Started](https://spiral.dev/docs/testing-start)
## 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 folder structure:
```
tests
- app
- config
- my-config.php
- ...
- src
- TestCase.php
- MyFirstTestCase.php
```
### TestCase configuration
```php
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](LICENSE) for more information.