Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DbRuleTest.php
Go to the documentation of this file.
1 <?php
7 
8 class DbRuleTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $model;
14 
15  protected function setUp()
16  {
17  $this->model = new DbRule(['some_table' => 'SomeModule']);
18  }
19 
27  public function testGetDependencyInfo($module, $file, $contents, array $expected)
28  {
29  $this->assertEquals($expected, $this->model->getDependencyInfo($module, 'php', $file, $contents));
30  }
31 
33  {
34  return [
35  ['any', 'non-resource-file-path.php', 'any', []],
36  [
37  'any',
38  '/app/some/path/Setup/some-file.php',
39  '$install->getTableName("unknown_table")',
40  [['module' => 'Unknown', 'source' => 'unknown_table']]
41  ],
42  [
43  'SomeModule',
44  '/app/some/path/Resource/Setup.php',
45  '$install->getTableName("some_table")',
46  []
47  ],
48  [
49  'any',
50  '/app/some/path/Resource/Setup.php',
51  '$install->getTableName("some_table")',
52  [
53  [
54  'module' => 'SomeModule',
56  'source' => 'some_table',
57  ]
58  ]
59  ]
60  ];
61  }
62 }
testGetDependencyInfo($module, $file, $contents, array $expected)
Definition: DbRuleTest.php:27
$contents
Definition: website.php:14