Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataSetupTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class DataSetupTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $_model;
16 
17  protected function setUp()
18  {
20  \Magento\Setup\Module\DataSetup::class
21  );
22  }
23 
24  public function testUpdateTableRow()
25  {
26  $original = $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version');
27  $this->_model->updateTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version', 'test');
28  $this->assertEquals(
29  'test',
30  $this->_model->getTableRow('setup_module', 'module', 'Magento_AdminNotification', 'schema_version')
31  );
32  $this->_model->updateTableRow(
33  'setup_module',
34  'module',
35  'Magento_AdminNotification',
36  'schema_version',
37  $original
38  );
39  }
40 
44  public function testDeleteTableRow()
45  {
46  $this->_model->deleteTableRow('setup/module', 'module', 'integration_test_fixture_setup');
47  }
48 
54  {
55  $original = $this->_model->getTableRow('setup_module', 'module', 'core_setup', 'schema_version');
56  $this->_model->updateTableRow('setup/module', 'module', 'core_setup', 'schema_version', $original);
57  }
58 
59  public function testTableExists()
60  {
61  $this->assertTrue($this->_model->tableExists('store_website'));
62  $this->assertFalse($this->_model->tableExists('core/website'));
63  }
64 
65  public function testGetSetupCache()
66  {
67  $this->assertInstanceOf(\Magento\Framework\Setup\DataCacheInterface::class, $this->_model->getSetupCache());
68  }
69 }