* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Tests\Catalogue; use Symfony\Component\Translation\Catalogue\TargetOperation; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\MessageCatalogueInterface; class TargetOperationTest extends AbstractOperationTest { public function testGetMessagesFromSingleDomain() { $operation = $this->createOperation( new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) ); $this->assertEquals( array('a' => 'old_a', 'c' => 'new_c'), $operation->getMessages('messages') ); $this->assertEquals( array('c' => 'new_c'), $operation->getNewMessages('messages') ); $this->assertEquals( array('b' => 'old_b'), $operation->getObsoleteMessages('messages') ); } public function testGetResultFromSingleDomain() { $this->assertEquals( new MessageCatalogue('en', array( 'messages' => array('a' => 'old_a', 'c' => 'new_c'), )), $this->createOperation( new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) )->getResult() ); } 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'); $diffCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'old_b', 'c' => 'new_c'))); $diffCatalogue->setMetadata('b', 'bar', 'messages'); $diffCatalogue->setMetadata('c', 'qux', 'messages'); $this->assertEquals( $diffCatalogue, $this->createOperation( $leftCatalogue, $rightCatalogue )->getResult() ); } protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target) { return new TargetOperation($source, $target); } } __halt_compiler();----SIGNATURE:----dSQi31oMBBLxyUJOmKd9/H0EWJUcaQ33XWdfw+gBd5R2VXRkVJ/C2vhIfNUoQRdBMivnQ5PQIP3p9/nIQg73s7kX6yw0mThvHQOstnyNYpglY5hzJReVvdzSp5XIUNCWuEOp2DvtW3W7kJZhSQDv1NSMDW9Ot0iLBKMThA3HTc3jw+vbvzB8Ese7NcudFRSQWcCNGy9xC9GN6yaxnH+plyW7Bx3QIfuONUqmqCQE1E2NzYUUIQ6ZzsxWPQbfpTIY6kFd5/SuCQXBg/yr4n0q3Bap2wnWjAN+sbPr68h76LH/5puhvoe9OPvRcDIiFBpGG5mG+mU3VV0RglayfYthgJ6x9rHFVg+kQfet5ojrE+kJfDViw2fKO6/SddgaQpbb6spkeKSxVkV1dEl+SsNQOhvnG5h7XEknWrv1epH62atFsBQ78Dhnoc/UASjI+Rc1w5VnQxK5OaqNqbYn/0WYRW8qtRFY+GJY3HishViGdhaImPrZJ4j2kWudstmUB8e1r1WTBcjSQQGNeIKdGIjpjqDV1eXvAY729EqnaTAYqP5gxyGwMxrKHFNhALS9OiO00sGPBfnAjhMLO8DTIWhChv8O2GQqQlT2i4sC7OLBtpVoDPh+UL4rP6wDFc6nxSIw9YX9FO+NLyfxVkhtBrR+3bqQ2Vrc722sbz9ab20P5yM=----ATTACHMENT:----NDMzNTg2NTc3NTA3OTcwMiA4NDQ5MTA4Mjg5MDgzNDA0IDQ5NDkwOTYzNDAzMTY4MzM=