コード例 #1
0
ファイル: MessageCatalogTest.php プロジェクト: rsky/symfony
 public function testAddFallbackCatalogue()
 {
     $r = $this->getMock('Symfony\\Component\\Translation\\Resource\\ResourceInterface');
     $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
     $r1 = $this->getMock('Symfony\\Component\\Translation\\Resource\\ResourceInterface');
     $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
     $catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
     $catalogue->addResource($r);
     $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1')));
     $catalogue1->addResource($r1);
     $catalogue->addFallbackCatalogue($catalogue1);
     $this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1'));
     $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1'));
     $this->assertEquals(array($r, $r1), $catalogue->getResources());
 }