37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
|
<?php
|
||
|
class ControllerTest extends PHPUnit_Framework_TestCase
|
||
|
{
|
||
|
private $controller;
|
||
|
private $fileName;
|
||
|
|
||
|
protected function setup()
|
||
|
{
|
||
|
$this->controller = new \Controller();
|
||
|
$this->fileName = 'efiuihhaeafiun9864029884IJBoizeefiuh_uh';
|
||
|
touch(PWD_TEMPLATES . '/' . $this->fileName . '.php');
|
||
|
}
|
||
|
|
||
|
protected function tearDown()
|
||
|
{
|
||
|
unlink(PWD_TEMPLATES . '/' . $this->fileName . '.php');
|
||
|
}
|
||
|
|
||
|
public function assertPreConditions()
|
||
|
{
|
||
|
$this->assertTrue(file_exists(PWD_TEMPLATES . '/' . $this->fileName . '.php'));
|
||
|
}
|
||
|
|
||
|
public function testS()
|
||
|
{
|
||
|
$textHtml = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href=\"http://example.fr\">avec un lien</a>.</p>";
|
||
|
|
||
|
$textEscape = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href="http://example.fr">avec un lien</a>.</p>";
|
||
|
$textNl2br = "<h1>Mon Text</h1><br />\n<p>Mon paragraphe <a href="http://example.fr">avec un lien</a>.</p>";
|
||
|
$textNoEscapeQuotes = "<h1>Mon Text</h1>\n<p>Mon paragraphe <a href=\"http://example.fr\">avec un lien</a>.</p>";
|
||
|
|
||
|
$this->assertEquals($this->controller->s($textHtml, false, true, false), $textEscape);
|
||
|
$this->assertEquals($this->controller->s($textHtml, true, true, false), $textNl2br);
|
||
|
$this->assertEquals($this->controller->s($textHtml, false, false, false), $textNoEscapeQuotes);
|
||
|
}
|
||
|
}
|