* * 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:----w6bok8u6FtapwJG1OagT/x7Anf5O62ufE8L9ykXhXrAoFrgfvyMfEyX8bHOoBfpakxrWrew/6epjLIifYAnUh5f/IMHRk18lHEGFypjwEfmW8D5dDUAkUTRwTd4O/XiY8uF0ca2sUK04MeIPcOEuJEW/UwjcNk38IpVseTpVDhHd6D+1EUHCK8n4j7DdnW7ecw3ax6NeN7XkpIHTVesa8BAStVQVqMLHtvUcYG+CaX0U4t0WBmeGODVWgenXFi+7EXLxatTXq2syhWdCBIQqEFwKp9DMQOxHOg/h70hBpTzjUcuRo/7KaYrExxspEjmAahT7q5BilOXcj2M80w25TU0Omeh7oDxbUofavlzowd51VPf3A2Q8kqa3ioBj/faiaHAdwHy63ji7sPNNGPkRbPTq08hbQdF18Sq9Zrjzk5ZACmjZ671iS5Vh5XEefxrnFVj6qJ6Dj8J8RB08a9Qe6/TKY1BnHgBCKZAgzvLSiIzvkjjXlY3/L4JR9QgqMdGy4K/5SuJFbXVEStbl/w3n6iDHyc7KGwUOcct8iyj5nYTktIQwr6X5ZjIyUmWLPXTs75K4kS4YLdCZPk/X+CS3Fh00hsKM93i6f1CgAYqJge9oQZ3mFCuA0SOot4ucNwY64ndXZGjJaTIGQBZCVB+PHQ7UiPK6n+q6yOrG7IqqHdg=----ATTACHMENT:----NzEwMTQ0NTcyNTcxMTcxNiA5MTg3NDc1MjM5NjIwNDczIDQyNDgzNDQ4MjcwNzQxMjg=