Example #1
0
 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
 {
     $this->user = $tokenStorage->getToken()->getUser();
     $this->em = $em;
     $this->contentProxy = $contentProxy;
     $this->consumerKey = $craueConfig->get('pocket_consumer_key');
     $this->logger = new NullLogger();
 }
Example #2
0
 /**
  * Initialize the auth code mailer with the SwiftMailer object.
  *
  * @param \Swift_Mailer     $mailer
  * @param \Twig_Environment $twig
  * @param string            $senderEmail
  * @param string            $senderName
  * @param Config            $craueConfig Craue\Config instance to get wallabag support url from database
  */
 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig)
 {
     $this->mailer = $mailer;
     $this->twig = $twig;
     $this->senderEmail = $senderEmail;
     $this->senderName = $senderName;
     $this->supportUrl = $craueConfig->get('wallabag_support_url');
     $this->wallabagUrl = $craueConfig->get('wallabag_url');
 }
 public function it_send_emails(ClosePenaltyService $closePenaltyService, ContainerInterface $container, Config $config, InputInterface $input, MailService $mailer, OutputInterface $output, Penalty $penalty, Rental $rental, RentalRepository $rentalRepository, RequestStack $requestStack, TimePenaltyRepository $timePenaltyRepository, TranslatorInterface $translator)
 {
     $config->get('seta.notifications.days_before_renovation')->shouldBeCalled()->willReturn('2');
     $config->get('seta.notifications.days_before_suspension')->shouldBeCalled()->willReturn('8');
     $container->get('seta_mailing')->shouldBeCalled()->willReturn($mailer);
     $container->get('translator')->shouldBeCalled()->willReturn($translator);
     $container->get('seta.service.close_penalty')->willReturn($closePenaltyService);
     $timePenaltyRepository->findExpiredPenalties()->shouldBeCalled()->willReturn([$penalty]);
     $closePenaltyService->closePenalty($penalty);
     $translator->getLocale()->shouldBeCalled()->willReturn('es');
     $container->get('request_stack')->shouldBeCalled()->willReturn($requestStack);
     $requestStack->push(Argument::type(Request::class))->shouldBeCalled();
     $rentalRepository->getExpireOnDateRentals(Argument::type(\DateTime::class))->willReturn([$rental])->shouldBeCalled();
     $mailer->sendEmail($rental, Argument::any())->shouldBeCalled();
     $this->setContainer($container);
     $this->run($input, $output);
 }
 /**
  * @param string $name Name of the setting.
  * @return string|null Value of the setting.
  * @throws \RuntimeException If the setting is not defined.
  */
 public function getSetting($name)
 {
     return $this->config->get($name);
 }
Example #5
0
 /**
  * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database
  * @param string $logoPath    Path to the logo FROM THE BUNDLE SCOPE
  */
 public function __construct(Config $craueConfig, $logoPath)
 {
     $this->wallabagUrl = $craueConfig->get('wallabag_url');
     $this->logoPath = $logoPath;
 }
Example #6
0
 /**
  * Ensure that the repository is fetched only once from the EntityManager, but again if it's changed at runtime.
  */
 public function testGetRepo()
 {
     $config = new Config();
     $method = new \ReflectionMethod($config, 'getRepo');
     $method->setAccessible(true);
     // 1st call to `getRepo` using a mocked EntityManager
     $config->setEntityManager($this->getMockedEntityManager());
     // invoke twice to ensure the cached instance is used
     $method->invoke($config);
     $method->invoke($config);
     // 2nd call to `getRepo` using a different mocked EntityManager
     $config->setEntityManager($this->getMockedEntityManager());
     // invoke twice to ensure the cached instance is used
     $method->invoke($config);
     $method->invoke($config);
 }