Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3913546
D197.id484.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D197.id484.diff
View Options
diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,7 @@
"php": ">=5.6.0",
"laravel/framework": "5.2.*",
"keruald/github": ">=0.2.0",
- "keruald/broker": ">=0.1.0",
+ "keruald/broker": ">=0.2.0",
"netresearch/jsonmapper": "~0.1.0"
},
"require-dev": {
diff --git a/tests/Http/PayloadFullTest.php b/tests/Http/PayloadFullTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Http/PayloadFullTest.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests;
+
+class PayloadFullTest extends TestCase {
+
+ public function setUp () {
+ parent::setUp();
+
+ $this->disableBroker();
+ }
+
+ /**
+ * Tests a GitHub gate payload.
+ */
+ public function testPost () {
+ $payload = file_get_contents(__DIR__ . '/../data/GitHubPingPayload.json');
+ $this->sendPayload(
+ '/gate/GitHub/Quux',
+ $payload,
+ 'POST',
+ [
+ 'X-Github-Event' => 'ping',
+ 'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c'
+ ]
+ )
+ ->seeJson([
+ 'gate' => 'GitHub',
+ 'door' => 'Quux',
+ 'action' => 'AMQPAction'
+ ]);
+
+ $this->assertResponseOk();
+ }
+}
diff --git a/tests/TestCase.php b/tests/TestCase.php
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -3,6 +3,7 @@
namespace Nasqueron\Notifications\Tests;
use Illuminate\Contracts\Console\Kernel;
+use Keruald\Broker\BlackholeBroker;
use Mockery;
@@ -47,6 +48,15 @@
$this->app->instance('events', $mock);
}
+ /**
+ * Mocks the broker
+ */
+ public function disableBroker () {
+ $broker = new BlackholeBroker();
+ $broker->acceptAllMethodCalls(); // allows to be used as a mock
+ $this->app->instance('broker', $broker);
+ }
+
///
/// Helpers to post data to gates
///
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 10:35 (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2307810
Default Alt Text
D197.id484.diff (1 KB)
Attached To
Mode
D197: Payload full test, with a blackhole broker
Attached
Detach File
Event Timeline
Log In to Comment