Skip to content

Commit 93348d2

Browse files
committed
feat(ClockMock): add strtotime()
1 parent 170b631 commit 93348d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ public static function hrtime($asNumber = false)
109109
return [(int) self::$now, (int) $ns];
110110
}
111111

112+
public static function strtotime(string $datetime, ?int $timestamp = null): false|int
113+
{
114+
if (null === $timestamp) {
115+
$timestamp = self::time();
116+
}
117+
118+
return \strtotime($datetime, $timestamp);
119+
}
120+
112121
public static function register($class): void
113122
{
114123
$self = static::class;
@@ -161,6 +170,11 @@ function hrtime(\$asNumber = false)
161170
{
162171
return \\$self::hrtime(\$asNumber);
163172
}
173+
174+
function strtotime(\$datetime, \$timestamp = null)
175+
{
176+
return \\$self::strtotime(\$datetime, \$timestamp);
177+
}
164178
EOPHP
165179
);
166180
}

0 commit comments

Comments
 (0)