aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php')
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
new file mode 100644
index 00000000..78023e1b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -0,0 +1,74 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Translation\Test\Catalogue;
13
14use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15use Symfony\Component\Translation\MessageCatalogue;
16use Symfony\Component\Translation\MessageCatalogueInterface;
17
18abstract class AbstractOperationTest extends TestCase
19{
20 public function testGetEmptyDomains()
21 {
22 $this->assertEquals(
23 array(),
24 $this->createOperation(
25 new MessageCatalogue('en'),
26 new MessageCatalogue('en')
27 )->getDomains()
28 );
29 }
30
31 public function testGetMergedDomains()
32 {
33 $this->assertEquals(
34 array('a', 'b', 'c'),
35 $this->createOperation(
36 new MessageCatalogue('en', array('a' => array(), 'b' => array())),
37 new MessageCatalogue('en', array('b' => array(), 'c' => array()))
38 )->getDomains()
39 );
40 }
41
42 public function testGetMessagesFromUnknownDomain()
43 {
44 $this->setExpectedException('InvalidArgumentException');
45 $this->createOperation(
46 new MessageCatalogue('en'),
47 new MessageCatalogue('en')
48 )->getMessages('domain');
49 }
50
51 public function testGetEmptyMessages()
52 {
53 $this->assertEquals(
54 array(),
55 $this->createOperation(
56 new MessageCatalogue('en', array('a' => array())),
57 new MessageCatalogue('en')
58 )->getMessages('a')
59 );
60 }
61
62 public function testGetEmptyResult()
63 {
64 $this->assertEquals(
65 new MessageCatalogue('en'),
66 $this->createOperation(
67 new MessageCatalogue('en'),
68 new MessageCatalogue('en')
69 )->getResult()
70 );
71 }
72
73 abstract protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target);
74}