コード例 #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\\Resource', [], [], '', false);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $arguments = $objectManager->getConstructArguments('\\Magento\\Indexer\\Model\\Resource\\Indexer\\State', ['resource' => $resourceMock]);
     $this->model = $objectManager->getObject('\\Magento\\Indexer\\Model\\Resource\\Indexer\\State', $arguments);
     $this->assertEquals([['field' => ['indexer_id'], 'title' => __('State for the same indexer')]], $this->model->getUniqueFields());
 }