Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3749563
D231.id542.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D231.id542.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D231: Use broker factory
Attached
Detach File
Event Timeline
Log In to Comment