mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-23 16:10:28 +00:00
Pass logger in constructor for importers
This commit is contained in:
parent
96c8cc25af
commit
51884911f5
10 changed files with 22 additions and 47 deletions
|
@ -236,7 +236,6 @@ services:
|
|||
Wallabag\ImportBundle\Import\PocketImport:
|
||||
calls:
|
||||
- [ setClient, [ "@wallabag_import.pocket.client" ] ]
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: pocket }
|
||||
|
||||
|
@ -244,56 +243,38 @@ services:
|
|||
arguments:
|
||||
$fetchingErrorMessageTitle: "%wallabag_core.fetching_error_message_title%"
|
||||
$fetchingErrorMessage: "%wallabag_core.fetching_error_message%"
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: wallabag_v1 }
|
||||
|
||||
Wallabag\ImportBundle\Import\WallabagV2Import:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: wallabag_v2 }
|
||||
|
||||
Wallabag\ImportBundle\Import\ElcuratorImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: elcurator }
|
||||
|
||||
Wallabag\ImportBundle\Import\ReadabilityImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: readability }
|
||||
|
||||
Wallabag\ImportBundle\Import\InstapaperImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: instapaper }
|
||||
|
||||
Wallabag\ImportBundle\Import\PinboardImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: pinboard }
|
||||
|
||||
Wallabag\ImportBundle\Import\DeliciousImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: delicious }
|
||||
|
||||
Wallabag\ImportBundle\Import\FirefoxImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: firefox }
|
||||
|
||||
Wallabag\ImportBundle\Import\ChromeImport:
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: chrome }
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Wallabag\ImportBundle\Import;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
@ -29,10 +28,10 @@ abstract class AbstractImport implements ImportInterface
|
|||
protected $importedEntries = 0;
|
||||
protected $queuedEntries = 0;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher)
|
||||
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->logger = new NullLogger();
|
||||
$this->logger = $logger;
|
||||
$this->contentProxy = $contentProxy;
|
||||
$this->tagsAssigner = $tagsAssigner;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
|
@ -12,12 +13,12 @@ class WallabagV1Import extends WallabagImport
|
|||
protected $fetchingErrorMessage;
|
||||
protected $fetchingErrorMessageTitle;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher, $fetchingErrorMessageTitle, $fetchingErrorMessage)
|
||||
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, $fetchingErrorMessageTitle, $fetchingErrorMessage)
|
||||
{
|
||||
$this->fetchingErrorMessageTitle = $fetchingErrorMessageTitle;
|
||||
$this->fetchingErrorMessage = $fetchingErrorMessage;
|
||||
|
||||
parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher);
|
||||
parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $logger);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -232,11 +232,10 @@ class ChromeImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$wallabag->setLogger($logger);
|
||||
|
||||
$wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$wallabag->setUser($this->user);
|
||||
|
|
|
@ -232,11 +232,10 @@ class FirefoxImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$wallabag->setLogger($logger);
|
||||
|
||||
$wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$wallabag->setUser($this->user);
|
||||
|
|
|
@ -247,11 +247,10 @@ class InstapaperImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$import->setLogger($logger);
|
||||
|
||||
$import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$import->setUser($this->user);
|
||||
|
|
|
@ -589,12 +589,11 @@ JSON
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
$pocket->setUser($this->user);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$pocket->setLogger($logger);
|
||||
|
||||
$pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
$pocket->setUser($this->user);
|
||||
|
||||
return $pocket;
|
||||
}
|
||||
|
|
|
@ -232,11 +232,10 @@ class ReadabilityImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$wallabag->setLogger($logger);
|
||||
|
||||
$wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$wallabag->setUser($this->user);
|
||||
|
|
|
@ -249,19 +249,19 @@ class WallabagV1ImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
|
||||
$wallabag = new WallabagV1Import(
|
||||
$this->em,
|
||||
$this->contentProxy,
|
||||
$this->tagsAssigner,
|
||||
$dispatcher,
|
||||
$logger,
|
||||
$this->fetchingErrorMessageTitle,
|
||||
$this->fetchingErrorMessage
|
||||
);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$wallabag->setLogger($logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$wallabag->setUser($this->user);
|
||||
}
|
||||
|
|
|
@ -275,11 +275,10 @@ class WallabagV2ImportTest extends TestCase
|
|||
->expects($this->exactly($dispatched))
|
||||
->method('dispatch');
|
||||
|
||||
$wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
$logger = new Logger('test', [$this->logHandler]);
|
||||
$wallabag->setLogger($logger);
|
||||
|
||||
$wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher, $logger);
|
||||
|
||||
if (false === $unsetUser) {
|
||||
$wallabag->setUser($this->user);
|
||||
|
|
Loading…
Reference in a new issue