-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new test for install bbcodes function
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* | ||
* Advanced BBCode Box 3.1 | ||
* | ||
* @copyright (c) 2014 Matt Friedman | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
namespace vse\abbc3\tests\core; | ||
|
||
class acp_install_bbcodes_test extends acp_base | ||
{ | ||
public static function install_bbcodes_data() | ||
{ | ||
return array( | ||
array(array( | ||
'foo' => array( // new | ||
'bbcode_helpline' => 'ABBC3_FOO_HELPLINE', | ||
'bbcode_match' => '[foo]{TEXT}[/foo]', | ||
'bbcode_tpl' => '<span class="foo">{TEXT}</span>', | ||
), | ||
'bar' => array( // new | ||
'bbcode_helpline' => 'ABBC3_BAR_HELPLINE', | ||
'bbcode_match' => '[bar]{TEXT}[/bar]', | ||
'bbcode_tpl' => '<span class="bar">{TEXT}</span>', | ||
), | ||
'align=' => array( // update | ||
'bbcode_helpline' => 'ABBC3_ALIGN_HELPLINE', | ||
'bbcode_match' => '[align={IDENTIFIER}]{TEXT}[/align]', | ||
'bbcode_tpl' => '<span class="align-{IDENTIFIER}">{TEXT}</span>', | ||
), | ||
'sup' => array( // update | ||
'bbcode_helpline' => 'ABBC3_SUP_HELPLINE', | ||
'bbcode_match' => '[sup]{TEXT}[/sup]', | ||
'bbcode_tpl' => '<span class="sup">{TEXT}</span>', | ||
), | ||
)), | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider install_bbcodes_data | ||
*/ | ||
public function test_install_bbcodes($data) | ||
{ | ||
$acp_manager = $this->acp_manager(); | ||
|
||
$acp_manager->install_bbcodes($data); | ||
|
||
foreach ($data as $bbcode_tag => $bbcode_data) | ||
{ | ||
$sql = "SELECT bbcode_helpline, bbcode_match, bbcode_tpl | ||
FROM phpbb_bbcodes | ||
WHERE bbcode_tag = '" . $bbcode_tag . "'"; | ||
$result = $this->db->sql_query($sql); | ||
|
||
$this->assertEquals($bbcode_data, $this->db->sql_fetchrow($result)); | ||
} | ||
} | ||
} |