Eko\FeedBundle\Tests\Formatter\RSSFormatterTest::testTranslatableValue PHP Method

testTranslatableValue() public method

Check if values are well translated with "translatable" option.
    public function testTranslatableValue()
    {
        $config = ['feeds' => ['article' => ['title' => 'My title', 'description' => 'My description', 'link' => 'http://github.com/eko/FeedBundle', 'encoding' => 'utf-8']]];
        $translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
        $translator->expects($this->any())->method('trans')->will($this->returnValue('translatable-value'));
        $formatters = ['rss' => new RssFormatter($translator, 'test')];
        $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
        $manager = new FeedManager($router, $config, $formatters);
        $feed = $manager->get('article');
        $feed->add(new FakeItemInterfaceEntity());
        $feed->addItemField(new ItemField('fake_custom', 'getFeedItemCustom', ['translatable' => true]));
        $output = $feed->render('rss');
        $this->assertContains('<fake_custom>translatable-value</fake_custom>', $output);
    }