Page MenuHomeDevCentral

D216.diff
No OneTemporary

D216.diff

diff --git a/tests/Http/PayloadFullTest.php b/tests/Http/PayloadFullTest.php
--- a/tests/Http/PayloadFullTest.php
+++ b/tests/Http/PayloadFullTest.php
@@ -51,4 +51,27 @@
);
$this->assertResponseStatus(403);
}
+
+ public function testBrokerIssue () {
+ $this->mockNotOperationalBroker();
+
+ $payload = file_get_contents(__DIR__ . '/../data/GitHubPingPayload.json');
+ $this->sendPayload(
+ '/gate/GitHub/Acme', // A gate existing in data/credentials.json
+ $payload,
+ 'POST',
+ [
+ 'X-Github-Event' => 'ping',
+ 'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c',
+ 'X-Hub-Signature' => 'sha1=25f6cbd17ea4c6c69958b95fb88c879de4b66dcc',
+ ]
+ )->seeJson([
+ 'gate' => 'GitHub',
+ 'door' => 'Acme',
+ 'action' => 'AMQPAction',
+ 'type' => 'RuntimeException',
+ ]);
+
+ $this->assertResponseStatus(503);
+ }
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -4,6 +4,7 @@
use Illuminate\Contracts\Console\Kernel;
use Keruald\Broker\BlackholeBroker;
+use Keruald\Broker\Broker;
use Mockery;
@@ -57,6 +58,18 @@
$this->app->instance('broker', $broker);
}
+ /**
+ * Mocks the broker, throwing an exception when sendMessage is called.
+ */
+ public function mockNotOperationalBroker () {
+ $mock = Mockery::mock('Keruald\Broker\Broker');
+ $mock->shouldReceive('connect');
+ $mock->shouldReceive('setExchangeTarget->routeTo->sendMessage')
+ ->andThrow(new \RuntimeException);
+
+ $this->app->instance('broker', $mock);
+ }
+
///
/// Helpers to post data to gates
///

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 04:27 (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250242
Default Alt Text
D216.diff (1 KB)

Event Timeline