codeception/verify 2.1 removed support for expect()->isEmpty() so we need to replace it with verify()->empty(). [MAILPOET-5664]
25 lines
769 B
PHP
25 lines
769 B
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace MailPoet\Test\Twig;
|
|
|
|
use Codeception\Util\Stub;
|
|
use MailPoet\Twig\Functions;
|
|
use MailPoet\WP\Functions as WPFunctions;
|
|
use MailPoetVendor\Twig\Environment;
|
|
|
|
class FunctionsTest extends \MailPoetTest {
|
|
public function testItExecutesIsRtlFunction() {
|
|
$template = ['template' => '{% if is_rtl() %}rtl{% endif %}'];
|
|
$twig = new Environment(new \MailPoetVendor\Twig\Loader\ArrayLoader($template));
|
|
WPFunctions::set(Stub::make(new WPFunctions, [
|
|
'isRtl' => Stub::consecutive(true, false),
|
|
]));
|
|
|
|
$twig->addExtension(new Functions());
|
|
$resultRtl = $twig->render('template');
|
|
verify($resultRtl)->equals('rtl');
|
|
$resultNoRtl = $twig->render('template');
|
|
verify($resultNoRtl)->empty();
|
|
}
|
|
}
|