createMock(DocumentInterface::class); $document2 = $this->createMock(DocumentInterface::class); $this->items = [ $document1, $document2]; $document1->expects($this->any()) ->method('getId') ->willReturn(1); $document2->expects($this->any()) ->method('getId') ->willReturn(2); $data = [ 'items' => $this->items ]; $this->objectManager = new ObjectManager($this); $this->search = $this->objectManager->getObject( SearchResult::class, [ 'data' => $data ] ); } /** * Test getItems */ public function testGetItems() { $this->assertEquals($this->items, $this->search->getItems()); } }