fix event dispatcher and call the storage service

This commit is contained in:
Khoubza Younes
2020-12-06 04:03:14 +01:00
parent 529775dc81
commit 205907b9ce
3 changed files with 19 additions and 19 deletions
+3 -3
View File
@@ -31,9 +31,9 @@ class NotifyPnotifyServiceProvider extends ServiceProvider
public function provides()
{
return array(
'notify.producer',
'notify.producer.pnotify',
'notify.renderer.pnotify',
'flasher.factory',
'flasher.factory.pnotify',
'flasher.renderer.pnotify',
);
}
+12 -12
View File
@@ -35,25 +35,25 @@ class Laravel implements ServiceProviderInterface
public function registerNotifyPnotifyServices()
{
$this->app->singleton('notify.producer.pnotify', function (Container $app) {
return new PnotifyProducer($app['notify.storage'], $app['notify.middleware']);
$this->app->singleton('flasher.factory.pnotify', function (Container $app) {
return new PnotifyProducer($app['flasher.storage'], $app['flasher.middleware']);
});
$this->app->singleton('notify.renderer.pnotify', function (Container $app) {
return new PnotifyRenderer($app['notify.config']);
$this->app->singleton('flasher.renderer.pnotify', function (Container $app) {
return new PnotifyRenderer($app['flasher.config']);
});
$this->app->alias('notify.producer.pnotify', 'Flasher\PFlasher\Prime\TestsProducer\PnotifyProducer');
$this->app->alias('notify.renderer.pnotify', 'Flasher\PFlasher\Prime\Renderer\PnotifyRenderer');
$this->app->alias('flasher.factory.pnotify', 'Flasher\PFlasher\Prime\TestsProducer\PnotifyProducer');
$this->app->alias('flasher.renderer.pnotify', 'Flasher\PFlasher\Prime\Renderer\PnotifyRenderer');
$this->app->extend('notify.producer', function (Flasher $manager, Container $app) {
$manager->addDriver('pnotify', $app['notify.producer.pnotify']);
$this->app->extend('flasher.factory', function (Flasher $manager, Container $app) {
$manager->addDriver('pnotify', $app['flasher.factory.pnotify']);
return $manager;
});
$this->app->extend('notify.renderer', function (RendererManager $manager, Container $app) {
$manager->addDriver('pnotify', $app['notify.renderer.pnotify']);
$this->app->extend('flasher.renderer', function (RendererManager $manager, Container $app) {
$manager->addDriver('pnotify', $app['flasher.renderer.pnotify']);
return $manager;
});
@@ -61,10 +61,10 @@ class Laravel implements ServiceProviderInterface
public function mergeConfigFromPnotify()
{
$notifyConfig = $this->app['config']->get('notify.adapters.pnotify', array());
$notifyConfig = $this->app['config']->get('flasher.adapters.pnotify', array());
$pnotifyConfig = $this->app['config']->get('notify_pnotify', array());
$this->app['config']->set('notify.adapters.pnotify', array_merge($pnotifyConfig, $notifyConfig));
$this->app['config']->set('flasher.adapters.pnotify', array_merge($pnotifyConfig, $notifyConfig));
}
}
+4 -4
View File
@@ -6,13 +6,13 @@ class NotifyPnotifyServiceProviderTest extends TestCase
{
public function testContainerContainNotifyServices()
{
$this->assertTrue($this->app->bound('notify.producer'));
$this->assertTrue($this->app->bound('notify.producer.pnotify'));
$this->assertTrue($this->app->bound('flasher.factory'));
$this->assertTrue($this->app->bound('flasher.factory.pnotify'));
}
public function testNotifyFactoryIsAddedToExtensionsArray()
{
$manager = $this->app->make('notify.producer');
$manager = $this->app->make('flasher.factory');
$reflection = new \ReflectionClass($manager);
$property = $reflection->getProperty('drivers');
@@ -26,7 +26,7 @@ class NotifyPnotifyServiceProviderTest extends TestCase
public function testConfigPnotifyInjectedInGlobalNotifyConfig()
{
$manager = $this->app->make('notify.producer');
$manager = $this->app->make('flasher.factory');
$reflection = new \ReflectionClass($manager);
$property = $reflection->getProperty('config');