mirror of
https://github.com/e107inc/e107.git
synced 2025-08-16 03:24:20 +02:00
New e107::isCompatible() method added for checking plugins/themes are compatible with the current version of e107.
New parser method stripBlockTags($html) to remove p, div etc. {CPAGEBODY: strip=blocks} shortcode option added (uses the method above)
This commit is contained in:
@@ -1623,6 +1623,39 @@ class e107Test extends \Codeception\Test\Unit
|
||||
|
||||
// var_dump($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
public function testIsCompatible()
|
||||
{
|
||||
// version => expected
|
||||
$tests = array (
|
||||
'1' => false, // assumed incompatible.
|
||||
'2' => true, // assumed to work with all versions from 2+
|
||||
'2.0' => true, // assumed to work with all versions from 2+
|
||||
'2.3' => true, // assumed to work with all versions from 2.3 onward.
|
||||
'2.1.0' => true,
|
||||
'2.2.0' => true,
|
||||
'2.3.0' => true,
|
||||
'2.3.1' => true,
|
||||
'1.7b' => false,
|
||||
'2.9' => false,
|
||||
'2.9.2' => false,
|
||||
'3' => false,
|
||||
|
||||
);
|
||||
|
||||
$e107 = $this->e107;
|
||||
// $ret = [];
|
||||
foreach($tests as $input=>$expected)
|
||||
{
|
||||
$result = $e107::isCompatible($input);
|
||||
$this->assertSame($expected, $result);
|
||||
// $ret[$input] = $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
public function testIni_set()
|
||||
|
@@ -33,8 +33,34 @@
|
||||
$this->tp->init();
|
||||
}
|
||||
|
||||
public function testStripBlockTags()
|
||||
{
|
||||
$tests = array(
|
||||
0 => array(
|
||||
'text' => '<p>Paragraph 1</p><p><b>Paragraph 2<br >Line 3</b></p>',
|
||||
'expected' => "Paragraph 1<b>Paragraph 2<br >Line 3</b>",
|
||||
),
|
||||
|
||||
|
||||
);
|
||||
|
||||
foreach($tests as $var)
|
||||
{
|
||||
$result = $this->tp->stripBlockTags($var['text']);
|
||||
|
||||
if(empty($var['expected']))
|
||||
{
|
||||
echo $result."\n\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertEquals($var['expected'], $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testHtmlAbuseFilter()
|
||||
{
|
||||
|
@@ -493,7 +493,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
||||
'page_metakeys' => 'keywords',
|
||||
'page_metadscr' => 'Meta Description',
|
||||
'page_metarobots' => 'noindex',
|
||||
'page_text' => '[html]<p>Lorem ipsum dolor sit amet, <sup>1</sup> consectetur adipiscing elit. Donec libero ipsum; imperdiet at risus non.</p>[/html]',
|
||||
'page_text' => '[html]<p>Lorem ipsum dolor sit amet</p><p>Suspendisse <b>placerat</b> nunc orci</p>[/html]',
|
||||
'page_author' => '1',
|
||||
'page_datestamp' => '1371420000',
|
||||
'page_rating_flag' => '1',
|
||||
@@ -519,6 +519,17 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
||||
|
||||
$exclude = array('sc_cpagemessage'); // system messages
|
||||
|
||||
$parms = array(
|
||||
'cpagebody' => array(
|
||||
': strip=blocks' => '<!-- bbcode-html-start --><p>Main Body</p><!-- bbcode-html-end -->',
|
||||
'=extended' => '<!-- bbcode-html-start --><p><strong>Extended Body</strong></p><!-- bbcode-html-end -->',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->processShortcodeMethods($sc, null, $exclude);
|
||||
|
||||
}
|
||||
@@ -928,7 +939,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
||||
|
||||
}
|
||||
|
||||
public function testFpwShortcodes() // todo move fpw shortcodes out of fpw.php to its own file.
|
||||
public function testFpwShortcodes()
|
||||
{
|
||||
require_once(e_CORE."shortcodes/batch/fpw_shortcodes.php");
|
||||
|
||||
|
Reference in New Issue
Block a user