summaryrefslogtreecommitdiffstats
path: root/test/php/Lib/StrikingCommandTransport.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
commitbe4626482ba8761da39746a6ac60d133d3852a0f (patch)
tree45065832c85c4789237e94b3114360eac91d86f0 /test/php/Lib/StrikingCommandTransport.php
parentReleasing progress-linux version 1.1.1-1~progress7.99u1. (diff)
downloadicingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz
icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/php/Lib/StrikingCommandTransport.php')
-rw-r--r--test/php/Lib/StrikingCommandTransport.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/php/Lib/StrikingCommandTransport.php b/test/php/Lib/StrikingCommandTransport.php
new file mode 100644
index 0000000..5e14ef9
--- /dev/null
+++ b/test/php/Lib/StrikingCommandTransport.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Tests\Icinga\Module\Icingadb\Lib;
+
+use Icinga\Application\Config;
+use Icinga\Data\ConfigObject;
+use Icinga\Module\Icingadb\Command\IcingaApiCommand;
+use Icinga\Module\Icingadb\Command\Transport\ApiCommandTransport;
+use Icinga\Module\Icingadb\Command\Transport\CommandTransport;
+use Icinga\Module\Icingadb\Command\Transport\CommandTransportException;
+
+class StrikingCommandTransport extends CommandTransport
+{
+ public static function getConfig(): Config
+ {
+ return Config::fromArray(['endpoint1' => ['host' => 'endpointA'], 'endpoint2' => ['host' => 'endpointB']]);
+ }
+
+ public static function createTransport(ConfigObject $config): ApiCommandTransport
+ {
+ return (new class extends ApiCommandTransport {
+ protected function sendCommand(IcingaApiCommand $command)
+ {
+ throw new CommandTransportException(sprintf('%s strikes!', $this->getHost()));
+ }
+ })->setHost($config->host);
+ }
+}