Fix tests
This commit is contained in:
committed by
M. Shull
parent
0a436087e1
commit
3ff55d85a9
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace MailPoet\Test\Twig;
|
||||
|
||||
use AspectMock\Test as Mock;
|
||||
use Codeception\Util\Stub;
|
||||
use MailPoet\Twig\Functions;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class FunctionsTest extends \MailPoetTest {
|
||||
function testItExecutesIsRtlFunction() {
|
||||
@@ -11,12 +12,20 @@ class FunctionsTest extends \MailPoetTest {
|
||||
$twig = new \Twig_Environment(new \Twig_Loader_Array($template));
|
||||
$twig->addExtension(new Functions());
|
||||
|
||||
Mock::func('MailPoet\Twig', 'is_rtl', true);
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
'isRtl' => true
|
||||
]));
|
||||
$result = $twig->render('template');
|
||||
expect($result)->equals('rtl');
|
||||
|
||||
Mock::func('MailPoet\Twig', 'is_rtl', false);
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
'isRtl' => false
|
||||
]));
|
||||
$result = $twig->render('template');
|
||||
expect($result)->isEmpty();
|
||||
}
|
||||
|
||||
function _after() {
|
||||
WPFunctions::set(new WPFunctions);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user