switon / testing
Shared test container, TestCase base, and package-local test runner for Switon Framework
v1.0.0
2026-06-06 13:43 UTC
Requires
- php: >=8.3
- phpunit/phpunit: ^12.0
- psr/container: ^2.0
- psr/event-dispatcher: ^1.0
- psr/log: ^2.0
- psr/simple-cache: ^3.0
- switon/composer-extra: ^1.0
- switon/core: ^1.0
- switon/di: ^1.0
- switon/event: ^1.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
README
Switon's test bootstrap and fixtures for package-level tests.
Highlights
- Ready test base: package tests start with a Switon container already wired.
- Common defaults: core services and test doubles are prebound.
- Reusable test doubles: logger, events, console, clock, cache, random, and translator are prebound.
- Listener support:
MockListenerProviderkeeps event wiring lightweight in tests. - Package-aware checks:
ComposerExtraandPackagePathAssertsupport monorepo discovery and path checks.
Installation
composer require --dev switon/testing
Quick Start
use Switon\Testing\TestCase; final class UserServiceTest extends TestCase { public function testRegisterCreatesUser(): void { $service = $this->make(UserService::class); $user = $service->register('test@example.com'); self::assertSame('test@example.com', $user->email); } }
Docs: https://docs.switon.dev/latest/testing
License
MIT.