library phpunit-annotation-testcase
Use simple annotation to mock the world
yoannrenard/phpunit-annotation-testcase
Use simple annotation to mock the world
- Friday, May 12, 2017
- by yoannrenard
- Repository
- 1 Watchers
- 0 Stars
- 47 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 0 % Grown
phpunit-annotation-testcase
, (*1)
Use simple annotations to mock the world!, (*2)
Installing Dependencies
Use Composer and run :, (*3)
$> composer require --dev yoannrenard/phpunit-annotation-testcase
Requirements
Run tests
$> bin/phpunit
Run using Docker
$> docker build -t pat .
$> docker run --rm -it -v ${PWD}:/app pat sh
Usage
<?php
use Prophecy\Prophecy\ObjectProphecy;
use YoannRenard\PHPUnitAnnotation\TestCase\AnnotationTestCase;
class MyClassTest extends AnnotationTestCase
{
/**
* @var Foo|ObjectProphecy
*
* @mock <namespace>\Foo
*/
protected $fooMock;
/**
* @var Bar
*
* @factory("\YoannRenard\PHPUnitAnnotation\TestCase\Mock\Bar", params={"fooMock"})
*/
protected $bar;
}
will replace, (*4)
<?php
use Prophecy\Prophecy\ObjectProphecy;
use PHPUnit\Framework\TestCase;
class MyClassTest extends TestCase
{
/**
* @var Foo|ObjectProphecy
*/
protected $fooMock;
/** @var Bar */
protected $bar;
/**
* @inheritdoc
*/
protected function setUp(): void
{
parent::setUp();
$this->fooMock = $this->prophesize(Foo::class);
$this->bar = new Bar($this->fooMock->reveal());
}
}
dev-master
9999999-dev
Use simple annotation to mock the world
Sources
Download
MIT
The Requires
The Development Requires
by
Yoann RENARD
1.0.0
1.0.0.0
Use simple annotation to mock the world
Sources
Download
MIT
The Requires
The Development Requires
by
Yoann RENARD
0.0.3
0.0.3.0
Use simple annotation to mock the world
Sources
Download
MIT
The Requires
The Development Requires
by
Yoann RENARD
0.0.2
0.0.2.0
Use simple annotation to mock the world
Sources
Download
MIT
The Requires
by
Yoann RENARD
0.0.1
0.0.1.0
Use simple annotation to mock the world
Sources
Download
MIT
The Requires
by
Yoann RENARD