1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-09 16:17:14 +02:00

Stub e_date::convert_date() in e_parse_shortcodeTest

Prevents this flaky error:

---------
1) e_parse_shortcodeTest: Forum shortcodes
 Test  tests/unit/e_parse_shortcodeTest.php:testForumShortcodes
{INFO} != sc_info()
Failed asserting that two strings are equal.
- Expected | + Actual
@@ @@
'Welcome e107-cli<br />There are no new posts since your last visit.<br />
You last visited at  <br />
-			It is now Tuesday 28 September 2021 - 16:25:39'
+			It is now Tuesday 28 September 2021 - 16:25:38'
#1  /__w/e107/e107/e107_tests/tests/unit/e_parse_shortcodeTest.php:1656
#2  /__w/e107/e107/e107_tests/tests/unit/e_parse_shortcodeTest.php:1147
#3  e_parse_shortcodeTest->testForumShortcodes
#4  {closure}
This commit is contained in:
Nick Liu
2021-09-28 12:27:09 -05:00
parent 8c0b216ffd
commit 010492b67e

View File

@@ -43,7 +43,11 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
$this->original_e_date = e107::getDate(); $this->original_e_date = e107::getDate();
$mock_e_date = $this->make('e_date', [ $mock_e_date = $this->make('e_date', [
'computeLapse' => 'E107_TEST_STUBBED_OUT' 'computeLapse' => 'E107_TEST_STUBBED_OUT',
'convert_date' => function($datestamp, $mask = '')
{
return $this->original_e_date->convert_date(0, $mask);
},
]); ]);
e107::setRegistry('core/e107/singleton/e_date', $mock_e_date); e107::setRegistry('core/e107/singleton/e_date', $mock_e_date);
} }