Files
piratepoet/tests/integration/Twig/FunctionsTest.php
Pavel Dohnal 5da7110eb6 Use short array syntax
[MAILPOET-2090]
2019-05-20 10:18:45 -04:00

32 lines
824 B
PHP

<?php
namespace MailPoet\Test\Twig;
use Codeception\Util\Stub;
use MailPoet\Twig\Functions;
use MailPoet\WP\Functions as WPFunctions;
class FunctionsTest extends \MailPoetTest {
function testItExecutesIsRtlFunction() {
$template = ['template' => '{% if is_rtl() %}rtl{% endif %}'];
$twig = new \MailPoetVendor\Twig_Environment(new \MailPoetVendor\Twig_Loader_Array($template));
$twig->addExtension(new Functions());
WPFunctions::set(Stub::make(new WPFunctions, [
'isRtl' => true,
]));
$result = $twig->render('template');
expect($result)->equals('rtl');
WPFunctions::set(Stub::make(new WPFunctions, [
'isRtl' => false,
]));
$result = $twig->render('template');
expect($result)->isEmpty();
}
function _after() {
WPFunctions::set(new WPFunctions);
}
}