@@ -109,12 +109,13 @@ public function testCanCoalesceFiltering()
109109 $ options = new ModuleOptions ();
110110 $ options ->setEnableCoalesceFiltering (true );
111111
112- $ controller = $ this ->getMock ('ZfrRest\Mvc\Controller\AbstractRestfulController ' , ['get ' , 'getEvent ' , 'getRequest ' ]);
113- $ resource = $ this ->getMock ('ZfrRest\Resource\ResourceInterface ' );
114- $ metadata = $ this ->getMock ('ZfrRest\Resource\Metadata\ResourceMetadataInterface ' );
112+ $ controller = $ this ->getMock ('ZfrRest\Mvc\Controller\AbstractRestfulController ' , ['get ' , 'getEvent ' , 'getRequest ' ]);
113+ $ resource = $ this ->getMock ('ZfrRest\Resource\ResourceInterface ' );
114+ $ metadata = $ this ->getMock ('ZfrRest\Resource\Metadata\ResourceMetadataInterface ' );
115+ $ classMetadata = $ this ->getMock ('Doctrine\Common\Persistence\Mapping\ClassMetadata ' );
115116
116117 $ request = new Request ();
117- $ request ->setQuery (new Parameters (['ids ' => [1 , 2 ]]));
118+ $ request ->setQuery (new Parameters (['$ ids ' => [1 , 2 ]]));
118119
119120 $ data = $ this ->getMock ('Doctrine\Common\Collections\Selectable ' );
120121
@@ -138,14 +139,22 @@ public function testCanCoalesceFiltering()
138139 ->method ('getMetadata ' )
139140 ->will ($ this ->returnValue ($ metadata ));
140141
142+ $ metadata ->expects ($ this ->once ())
143+ ->method ('getClassMetadata ' )
144+ ->will ($ this ->returnValue ($ classMetadata ));
145+
146+ $ classMetadata ->expects ($ this ->once ())
147+ ->method ('getIdentifierFieldNames ' )
148+ ->will ($ this ->returnValue (['id ' ]));
149+
141150 $ data ->expects ($ this ->once ())
142151 ->method ('matching ' )
143152 ->with ($ this ->callback (function (Criteria $ criteria ) {
144153 /* @var \Doctrine\Common\Collections\Expr\Comparison $comparison */
145154 $ comparison = $ criteria ->getWhereExpression ();
146155
147156 $ this ->assertInstanceOf ('Doctrine\Common\Collections\Expr\Comparison ' , $ comparison );
148- $ this ->assertEquals ('ids ' , $ comparison ->getField ());
157+ $ this ->assertEquals ('id ' , $ comparison ->getField ());
149158 $ this ->assertEquals ([1 , 2 ], $ comparison ->getValue ()->getValue ());
150159
151160 return true ;
0 commit comments