Skip to content
Browse files

feature #18726 [PhpUnitBridge] Make ClockMock match namespaces that b…

…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...
2 parents f0953da + 2630c13 commit b59664bc421e96e326631d8966164e05f4fc26ae @nicolas-grekas nicolas-grekas committed May 30, 2016
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/Symfony/Bridge/PhpUnit/ClockMock.php
View
2 src/Symfony/Bridge/PhpUnit/ClockMock.php
@@ -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')) {

0 comments on commit b59664b

Please sign in to comment.
Something went wrong with that request. Please try again.