| @@ 11-33 (lines=23) @@ | ||
| 8 | * @copyright Copyright 2015 Fwolf |
|
| 9 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 10 | */ |
|
| 11 | class ErrorLog implements FunctionMockWrapperInterface |
|
| 12 | { |
|
| 13 | use FunctionMockWrapperTrait; |
|
| 14 | ||
| 15 | ||
| 16 | /** @type string */ |
|
| 17 | public $function = 'error_log'; |
|
| 18 | ||
| 19 | ||
| 20 | /** |
|
| 21 | * {@inheritdoc} |
|
| 22 | */ |
|
| 23 | public function build($namespace) |
|
| 24 | { |
|
| 25 | $callback = function($message) use ($namespace) { |
|
| 26 | self::$results[$namespace] = $message; |
|
| 27 | ||
| 28 | return true; |
|
| 29 | }; |
|
| 30 | ||
| 31 | return $this->buildFunctionMock($namespace, $callback); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 11-32 (lines=22) @@ | ||
| 8 | * @copyright Copyright 2015 Fwolf |
|
| 9 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 10 | */ |
|
| 11 | class ExtensionLoaded implements FunctionMockWrapperInterface |
|
| 12 | { |
|
| 13 | use FunctionMockWrapperTrait; |
|
| 14 | ||
| 15 | ||
| 16 | /** @type string */ |
|
| 17 | public $function = 'extension_loaded'; |
|
| 18 | ||
| 19 | ||
| 20 | /** |
|
| 21 | * {@inheritdoc} |
|
| 22 | */ |
|
| 23 | public function build($namespace) |
|
| 24 | { |
|
| 25 | $callback = function($ext) use ($namespace) { |
|
| 26 | return self::$results[$namespace] && |
|
| 27 | \extension_loaded($ext); |
|
| 28 | }; |
|
| 29 | ||
| 30 | return $this->buildFunctionMock($namespace, $callback); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 11-31 (lines=21) @@ | ||
| 8 | * @copyright Copyright 2015 Fwolf |
|
| 9 | * @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
| 10 | */ |
|
| 11 | class Header implements FunctionMockWrapperInterface |
|
| 12 | { |
|
| 13 | use FunctionMockWrapperTrait; |
|
| 14 | ||
| 15 | ||
| 16 | /** @type string */ |
|
| 17 | public $function = 'header'; |
|
| 18 | ||
| 19 | ||
| 20 | /** |
|
| 21 | * {@inheritdoc} |
|
| 22 | */ |
|
| 23 | public function build($namespace) |
|
| 24 | { |
|
| 25 | $callback = function($headerString) use ($namespace) { |
|
| 26 | self::$results[$namespace][] = $headerString; |
|
| 27 | }; |
|
| 28 | ||
| 29 | return $this->buildFunctionMock($namespace, $callback); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||