-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathFactoryPassTest.php
More file actions
82 lines (68 loc) · 2.74 KB
/
FactoryPassTest.php
File metadata and controls
82 lines (68 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Factory Compiler Pass
*
* @copyright 2013 Anthon Pang
* @license BSD-2-Clause
*/
namespace LeanPHP\Behat\CodeCoverage\Compiler;
use VIPSoft\TestCase;
use LeanPHP\Behat\CodeCoverage\Compiler\FactoryPass;
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
/**
* Factory compiler pass test
*
* @group Unit
*/
class FactoryPassTest extends TestCase
{
public function testProcessNoServiceDefinition()
{
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container->expects($this->once())
->method('hasDefinition')
->will($this->returnValue(false));
$pass = new FactoryPass();
$pass->process($container);
}
public function testProcess()
{
$factory = $this->createMock('Symfony\Component\DependencyInjection\Definition');
$factory->expects($this->once())
->method('setArguments');
$xcache = $this->createMock('Symfony\Component\DependencyInjection\Definition');
$xcache->expects($this->once())
->method('getClass')
->will($this->returnValue('LeanPHP\Behat\CodeCoverage\Common\Driver\XCache'));
$xdebug = $this->createMock('Symfony\Component\DependencyInjection\Definition');
$xdebug->expects($this->once())
->method('getClass')
->will($this->returnValue('Xdebug'));
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container->expects($this->at(0))
->method('hasDefinition')
->with('vipsoft.code_coverage.driver.factory')
->will($this->returnValue(true));
$container->expects($this->at(1))
->method('getDefinition')
->with('vipsoft.code_coverage.driver.factory')
->will($this->returnValue($factory));
$container->expects($this->at(2))
->method('findTaggedServiceIds')
->with('vipsoft.code_coverage.driver')
->will($this->returnValue(array(
'vipsoft.code_coverage.driver.xcache' => array(),
'vipsoft.code_coverage.driver.xdebug' => array(),
)));
$container->expects($this->at(3))
->method('getDefinition')
->with('vipsoft.code_coverage.driver.xcache')
->will($this->returnValue($xcache));
$container->expects($this->at(4))
->method('getDefinition')
->with('vipsoft.code_coverage.driver.xdebug')
->will($this->returnValue($xdebug));
$pass = new FactoryPass();
$pass->process($container);
}
}