diff options
Diffstat (limited to 'library/Businessprocess/Web/Url.php')
-rw-r--r-- | library/Businessprocess/Web/Url.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/library/Businessprocess/Web/Url.php b/library/Businessprocess/Web/Url.php new file mode 100644 index 0000000..92b1e85 --- /dev/null +++ b/library/Businessprocess/Web/Url.php @@ -0,0 +1,32 @@ +<?php + +namespace Icinga\Module\Businessprocess\Web; + +use Icinga\Application\Icinga; +use Icinga\Application\Web; +use Icinga\Web\Request; +use Icinga\Web\Url as WebUrl; + +/** + * Class Url + * + * The main purpose of this class is to get unit tests running on CLI + * + * @package Icinga\Module\Businessprocess\Web + */ +class Url extends WebUrl +{ + /** + * @return FakeRequest|Request + */ + protected static function getRequest() + { + $app = Icinga::app(); + if ($app->isCli()) { + return new FakeRequest(); + } + + /** @var Web $app */ + return $app->getRequest(); + } +} |