mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
|
|
|
|
/**
|
|
* Test class for supertwig.
|
|
* Generated by PHPUnit on 2011-07-06 at 18:30:03.
|
|
*/
|
|
class supertwigTest extends PhraseanetPHPUnitAbstract
|
|
{
|
|
|
|
protected $object;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
$this->object = new supertwig();
|
|
}
|
|
|
|
public function testAddFilter()
|
|
{
|
|
$this->object->addFilter(array('nl2br'=>'nl2br'));
|
|
try
|
|
{
|
|
$this->object->addFilter(array('prout'=>'prout'));
|
|
$this->fail();
|
|
}
|
|
catch(Exception $e)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
public function testRender()
|
|
{
|
|
$this->object->addFilter(array('nl2br'=>'nl2br'));
|
|
$this->assertEquals('mon beau camion', $this->object->render('test.html', array('test_string'=>'mon beau camion')));
|
|
$string = "mon\nBEAU CAMION\n";
|
|
$this->assertEquals("mon<br />\nBEAU CAMION<br />\n", $this->object->render('test.html', array('test_string'=>"mon\nBEAU CAMION\n")));
|
|
}
|
|
|
|
public function testDisplay()
|
|
{
|
|
ob_start();
|
|
|
|
$this->object->addFilter(array('nl2br'=>'nl2br'));
|
|
$this->object->display('test.html', array('test_string'=>'mon beau camion'));
|
|
|
|
$out = ob_get_clean();
|
|
$this->assertEquals('mon beau camion', $out);
|
|
}
|
|
|
|
}
|
|
|