mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Fixed file_size_decode test. Added simple TinyMce parser test.
This commit is contained in:
@@ -63,14 +63,14 @@
|
||||
$actual = $this->fl->getAllowedFileTypes();
|
||||
|
||||
$expected = array (
|
||||
'zip' => 2048,
|
||||
'gz' => 2048,
|
||||
'jpg' => 2048,
|
||||
'jpeg' => 2048,
|
||||
'png' => 2048,
|
||||
'gif' => 2048,
|
||||
'xml' => 2048,
|
||||
'pdf' => 2048,
|
||||
'zip' => 2097152, // 2M in bytes
|
||||
'gz' => 2097152,
|
||||
'jpg' => 2097152,
|
||||
'jpeg' => 2097152,
|
||||
'png' => 2097152,
|
||||
'gif' => 2097152,
|
||||
'xml' => 2097152,
|
||||
'pdf' => 2097152,
|
||||
);
|
||||
|
||||
$this->assertEquals($expected,$actual);
|
||||
|
87
tests/unit/plugins/e107TinyMceParserTest.php
Normal file
87
tests/unit/plugins/e107TinyMceParserTest.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2018 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class e107TinyMceParserTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/** @var e107TinyMceParser $tm */
|
||||
private $tm;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
define('TINYMCE_UNIT_TEST', true);
|
||||
require_once(e_PLUGIN."tinymce4/plugins/e107/parser.php");
|
||||
try
|
||||
{
|
||||
$this->tm = $this->make('e107TinyMceParser');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail("Couldn't load e107TinyMceParser object");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testToHtml()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testToBBcode()
|
||||
{
|
||||
|
||||
$test_1 = '<ul>
|
||||
<li>one<a class="bbcode bbcode-link" href="http://www.three.co.uk/"></a></li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
<li>four</li>
|
||||
</ul>
|
||||
<sup>2</sup>
|
||||
';
|
||||
|
||||
$actual_1 = $this->tm->toBBcode($test_1);
|
||||
$expected_1 = '[html]<ul>
|
||||
<li>one<a class="bbcode bbcode-link" href="http://www.three.co.uk/"></a></li>
|
||||
<li>two</li>
|
||||
<li>three</li>
|
||||
<li>four</li>
|
||||
</ul>
|
||||
<sup>2</sup>[/html]';
|
||||
|
||||
// echo $actual;
|
||||
|
||||
$this->assertEquals($expected_1, $actual_1);
|
||||
|
||||
|
||||
|
||||
$test_2 =
|
||||
'<p><img class="img-rounded rounded bbcode bbcode-img bbcode-img-right" src="'.e_HTTP.'media/img/300x0/2017-11/e107_about.png" alt="E107 About" srcset="'.e_HTTP.'media/img/600x0/2017-11/e107_about.png 600w" width="300">Some text</p>
|
||||
<p><img class="img-rounded rounded bbcode bbcode-img bbcode-img-left" src="'.e_HTTP.'media/img/600x0/2017-11/e107_about.png" alt="E107 About" srcset="'.e_HTTP.'media/img/1200x0/2017-11/e107_about.png 1200w" width="600">Some other text</p>';
|
||||
|
||||
|
||||
|
||||
|
||||
$actual_2 = $this->tm->toBBcode($test_2);
|
||||
|
||||
$expected_2 = '[html]<p>[img class=bbcode-img-right&width=300]{e_MEDIA_IMAGE}2017-11/e107_about.png[/img]Some text</p>
|
||||
<p>[img class=bbcode-img-left&width=600]{e_MEDIA_IMAGE}2017-11/e107_about.png[/img]Some other text</p>[/html]';
|
||||
|
||||
$this->assertEquals($expected_2, $actual_2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user