* * 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\MergeOperation; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\MessageCatalogueInterface; class MergeOperationTest 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', 'b' => 'old_b', 'c' => 'new_c'), $operation->getMessages('messages') ); $this->assertEquals( array('c' => 'new_c'), $operation->getNewMessages('messages') ); $this->assertEquals( array(), $operation->getObsoleteMessages('messages') ); } public function testGetResultFromSingleDomain() { $this->assertEquals( new MessageCatalogue('en', array( 'messages' => array('a' => 'old_a', 'b' => 'old_b', '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'); $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() ); } protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target) { return new MergeOperation($source, $target); } } __halt_compiler();----SIGNATURE:----eoVmc2jSEbRpwdugl1Pyi9nBmyhfEpmKUBReCLOBWjqxJARX6c1dZTpj7Ag/l5rTlJk0gP0Q91XiE1Ie8rpwcZM9QC5+BL1bGOSN8b/nJPTDqZH3LAT77gPGHt14QZZ1rSZRAJBProMlxNlYjq+0llvPjmrd8MGjE75Xfmi8RY/BtWch4wqT4D8QhVmDsMsv/Lj3sl42u2WUQL5fuC9TLPwe9rzazz8toUwUK8biFQfrPj1FJHuZWDeGuFxt9jcl5jfc9Rpp+Dvq8dqgTMc5beKUr+pTbtTDoHZQPaq/R0Ri6DbwOCjIMhlEIr9P/qh3oqZDoZnCiY+VFwjpRKsXGwOPa1dPCd/hcsgcfU0ZrpoU/D9rNSgvuRFA7Ht9juKrbuwmPDDcrnA6nGFrG1+C/96dTUiVo2ONVok+MwBLLhS8OVpPlccydy264DgCANR4N6UdKxEjEUMj6YzEzjo6lm32vp76I1R69T+gqUhcllJzpDa11RtzHjdUvvRrpcXBQymz/BMgGKe81vXBtmamk7mOlXn1AZTUN1mLChtlBexSF/7aSas1Hy52PgZE6Y43PbPOFD6deqyDGcS0Ce1U2oiPO1fxFXW9Gg45RR7ZeuGWiuml2k+NcCUuNI2uhjND1GFipx+SYQNByjln+0d0P4q45pS2yiJ2ctU5T80NjvM=----ATTACHMENT:----NTg4MDg2OTMxNjQ1NTMxNyA5OTY2ODk5NjI4OTQyMDA4IDczNzIxMjg5NzkzMzIzMDU=