/** * @param array $mockedNamespaces List of namespaces, indexed by mocked features (time-sensitive or dns-sensitive) */ public function __construct(array $mockedNamespaces = array()) { $warn = false; foreach ($mockedNamespaces as $type => $namespaces) { if (!is_array($namespaces)) { $namespaces = array($namespaces); } if (is_int($type)) { // @deprecated BC with v2.8 to v3.0 $type = 'time-sensitive'; $warn = true; } if ('time-sensitive' === $type) { foreach ($namespaces as $ns) { ClockMock::register($ns . '\\DummyClass'); } } if ('dns-sensitive' === $type) { foreach ($namespaces as $ns) { DnsMock::register($ns . '\\DummyClass'); } } } if (self::$globallyEnabled) { $this->state = -2; } else { self::$globallyEnabled = true; if ($warn) { echo "Clock-mocked namespaces for SymfonyTestsListener need to be nested in a \"time-sensitive\" key. This will be enforced in Symfony 4.0.\n"; } } }
public function __construct(array $extraClockMockedNamespaces = array()) { if ($extraClockMockedNamespaces) { foreach ($extraClockMockedNamespaces as $ns) { ClockMock::register($ns . '\\DummyClass'); } } if (self::$globallyEnabled) { $this->state = -2; } else { self::$globallyEnabled = true; } }
/** * @param array $mockedNamespaces List of namespaces, indexed by mocked features (time-sensitive). */ public function __construct(array $mockedNamespaces = array()) { foreach ($mockedNamespaces as $type => $namespaces) { if (!is_array($namespaces)) { $namespaces = array($namespaces); } if (is_int($type)) { $type = 'time-sensitive'; } if ('time-sensitive' === $type) { foreach ($namespaces as $ns) { ClockMock::register($ns . '\\DummyClass'); } } } if (self::$globallyEnabled) { $this->state = -2; } else { self::$globallyEnabled = true; } }