drjele / symfony-phpunit
This package is abandoned and no longer maintained.
The author suggests using the precision-soft/symfony-phpunit package instead.
Library used to make writing phpunit tests easier
v5.5.0
2024-08-15 15:53 UTC
Requires
- php: >=8.2
- mockery/mockery: 1.*
- symfony/phpunit-bridge: 7.*
Requires (Dev)
README
NO LONGER MAINTAINED, MOVED TO https://gitlab.com/precision-soft-open-source/symfony/phpunit
You may fork and modify it as you wish.
Any suggestions are welcomed.
How to use
- Extend \Drjele\Symfony\Phpunit\TestCase\AbstractTestCase or \Drjele\Symfony\Phpunit\TestCase\AbstractKernelTestCase if you need the symfony kernel.
- Drjele\Symfony\Phpunit\Mock contains generic mocks.
Example
namespace Acme\Test\Foo\Service;
use Acme\Foo\Repository\FooRepository;
use Acme\Foo\Service\CreateService;
use Drjele\Symfony\Phpunit\Mock\ManagerRegistryMock;
use Drjele\Symfony\Phpunit\MockDto;
use Drjele\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:drjele-symfony/phpunit.git
cd phpunit
./dc build && ./dc up -d
Todo
- Unit tests.