structure = $this->createMock(\Migration\ResourceModel\Structure::class); $this->recordCollectionFactory = $this->getMockBuilder(\Migration\ResourceModel\Record\CollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); $this->document = new \Migration\ResourceModel\Document( $this->recordCollectionFactory, $this->structure, 'test_document' ); } /** * @return void */ public function testGetRecords() { $recordCollection = $this->createMock(\Migration\ResourceModel\Record\Collection::class); $this->recordCollectionFactory->expects($this->atLeastOnce()) ->method('create') ->with($this->equalTo([ 'structure' => $this->structure, 'documentName' => 'test_document', ])) ->will($this->returnValue($recordCollection)); $this->assertSame($recordCollection, $this->document->getRecords()); } /** * @return void */ public function testGetName() { $this->assertEquals('test_document', $this->document->getName()); } /** * @return void */ public function testGetStructure() { $this->assertSame($this->structure, $this->document->getStructure()); } }