|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* test rest-bundle |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Graviton\RestBundle\Tests; |
|
7
|
|
|
|
|
8
|
|
|
use Graviton\RestBundle\GravitonRestBundle; |
|
9
|
|
|
use JMS\SerializerBundle\JMSSerializerBundle; |
|
10
|
|
|
use Misd\GuzzleBundle\MisdGuzzleBundle; |
|
11
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* GravitonMessagingBundleTest |
|
15
|
|
|
* |
|
16
|
|
|
* @author List of contributors <https://github.com/libgraviton/graviton/graphs/contributors> |
|
17
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
18
|
|
|
* @link http://swisscom.ch |
|
19
|
|
|
*/ |
|
20
|
|
|
class GravitonRestBundleTest extends \PHPUnit_Framework_TestCase |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* check for implemented interfaces |
|
24
|
|
|
* |
|
25
|
|
|
* @return void |
|
26
|
|
|
*/ |
|
27
|
|
|
public function testIsInterface() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->assertInstanceOf( |
|
30
|
|
|
'\Graviton\BundleBundle\GravitonBundleInterface', |
|
31
|
|
|
new GravitonRestBundle() |
|
32
|
|
|
); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* test getBundles method |
|
37
|
|
|
* |
|
38
|
|
|
* @return void |
|
39
|
|
|
*/ |
|
40
|
|
|
public function testGetBundles() |
|
41
|
|
|
{ |
|
42
|
|
|
$sut = new GravitonRestBundle(); |
|
43
|
|
|
|
|
44
|
|
|
$result = $sut->getBundles(); |
|
45
|
|
|
|
|
46
|
|
|
$this->assertContains(new JMSSerializerBundle(), $result, '', false, false); |
|
47
|
|
|
$this->assertContains(new MisdGuzzleBundle(), $result, '', false, false); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Verifies the correct behavior of build() |
|
52
|
|
|
* |
|
53
|
|
|
* @return void |
|
54
|
|
|
*/ |
|
55
|
|
|
public function testBuild() |
|
56
|
|
|
{ |
|
57
|
|
|
$containerDouble = $this->getMockBuilder('\Symfony\Component\DependencyInjection\ContainerBuilder') |
|
58
|
|
|
->disableOriginalConstructor() |
|
59
|
|
|
->setMethods(array('addCompilerPass')) |
|
60
|
|
|
->getMock(); |
|
61
|
|
|
$containerDouble |
|
62
|
|
|
->expects($this->at(0)) |
|
63
|
|
|
->method('addCompilerPass') |
|
64
|
|
|
->with( |
|
65
|
|
|
$this->isInstanceOf('\Graviton\RestBundle\DependencyInjection\Compiler\RestServicesCompilerPass') |
|
66
|
|
|
); |
|
67
|
|
|
$containerDouble |
|
68
|
|
|
->expects($this->at(1)) |
|
69
|
|
|
->method('addCompilerPass') |
|
70
|
|
|
->with( |
|
71
|
|
|
$this->isInstanceOf('\Graviton\RestBundle\DependencyInjection\Compiler\RqlQueryRoutesCompilerPass') |
|
72
|
|
|
); |
|
73
|
|
|
|
|
74
|
|
|
$bundle = new GravitonRestBundle(); |
|
75
|
|
|
$bundle->build($containerDouble); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|