You are here

public function MessageCatalogueTest::testAddCatalogue in Plug 7

File

lib/Symfony/translation/Tests/MessageCatalogueTest.php, line 83

Class

MessageCatalogueTest

Namespace

Symfony\Component\Translation\Tests

Code

public function testAddCatalogue() {
  $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', array(
    'domain1' => array(
      'foo' => 'foo',
    ),
    'domain2' => array(
      'bar' => 'bar',
    ),
  ));
  $catalogue
    ->addResource($r);
  $catalogue1 = new MessageCatalogue('en', array(
    'domain1' => array(
      'foo1' => 'foo1',
    ),
  ));
  $catalogue1
    ->addResource($r1);
  $catalogue
    ->addCatalogue($catalogue1);
  $this
    ->assertEquals('foo', $catalogue
    ->get('foo', 'domain1'));
  $this
    ->assertEquals('foo1', $catalogue
    ->get('foo1', 'domain1'));
  $this
    ->assertEquals(array(
    $r,
    $r1,
  ), $catalogue
    ->getResources());
}