/** * Sets up this test case * */ public function setUp() { $this->persistenceManager = $this->getMockBuilder(PersistenceManager::class)->disableOriginalConstructor()->getMock(); $this->persistenceManager->expects($this->any())->method('getObjectDataByQuery')->will($this->returnValue(['one', 'two'])); $this->dataMapper = $this->createMock(DataMapper::class); $this->query = $this->createMock(QueryInterface::class); $this->queryResult = new QueryResult($this->query); $this->queryResult->injectPersistenceManager($this->persistenceManager); $this->queryResult->injectDataMapper($this->dataMapper); $this->sampleResult = [['foo' => 'Foo1', 'bar' => 'Bar1'], ['foo' => 'Foo2', 'bar' => 'Bar2']]; $this->dataMapper->expects($this->any())->method('mapToObjects')->will($this->returnValue($this->sampleResult)); }