Skip to content

Commit

Permalink
[ticket/14831] Add more tests against UCP modules
Browse files Browse the repository at this point in the history
PHPBB3-14831
  • Loading branch information
rxu committed Oct 23, 2016
1 parent 51ef1ae commit 849cd74
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 1 deletion.
39 changes: 39 additions & 0 deletions tests/dbal/fixtures/migrator_module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,44 @@
<value></value>
<value></value>
</row>
<row>
<value>7</value>
<value>1</value>
<value>1</value>
<value></value>
<value>ucp</value>
<value>0</value>
<value>13</value>
<value>18</value>
<value>UCP_MAIN_CAT</value>
<value></value>
<value></value>
</row>
<row>
<value>8</value>
<value>1</value>
<value>1</value>
<value>ucp_subcat</value>
<value>ucp</value>
<value>7</value>
<value>14</value>
<value>17</value>
<value>UCP_SUBCATEGORY</value>
<value>ucp_test</value>
<value></value>
</row>
<row>
<value>9</value>
<value>1</value>
<value>1</value>
<value>ucp_module</value>
<value>ucp</value>
<value>8</value>
<value>15</value>
<value>16</value>
<value>UCP_MODULE</value>
<value>ucp_module_test</value>
<value></value>
</row>
</table>
</dataset>
61 changes: 60 additions & 1 deletion tests/dbal/migrator_tool_module_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,70 @@ public function exists_data_acp()
/**
* @dataProvider exists_data_acp
*/
public function test_exists($parent, $module, $expected)
public function test_exists_acp($parent, $module, $expected)
{
$this->assertEquals($expected, $this->tool->exists('acp', $parent, $module));
}

public function exists_data_ucp()
{
return array(
// Test the existing category
array(
'',
'UCP_MAIN_CAT',
true,
),
array(
0,
'UCP_MAIN_CAT',
true,
),

// Test the existing module
array(
'',
'UCP_SUBCATEGORY',
false,
),
array(
false,
'UCP_SUBCATEGORY',
true,
),
array(
'UCP_MAIN_CAT',
'UCP_SUBCATEGORY',
true,
),
array(
'UCP_SUBCATEGORY',
'UCP_MODULE',
true,
),

// Test for non-existant modules
array(
'',
'UCP_NON_EXISTANT_CAT',
false,
),
array(
'UCP_MAIN_CAT',
'UCP_NON_EXISTANT_MODULE',
false,
),
);
}

/**
* @dataProvider exists_data_ucp
*/
public function test_exists_ucp($parent, $module, $expected)
{
$this->assertEquals($expected, $this->tool->exists('ucp', $parent, $module));
}

public function test_add()
{
try
Expand Down

0 comments on commit 849cd74

Please sign in to comment.