mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Simple PHPUnit tests
This commit is contained in:
parent
72bf212f67
commit
2ed88f5d27
9 changed files with 85 additions and 7 deletions
21
tests/MailSo/Base/HtmlUtilsTest.php
Normal file
21
tests/MailSo/Base/HtmlUtilsTest.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
class HtmlUtilsTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCommon()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
$this->assertTrue(class_exists('\\RainLoop\\Api'));
|
||||
$this->assertTrue(class_exists('\\MailSo\\Base\\HtmlUtils'));
|
||||
}
|
||||
|
||||
public function testClearHtml()
|
||||
{
|
||||
$i = 0;
|
||||
while (++$i < 3)
|
||||
{
|
||||
$this->assertEquals(file_get_contents(TEST_DATA_FOLDER."/html/{$i}-ok.html"),
|
||||
\MailSo\Base\HtmlUtils::ClearHtmlSimple(file_get_contents(TEST_DATA_FOLDER."/html/{$i}.html"), false, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
1
tests/_data/html/1-ok.html
Normal file
1
tests/_data/html/1-ok.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
123
|
||||
11
tests/_data/html/1.html
Normal file
11
tests/_data/html/1.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {color:red}
|
||||
p {margin:0; padding:0}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
123
|
||||
</body>
|
||||
</html>
|
||||
1
tests/_data/html/2-ok.html
Normal file
1
tests/_data/html/2-ok.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
123
|
||||
12
tests/_data/html/2.html
Normal file
12
tests/_data/html/2.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {color:red}
|
||||
p {margin:0; padding:0}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
123
|
||||
<script>alert(1)</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1 +1,6 @@
|
|||
<?php
|
||||
|
||||
define('TEST_DATA_FOLDER', __DIR__.'/_data');
|
||||
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||
include __DIR__.'/../index.php';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue