You are here

public function MergeOperationTest::testGetResultWithMetadata in Plug 7

File

lib/Symfony/translation/Tests/Catalogue/MergeOperationTest.php, line 56

Class

MergeOperationTest

Namespace

Symfony\Component\Translation\Tests\Catalogue

Code

public function testGetResultWithMetadata() {
  $leftCatalogue = new MessageCatalogue('en', array(
    'messages' => array(
      'a' => 'old_a',
      'b' => 'old_b',
    ),
  ));
  $leftCatalogue
    ->setMetadata('a', 'foo', 'messages');
  $leftCatalogue
    ->setMetadata('b', 'bar', 'messages');
  $rightCatalogue = new MessageCatalogue('en', array(
    'messages' => array(
      'b' => 'new_b',
      'c' => 'new_c',
    ),
  ));
  $rightCatalogue
    ->setMetadata('b', 'baz', 'messages');
  $rightCatalogue
    ->setMetadata('c', 'qux', 'messages');
  $mergedCatalogue = new MessageCatalogue('en', array(
    'messages' => array(
      'a' => 'old_a',
      'b' => 'old_b',
      'c' => 'new_c',
    ),
  ));
  $mergedCatalogue
    ->setMetadata('a', 'foo', 'messages');
  $mergedCatalogue
    ->setMetadata('b', 'bar', 'messages');
  $mergedCatalogue
    ->setMetadata('c', 'qux', 'messages');
  $this
    ->assertEquals($mergedCatalogue, $this
    ->createOperation($leftCatalogue, $rightCatalogue)
    ->getResult());
}