1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

toGlyph, getThemeLayout(), getGlyph()

This commit is contained in:
Cameron
2019-02-27 10:16:16 -08:00
parent ad94ebc734
commit 71c7c8bc66
5 changed files with 42 additions and 12 deletions

View File

@@ -766,7 +766,7 @@
$this->assertEquals("https://localhost/e107/news", $result); $this->assertEquals("https://localhost/e107/news", $result);
// var_dump(SITEURL); // var_dump(SITEURL);
// $this->assertTrue($res); // $this->assertTrue($res);
} }

View File

@@ -151,12 +151,21 @@
{ {
} }
*/
public function testGetGlyphs() public function testGetGlyphs()
{ {
$result = $this->md->getGlyphs('bs3');
$this->assertEquals('adjust', $result[0]);
$this->assertEquals('zoom-out', $result[198]);
$result = $this->md->getGlyphs('fab');
$this->assertTrue(in_array('xbox', $result));
$result = $this->md->getGlyphs('fas');
$this->assertTrue(in_array('check-circle', $result));
} }
/*
public function testImportIcons() public function testImportIcons()
{ {

View File

@@ -477,12 +477,18 @@ TMP;
*/ */
public function testToGlyph() public function testToGlyph()
{ {
$result = $this->tp->toGlyph('fa-envelope.glyph'); $result = $this->tp->toGlyph('fa-envelope.glyph');
$expected = "<i class='fa fa-envelope' ><!-- --></i> "; $expected = "<i class='fa fa-envelope' ><!-- --></i> ";
$this->assertEquals($expected,$result); $this->assertEquals($expected,$result);
$this->tp->setFontAwesome(5);
$result = $this->tp->toGlyph('fa-mailchimp');
$expected = "<i class='fab fa-mailchimp' ><!-- --></i> ";
$this->assertEquals($expected, $result);
} }
/* /*
public function testToBadge() public function testToBadge()
@@ -533,7 +539,7 @@ TMP;
foreach($tests as $val) foreach($tests as $val)
{ {
list($input, $expected) = $val; list($input, $expected) = $val;
$actual = $this->tp->isBbcode($input); $actual = $this->tp->isBBcode($input);
$this->assertEquals($expected, $actual, $input); $this->assertEquals($expected, $actual, $input);
} }

View File

@@ -62,9 +62,24 @@
public function testGetThemeLayout() public function testGetThemeLayout()
{ {
// FRONTPAGE = jumbotron_home
// /news = jumbotron_sidebar_right $pref = array (
// forum = jumbotron_full 'jumbotron_home' =>
array (
0 => 'FRONTPAGE',
),
'jumbotron_full' =>
array (
0 => 'forum',
),
'jumbotron_sidebar_right' =>
array (
0 => '/news',
),
);
$defaultLayout = "jumbotron_sidebar_right";
$tests = array( $tests = array(
0 => array('url' => SITEURL."index.php", 'expected'=> 'jumbotron_home'), 0 => array('url' => SITEURL."index.php", 'expected'=> 'jumbotron_home'),
@@ -81,7 +96,7 @@
foreach($tests as $var) foreach($tests as $var)
{ {
$result = $this->tm->getThemeLayout($var['url']); $result = $this->tm->getThemeLayout($pref, $defaultLayout, $var['url']);
$this->assertEquals($var['expected'],$result, "Wrong theme layout returned for ".$var['url']); $this->assertEquals($var['expected'],$result, "Wrong theme layout returned for ".$var['url']);
// echo $var['url']."\t\t\t".$result."\n\n"; // echo $var['url']."\t\t\t".$result."\n\n";
} }

View File

@@ -41,7 +41,7 @@ Plain text &quot;paragraph&quot; 2
Plain text paragraph 3 Plain text paragraph 3
'; ';
$actual = $this->tm->toHtml($test); $actual = $this->tm->toHTML($test);
$expected = 'Plain text paragraph 1<br /> $expected = 'Plain text paragraph 1<br />
<br /> <br />
Plain text "paragraph" 2<br /> Plain text "paragraph" 2<br />
@@ -61,7 +61,7 @@ Plain text paragraph 3<br />';
paragraph 3'; paragraph 3';
$actual = $this->tm->toHtml($test); $actual = $this->tm->toHTML($test);
$expected = "<strong class='bbcode bold bbcode-b'>Bold text</strong><br /> $expected = "<strong class='bbcode bold bbcode-b'>Bold text</strong><br />
<br /> <br />