class MergeOperationTest in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php \Symfony\Component\Translation\Tests\Catalogue\MergeOperationTest
Hierarchy
- class \Symfony\Component\Translation\Tests\Catalogue\AbstractOperationTest extends \Symfony\Component\Translation\Tests\Catalogue\PHPUnit_Framework_TestCase
- class \Symfony\Component\Translation\Tests\Catalogue\MergeOperationTest
Expanded class hierarchy of MergeOperationTest
File
- vendor/
symfony/ translation/ Tests/ Catalogue/ MergeOperationTest.php, line 18
Namespace
Symfony\Component\Translation\Tests\CatalogueView source
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractOperationTest:: |
public | function | ||
AbstractOperationTest:: |
public | function | ||
AbstractOperationTest:: |
public | function | ||
AbstractOperationTest:: |
public | function | ||
AbstractOperationTest:: |
public | function | ||
MergeOperationTest:: |
protected | function |
Overrides AbstractOperationTest:: |
|
MergeOperationTest:: |
public | function | ||
MergeOperationTest:: |
public | function | ||
MergeOperationTest:: |
public | function |