engelsystem/tests/Unit/Renderer/Twig/Extensions/TranslationTest.php

41 lines
1.3 KiB
PHP
Raw Normal View History

<?php
namespace Engelsystem\Test\Unit\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Renderer\Twig\Extensions\Translation;
use PHPUnit\Framework\MockObject\MockObject;
class TranslationTest extends ExtensionTest
{
/**
* @covers \Engelsystem\Renderer\Twig\Extensions\Translation::__construct
* @covers \Engelsystem\Renderer\Twig\Extensions\Translation::getFilters
*/
public function testGeFilters()
{
/** @var Translator|MockObject $translator */
$translator = $this->createMock(Translator::class);
2019-11-29 16:51:36 +01:00
$extension = new Translation($translator);
$filters = $extension->getFilters();
$this->assertExtensionExists('trans', [$translator, 'translate'], $filters);
}
/**
* @covers \Engelsystem\Renderer\Twig\Extensions\Translation::getFunctions
*/
public function testGetFunctions()
{
/** @var Translator|MockObject $translator */
$translator = $this->createMock(Translator::class);
2019-11-29 16:51:36 +01:00
$extension = new Translation($translator);
$functions = $extension->getFunctions();
$this->assertExtensionExists('__', [$translator, 'translate'], $functions);
$this->assertExtensionExists('_e', [$translator, 'translatePlural'], $functions);
}
}