예제 #1
0
 public function testLoadByIndexer()
 {
     $indexerId = 'indexer_id';
     $this->_resourceMock->expects($this->once())->method('load')->with($this->model, $indexerId)->willReturnSelf();
     $this->model->loadByIndexer($indexerId);
     $this->assertEquals($indexerId, $this->model->getIndexerId());
 }
예제 #2
0
 public function testConstruct()
 {
     $resourceMock = $this->getMock('\\Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $arguments = $objectManager->getConstructArguments('\\Magento\\Indexer\\Model\\ResourceModel\\Indexer\\State', ['resource' => $resourceMock]);
     $this->model = $objectManager->getObject('\\Magento\\Indexer\\Model\\ResourceModel\\Indexer\\State', $arguments);
     $this->assertEquals([['field' => ['indexer_id'], 'title' => __('State for the same indexer')]], $this->model->getUniqueFields());
 }