Skip to content

Commit

Permalink
Stub e_date::convert_date() in e_parse_shortcodeTest
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
Deltik committed Sep 28, 2021
1 parent 8c0b216 commit 010492b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion e107_tests/tests/unit/e_parse_shortcodeTest.php
Expand Up @@ -43,7 +43,11 @@ public function _before()

$this->original_e_date = e107::getDate();
$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);
}
Expand Down

0 comments on commit 010492b

Please sign in to comment.