precision-soft / symfony-phpunit
library used to make writing phpunit tests easier
Installs: 1 199
Dependents: 6
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/precision-soft/symfony-phpunit
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.