コード例 #1
0
ファイル: LocaleTest.php プロジェクト: jivoo/core
 public function testReplacePlaceholders()
 {
     $l = new Locale();
     $this->assertEquals('test', $l->replacePlaceholders('test', array(1)));
     $this->assertEquals('1', $l->replacePlaceholders('%1', array(1)));
     $this->assertEquals('123', $l->replacePlaceholders('%1%2%3', array(1, 2, 3)));
     $this->assertEquals('321', $l->replacePlaceholders('%3%2%1', array(1, 2, 3)));
     $this->assertEquals('The user user01 is online', $l->replacePlaceholders('The user %1{, }{ and } is online', array(array('user01'))));
     $this->assertEquals('The users user01 and user02 are online', $l->replacePlaceholders('The users %1{, }{ and } are online', array(array('user01', 'user02'))));
     $this->assertEquals('The users user01, user02 and user03 are online', $l->replacePlaceholders('The users %1{, }{ and } are online', array(array('user01', 'user02', 'user03'))));
 }