From: Florent Bruneau Date: Tue, 28 Sep 2010 08:18:29 +0000 (+0200) Subject: Add tests for XDBFormat. X-Git-Tag: core/1.1.1~22 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=090bd6c3945603328fdd447367a8703b7360f358;p=platal.git Add tests for XDBFormat. Signed-off-by: Florent Bruneau --- diff --git a/ut/xdbtest.php b/ut/xdbtest.php index 585b8f8..20fe8c6 100644 --- a/ut/xdbtest.php +++ b/ut/xdbtest.php @@ -21,6 +21,21 @@ require_once dirname(__FILE__) . '/../include/test.inc.php'; +class FormatBlah implements XDBFormat +{ + private $text; + + public function __construct($text) + { + $this->text = $text; + } + + public function format() + { + return 'blah' . $this->text . 'blah'; + } +} + class XDBTest extends PlTestCase { public function testEscapeString() @@ -51,6 +66,13 @@ class XDBTest extends PlTestCase { $this->assertSame("(1, 'toto')", XDB::format('{?}', array(1, 'toto'))); } + + public function testEscapeFormat() + { + $this->assertSame('blahblah', XDB::format('{?}', new FormatBlah(''))); + $this->assertSame('blahblahblah', XDB::format('{?}', new FormatBlah('blah'))); + $this->assertSame('blahBloumblah', XDB::format('{?}', new FormatBlah('Bloum'))); + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: