Skip to content

Commit 81deef5

Browse files
committed
Do not depend on RB for utility test
1 parent 3bf3057 commit 81deef5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

php/libraries/Utility.class.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,10 @@ class Utility
851851
"Input must be a valid date/time string: $e"
852852
);
853853
}
854+
855+
$factory = \NDB_Factory::singleton();
854856
return $dt->format(
855-
\NDB_Config::singleton()->getSetting('dateDisplayFormat')
857+
$factory->config()->getSetting('dateDisplayFormat')
856858
?? DateTime::ATOM
857859
);
858860
}

test/unittests/UtilityTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,13 @@ public function testRandomString()
11361136
public function testToDateDisplayFormat()
11371137
{
11381138
$this->_setMockDB();
1139+
1140+
$config = $this->getMockBuilder("\NDB_Config")->getMock();
1141+
$config->expects($this->any())
1142+
->method('getSetting')
1143+
->willReturn('Y-m-d H:i:s');
1144+
$this->_mockFactory->setConfig($config);
1145+
11391146
$date = "2000-01-01";
11401147
$this->assertEquals(
11411148
"2000-01-01 00:00:00",

0 commit comments

Comments
 (0)