text = $text; } public function format() { return 'blah' . $this->text . 'blah'; } } class XDBTest extends PlTestCase { public function testEscapeString() { $this->assertSame("'blah'", XDB::format('{?}', 'blah')); $this->assertSame("'blah\\''", XDB::format('{?}', "blah'")); $this->assertSame("'bl\\'ah'", XDB::format('{?}', "bl'ah")); $this->assertSame("'\\'blah\\''", XDB::format('{?}', "'blah'")); } public function testEscapeInt() { $this->assertSame("1", XDB::format('{?}', 1)); } public function testEscapeFlagSet() { $flagset = new PlFlagSet(); $flagset->addFlag('toto'); $this->assertSame("'toto'", XDB::format('{?}', $flagset)); $flagset->addFlag('titi'); $this->assertSame("'toto,titi'", XDB::format('{?}', $flagset)); $flagset->addFlag('titi'); $this->assertSame("'toto,titi'", XDB::format('{?}', $flagset)); } public function testEscapeArray() { $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 fenc=utf-8: ?>