Skip to content

Commit

Permalink
feature #18726 [PhpUnitBridge] Make ClockMock match namespaces that b…
Browse files Browse the repository at this point in the history
…egin with Tests\\ (teohhanhui)

This PR was submitted for the 2.8 branch but it was merged into the 3.2-dev branch instead (closes #18726).

Discussion
----------

[PhpUnitBridge] Make ClockMock match namespaces that begin with Tests\\

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes?
| New feature?  | no
| BC breaks?    | no?
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | symfony/symfony-docs#6546

See symfony/symfony-standard#969

Commits
-------

2630c13 [PhpUnitBridge] Make ClockMock match namespaces that begin with Tests\\
  • Loading branch information
nicolas-grekas committed May 30, 2016
2 parents f0953da + 2630c13 commit b59664b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/PhpUnit/ClockMock.php
Expand Up @@ -77,6 +77,8 @@ public static function register($class)
if (0 < strpos($class, '\\Tests\\')) {
$ns = str_replace('\\Tests\\', '\\', $class);
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
} elseif (0 === strpos($class, 'Tests\\')) {
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
}
foreach ($mockedNs as $ns) {
if (function_exists($ns.'\time')) {
Expand Down

0 comments on commit b59664b

Please sign in to comment.