Page MenuHomeDevCentral

D231.id542.diff
No OneTemporary

D231.id542.diff

diff --git a/app/Providers/BrokerServiceProvider.php b/app/Providers/BrokerServiceProvider.php
--- a/app/Providers/BrokerServiceProvider.php
+++ b/app/Providers/BrokerServiceProvider.php
@@ -4,9 +4,8 @@
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
-use Keruald\Broker\AMQPBroker as Broker;
-use Config;
+use Keruald\Broker\BrokerFactory;
class BrokerServiceProvider extends ServiceProvider {
@@ -22,20 +21,14 @@
* Registers the application services.
*
* @return void
- *
- * @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function register() {
$this->app->singleton('broker', function (Application $app) {
- $broker = new Broker();
- $broker->connect(
- Config::get('broker.connections.amqp.host'),
- Config::get('broker.connections.amqp.port'),
- Config::get('broker.connections.amqp.username'),
- Config::get('broker.connections.amqp.password'),
- Config::get('broker.connections.amqp.vhost')
- );
- return $broker;
+ $config = $app->make('config');
+ $driver = $config->get('broker.driver');
+ $params = $config->get('broker.connections.' . $driver);
+
+ return BrokerFactory::make($params);
});
}
}
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.2.0",
+ "keruald/broker": ">=0.3.1",
"netresearch/jsonmapper": "~0.1.0"
},
"require-dev": {
diff --git a/tests/Providers/BrokerServiceProviderTest.php b/tests/Providers/BrokerServiceProviderTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Providers/BrokerServiceProviderTest.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests\Providers;
+
+class BrokerServiceProviderTest extends TestCase {
+
+ public function testType () {
+ $this->assertServiceInstanceOf(
+ 'Keruald\Broker\Broker',
+ 'broker'
+ );
+ }
+
+}
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 16:17 (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249613
Default Alt Text
D231.id542.diff (2 KB)

Event Timeline