File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 13
13
"symfony/dependency-injection" : " ^3.4 || ^4.0" ,
14
14
"symfony/http-kernel" : " ^3.4 || ^4.0" ,
15
15
"zalas/phpunit-globals" : " ^1.0" ,
16
- "symfony/framework-bundle" : " ^3.4||^4.0"
16
+ "symfony/framework-bundle" : " ^3.4||^4.0" ,
17
+ "zalas/phpunit-doubles" : " ^1.2"
17
18
},
18
19
"autoload" : {
19
20
"psr-4" : {
Original file line number Diff line number Diff line change 15
15
use Zalas \Injector \Service \Extractor ;
16
16
use Zalas \Injector \Service \ExtractorFactory ;
17
17
use Zalas \Injector \Service \Property ;
18
+ use Zalas \PHPUnit \Doubles \TestCase \TestDoubles ;
18
19
19
20
class PropertyDiscoveryTest extends TestCase
20
21
{
22
+ use TestDoubles;
23
+
21
24
/**
22
25
* @var PropertyDiscovery
23
26
*/
@@ -39,10 +42,6 @@ class PropertyDiscoveryTest extends TestCase
39
42
40
43
protected function setUp ()
41
44
{
42
- $ this ->extractorFactory = $ this ->prophesize (ExtractorFactory::class);
43
- $ this ->extractor = $ this ->prophesize (Extractor::class);
44
- $ this ->classFinder = $ this ->prophesize (ClassFinder::class);
45
-
46
45
$ this ->discovery = new PropertyDiscovery ($ this ->classFinder ->reveal (), $ this ->extractorFactory ->reveal ());
47
46
48
47
$ this ->classFinder ->findImplementations (Argument::any ())->willReturn ([]);
Original file line number Diff line number Diff line change 18
18
use Zalas \Injector \PHPUnit \Tests \Symfony \Compiler \Fixtures \TestCase1 ;
19
19
use Zalas \Injector \PHPUnit \Tests \Symfony \Compiler \Fixtures \TestCase2 ;
20
20
use Zalas \Injector \Service \Property ;
21
+ use Zalas \PHPUnit \Doubles \TestCase \TestDoubles ;
21
22
22
23
class ExposeServicesForTestsPassTest extends TestCase
23
24
{
25
+ use TestDoubles;
26
+
24
27
/**
25
28
* @var ExposeServicesForTestsPass
26
29
*/
@@ -33,7 +36,6 @@ class ExposeServicesForTestsPassTest extends TestCase
33
36
34
37
protected function setUp ()
35
38
{
36
- $ this ->discovery = $ this ->prophesize (PropertyDiscovery::class);
37
39
$ this ->pass = new ExposeServicesForTestsPass ($ this ->discovery ->reveal ());
38
40
}
39
41
Original file line number Diff line number Diff line change 9
9
use Zalas \Injector \PHPUnit \TestCase \ServiceContainerTestCase ;
10
10
use Zalas \Injector \PHPUnit \TestListener \TestCaseContainerFactory ;
11
11
use Zalas \Injector \Service \ContainerFactory ;
12
+ use Zalas \PHPUnit \Doubles \TestCase \TestDoubles ;
12
13
13
14
class TestCaseContainerFactoryTest extends TestCase
14
15
{
16
+ use TestDoubles;
17
+
15
18
/**
16
19
* @var TestCaseContainerFactory
17
20
*/
18
21
private $ factory ;
19
22
20
23
/**
21
- * @var ContainerInterface
24
+ * @var ContainerInterface|ObjectProphecy
22
25
*/
23
26
private $ container ;
24
27
@@ -29,9 +32,6 @@ class TestCaseContainerFactoryTest extends TestCase
29
32
30
33
protected function setUp ()
31
34
{
32
- $ this ->container = $ this ->prophesize (ContainerInterface::class)->reveal ();
33
- $ this ->testCase = $ this ->prophesize (ServiceContainerTestCase::class);
34
-
35
35
$ this ->factory = new TestCaseContainerFactory ($ this ->testCase ->reveal ());
36
36
}
37
37
@@ -46,6 +46,6 @@ public function test_it_uses_the_test_case_to_create_a_container()
46
46
47
47
$ createdContainer = $ this ->factory ->create ();
48
48
49
- $ this ->assertSame ($ this ->container , $ createdContainer );
49
+ $ this ->assertSame ($ this ->container -> reveal () , $ createdContainer );
50
50
}
51
51
}
You can’t perform that action at this time.
0 commit comments