/** * Register services */ protected function registerServices() { // Notification service $this->app->bind(NotificationService::class, function (Application $app) { if (!($config = config('user-notifications'))) { throw new InvalidConfigurationException(); } $moduleOptions = new ModuleOptions($config); $mappers = $moduleOptions->get('mappers'); /** @var NotificationMapperInterface|null $notificationMapper */ $notificationMapper = $app->make($mappers['notificationMapper']); if (!$notificationMapper instanceof NotificationMapperInterface) { throw new InvalidMapperException($notificationMapper, NotificationMapperInterface::class); } /** @var EventService $eventService */ $eventService = $app->make(EventService::class); return new NotificationService($eventService, $notificationMapper); }); // Doctrine notification mapper $this->app->bind(Mappers\DoctrineORM\NotificationMapper::class, function (Application $app) { $objectManager = $app->make('Doctrine\\ORM\\EntityManager'); return new Mappers\DoctrineORM\NotificationMapper($objectManager); }); }
public function testGet() { $key = 'a'; $result = $this->options->get($key); $this->assertSame($this->demoOptions[$key], $result); }