precision-soft / symfony-phpunit
library used to make writing phpunit tests easier
v1.0.1
2025-10-25 14:20 UTC
Requires
- php: >=8.2
- mockery/mockery: 1.*
- symfony/phpunit-bridge: 7.*
Requires (Dev)
README
You may fork and modify it as you wish.
Any suggestions are welcomed.
How to use
- Extend \PrecisionSoft\Symfony\Phpunit\TestCase\AbstractTestCase or \PrecisionSoft\Symfony\Phpunit\TestCase\AbstractKernelTestCase if you need the symfony kernel.
- PrecisionSoft\Symfony\Phpunit\Mock contains generic mocks.
Example
namespace Acme\Test\Foo\Service; use Acme\Foo\Repository\FooRepository; use Acme\Foo\Service\CreateService; use PrecisionSoft\Symfony\Phpunit\Mock\ManagerRegistryMock; use PrecisionSoft\Symfony\Phpunit\MockDto; use PrecisionSoft\Symfony\Phpunit\TestCase\AbstractTestCase; final class CreateServiceTest extends AbstractTestCase { public static function getMockDto(): MockDto { return new MockDto( CreateService::class, [ ManagerRegistryMock::class, new MockDto(FooRepository::class), 'staticDependency', ], true ); } public function testCreate(): void { } }
Dev
git clone git@gitlab.com:precision-soft-open-source/symfony/phpunit.git cd phpunit ./dc build && ./dc up -d
Todo
- Unit tests.