/** * Test get results method retuns query results */ public function testGetResults() { $query = $this->getMock('Sonata\\DatagridBundle\\ProxyQuery\\ProxyQueryInterface'); $object1 = new \stdClass(); $object1->foo = 'bar1'; $object2 = new \stdClass(); $object2->foo = 'bar2'; $object3 = new \stdClass(); $object3->foo = 'bar3'; $expectedObjects = array($object1, $object2, $object3); $query->expects($this->any())->method('execute')->will($this->returnValue($expectedObjects)); $this->pager->setQuery($query); $this->assertEquals($expectedObjects, $this->pager->getResults()); }