/** * @return void */ public function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->resource = $this->objectManager->get('Magento\\Framework\\App\\ResourceConnection'); $this->connection = $this->resource->getConnection(); $this->model = $this->objectManager->create('Magento\\Framework\\Mview\\View\\Changelog', ['resource' => $this->resource]); $this->model->setViewId('test_view_id_1'); $this->model->create(); }
public function testCreateWithException() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, true); $this->mockGetTableName(); $this->setExpectedException('Exception', "Table {$changelogTableName} already exist"); $this->model->setViewId('viewIdtest'); $this->model->create(); }
public function testCreateWithExistingTable() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, true); $this->mockGetTableName(); $this->connectionMock->expects($this->never())->method('createTable'); $this->model->setViewId('viewIdtest'); $this->model->create(); }