4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation\Tests\Catalogue;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Translation\MessageCatalogue;
16 use Symfony\Component\Translation\MessageCatalogueInterface;
18 abstract class AbstractOperationTest extends TestCase
20 public function testGetEmptyDomains()
24 $this->createOperation(
25 new MessageCatalogue('en'),
26 new MessageCatalogue('en')
31 public function testGetMergedDomains()
35 $this->createOperation(
36 new MessageCatalogue('en', array('a' => array(), 'b' => array())),
37 new MessageCatalogue('en', array('b' => array(), 'c' => array()))
42 public function testGetMessagesFromUnknownDomain()
44 $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
45 $this->createOperation(
46 new MessageCatalogue('en'),
47 new MessageCatalogue('en')
48 )->getMessages('domain');
51 public function testGetEmptyMessages()
55 $this->createOperation(
56 new MessageCatalogue('en', array('a' => array())),
57 new MessageCatalogue('en')
62 public function testGetEmptyResult()
65 new MessageCatalogue('en'),
66 $this->createOperation(
67 new MessageCatalogue('en'),
68 new MessageCatalogue('en')
73 abstract protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target);