1 | <?php |
||
7 | class YumlClientTest extends TestCase |
||
8 | { |
||
9 | |||
10 | public function setUp() |
||
14 | |||
15 | /** |
||
16 | * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient |
||
17 | */ |
||
18 | public function testIsInstanceOf() |
||
40 | |||
41 | /** |
||
42 | * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient |
||
43 | */ |
||
44 | public function testGetMetadata() |
||
45 | { |
||
46 | $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface"); |
||
47 | |||
48 | $metadataFactory = $this->getMockBuilder("Doctrine\\Common\\Persistence\\Mapping\\ClassMetadataFactory") |
||
49 | ->setMethods(array( |
||
50 | 'getAllMetadata', |
||
51 | 'getMetadataFor', |
||
52 | 'hasMetadataFor', |
||
53 | 'setMetadataFor', |
||
54 | 'isTransient', |
||
55 | 'setEntityManager', |
||
56 | )) |
||
57 | ->getMock(); |
||
58 | |||
59 | $metadataFactory->expects($this->once())->method('setEntityManager'); |
||
60 | |||
61 | $class = $this->createmock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata'); |
||
62 | $class->expects($this->any())->method('getName')->will($this->returnValue('Simple\\Entity')); |
||
63 | $class->expects($this->any())->method('getFieldNames')->will($this->returnValue(array('a', 'b', 'c'))); |
||
64 | $class->expects($this->any())->method('getAssociationNames')->will($this->returnValue(array())); |
||
65 | $class->expects($this->any())->method('isIdentifier')->will( |
||
66 | $this->returnCallback( |
||
67 | function ($field) { |
||
68 | return $field === 'a'; |
||
69 | } |
||
70 | ) |
||
71 | ); |
||
72 | |||
73 | $metadataFactory->expects($this->once())->method('getAllMetadata')->will($this->returnValue(array($class))); |
||
74 | |||
75 | $metadataGrapher = $this->getMockBuilder('Onurb\\Doctrine\\ORMMetadataGrapher\\YUMLMetadataGrapherInterface') |
||
76 | ->getMock(); |
||
77 | |||
78 | $metadataGrapher->expects($this->once())->method('generateFromMetadata') |
||
79 | ->will($this->returnValue('[Simple.Entity|+a;b;c]')); |
||
80 | |||
81 | $client = new YumlClient($entityManager, $metadataFactory, $metadataGrapher); |
||
82 | |||
83 | $this->assertSame('[Simple.Entity|+a;b;c]', $client->makeDslText()); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient |
||
88 | */ |
||
89 | public function testGetGraphUrl() |
||
97 | |||
98 | /** |
||
99 | * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient |
||
100 | */ |
||
101 | public function testDownloadFile() |
||
121 | } |
||
122 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: