You are here

public function MessageCatalogueTest::testAddFallbackCatalogue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Tests/MessageCatalogueTest.php \Symfony\Component\Translation\Tests\MessageCatalogueTest::testAddFallbackCatalogue()

File

vendor/symfony/translation/Tests/MessageCatalogueTest.php, line 105

Class

MessageCatalogueTest

Namespace

Symfony\Component\Translation\Tests

Code

public function testAddFallbackCatalogue() {
  $r = $this
    ->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
  $r
    ->expects($this
    ->any())
    ->method('__toString')
    ->will($this
    ->returnValue('r'));
  $r1 = $this
    ->getMock('Symfony\\Component\\Config\\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
    ->get('foo', 'domain1'));
  $this
    ->assertEquals('foo1', $catalogue
    ->get('foo1', 'domain1'));
  $this
    ->assertEquals(array(
    $r,
    $r1,
  ), $catalogue
    ->getResources());
}