Files
piratepoet/tests/integration/Twig/FunctionsTest.php
Pavel Dohnal 3d69b3aeec Move Twig to prefixed dependencies
Closes #1904
[MAILPOET-1929]
2019-04-01 05:43:25 -04:00

32 lines
827 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 = array('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);
}
}