Use FQCN as service name for helper services

This commit is contained in:
Yassine Guedidi 2022-04-24 17:48:59 +02:00
parent 7227d55913
commit 844e8e9d22
16 changed files with 103 additions and 85 deletions

View file

@ -406,7 +406,7 @@ sensio_framework_extra:
httplug:
clients:
wallabag_core:
factory: 'wallabag_core.http_client_factory'
factory: Wallabag\CoreBundle\Helper\HttpClientFactory
config:
defaults:
timeout: 10

View file

@ -14,6 +14,9 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Event\EntryDeletedEvent;
use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\EntriesExport;
use Wallabag\CoreBundle\Helper\TagsAssigner;
use Wallabag\CoreBundle\Helper\UrlHasher;
class EntryRestController extends WallabagRestController
@ -212,7 +215,7 @@ class EntryRestController extends WallabagRestController
$this->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId());
return $this->get('wallabag_core.helper.entries_export')
return $this->get(EntriesExport::class)
->setEntries($entry)
->updateTitle('entry')
->updateAuthor('entry')
@ -308,7 +311,7 @@ class EntryRestController extends WallabagRestController
if (false === $entry) {
$entry = new Entry($this->getUser());
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $url);
$this->get(ContentProxy::class)->updateEntry($entry, $url);
}
$em = $this->getDoctrine()->getManager();
@ -368,7 +371,7 @@ class EntryRestController extends WallabagRestController
$data = $this->retrieveValueFromRequest($request);
try {
$this->get('wallabag_core.content_proxy')->updateEntry(
$this->get(ContentProxy::class)->updateEntry(
$entry,
$entry->getUrl(),
[
@ -398,7 +401,7 @@ class EntryRestController extends WallabagRestController
}
if (!empty($data['tags'])) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $data['tags']);
}
if (!empty($data['origin_url'])) {
@ -414,11 +417,11 @@ class EntryRestController extends WallabagRestController
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
$this->get(ContentProxy::class)->setEntryDomainName($entry);
}
if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
$this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
}
$em = $this->getDoctrine()->getManager();
@ -460,7 +463,7 @@ class EntryRestController extends WallabagRestController
$this->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId());
$contentProxy = $this->get('wallabag_core.content_proxy');
$contentProxy = $this->get(ContentProxy::class);
$data = $this->retrieveValueFromRequest($request);
@ -515,7 +518,7 @@ class EntryRestController extends WallabagRestController
if (!empty($data['tags'])) {
$entry->removeAllTags();
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $data['tags']);
}
if (null !== $data['isPublic']) {
@ -531,11 +534,11 @@ class EntryRestController extends WallabagRestController
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
$this->get(ContentProxy::class)->setEntryDomainName($entry);
}
if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
$this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
}
$em = $this->getDoctrine()->getManager();
@ -566,7 +569,7 @@ class EntryRestController extends WallabagRestController
$this->validateUserAccess($entry->getUser()->getId());
try {
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
$this->get(ContentProxy::class)->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
@ -673,7 +676,7 @@ class EntryRestController extends WallabagRestController
$tags = $request->request->get('tags', '');
if (!empty($tags)) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
}
$em = $this->getDoctrine()->getManager();
@ -802,7 +805,7 @@ class EntryRestController extends WallabagRestController
$tags = $element->tags;
if (false !== $entry && !(empty($tags))) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags);
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
$em = $this->getDoctrine()->getManager();
$em->persist($entry);

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Finder\Finder;
use Wallabag\CoreBundle\Helper\DownloadImages;
class CleanDownloadedImagesCommand extends ContainerAwareCommand
{
@ -34,7 +35,7 @@ class CleanDownloadedImagesCommand extends ContainerAwareCommand
$io->text('Dry run mode <info>enabled</info> (no images will be removed)');
}
$downloadImages = $this->getContainer()->get('wallabag_core.entry.download_images');
$downloadImages = $this->getContainer()->get(DownloadImages::class);
$baseFolder = $downloadImages->getBaseFolder();
$io->text('Retrieve existing images');

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\EntriesExport;
use Wallabag\UserBundle\Repository\UserRepository;
class ExportCommand extends ContainerAwareCommand
@ -57,7 +58,7 @@ class ExportCommand extends ContainerAwareCommand
}
try {
$data = $this->getContainer()->get('wallabag_core.helper.entries_export')
$data = $this->getContainer()->get(EntriesExport::class)
->setEntries($entries)
->updateTitle('All')
->updateAuthor('All')

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\UserBundle\Repository\UserRepository;
class ReloadEntryCommand extends ContainerAwareCommand
@ -64,7 +65,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
$progressBar = $io->createProgressBar($nbEntries);
$contentProxy = $this->getContainer()->get('wallabag_core.content_proxy');
$contentProxy = $this->getContainer()->get(ContentProxy::class);
$em = $this->getContainer()->get('doctrine')->getManager();
$dispatcher = $this->getContainer()->get('event_dispatcher');

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\UserBundle\Repository\UserRepository;
class TagAllCommand extends ContainerAwareCommand
@ -36,7 +37,7 @@ class TagAllCommand extends ContainerAwareCommand
return 1;
}
$tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger');
$tagger = $this->getContainer()->get(RuleBasedTagger::class);
$io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));

View file

@ -18,6 +18,9 @@ use Wallabag\CoreBundle\Form\Type\EditEntryType;
use Wallabag\CoreBundle\Form\Type\EntryFilterType;
use Wallabag\CoreBundle\Form\Type\NewEntryType;
use Wallabag\CoreBundle\Form\Type\SearchEntryType;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Helper\Redirect;
class EntryController extends Controller
{
@ -98,7 +101,7 @@ class EntryController extends Controller
$em->flush();
}
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'));
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl);
}
@ -431,7 +434,7 @@ class EntryController extends Controller
$message
);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'));
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl);
}
@ -461,7 +464,7 @@ class EntryController extends Controller
$message
);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'));
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'));
return $this->redirect($redirectUrl);
}
@ -501,7 +504,7 @@ class EntryController extends Controller
$referer = $request->headers->get('referer');
$to = (1 !== preg_match('#' . $url . '$#i', $referer) ? $referer : null);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to);
$redirectUrl = $this->get(Redirect::class)->to($to);
return $this->redirect($redirectUrl);
}
@ -647,7 +650,7 @@ class EntryController extends Controller
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
$entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try {
$entries->setCurrentPage($page);
@ -683,7 +686,7 @@ class EntryController extends Controller
$message = 'flashes.entry.notice.' . $prefixMessage;
try {
$this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
$this->get(ContentProxy::class)->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
@ -694,11 +697,11 @@ class EntryController extends Controller
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
$this->get(ContentProxy::class)->setEntryDomainName($entry);
}
if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
$this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
}
$this->get('session')->getFlashBag()->add('notice', $message);

View file

@ -7,6 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Helper\EntriesExport;
/**
* The try/catch can be removed once all formats will be implemented.
@ -29,7 +30,7 @@ class ExportController extends Controller
public function downloadEntryAction(Entry $entry, $format)
{
try {
return $this->get('wallabag_core.helper.entries_export')
return $this->get(EntriesExport::class)
->setEntries($entry)
->updateTitle('entry')
->updateAuthor('entry')
@ -95,7 +96,7 @@ class ExportController extends Controller
}
try {
return $this->get('wallabag_core.helper.entries_export')
return $this->get(EntriesExport::class)
->setEntries($entries)
->updateTitle($title)
->updateAuthor($method)

View file

@ -14,6 +14,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\UserBundle\Entity\User;
class FeedController extends Controller
@ -121,7 +122,7 @@ class FeedController extends Controller
$pagerAdapter = new ArrayAdapter($entriesByTag);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare(
$entries = $this->get(PreparePagerForEntries::class)->prepare(
$pagerAdapter,
$user
);

View file

@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Helper\CryptoProxy;
use Wallabag\UserBundle\Entity\User;
/**
@ -48,8 +49,8 @@ class SiteCredentialController extends Controller
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$credential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getUsername()));
$credential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getPassword()));
$credential->setUsername($this->get(CryptoProxy::class)->crypt($credential->getUsername()));
$credential->setPassword($this->get(CryptoProxy::class)->crypt($credential->getPassword()));
$em = $this->getDoctrine()->getManager();
$em->persist($credential);
@ -87,8 +88,8 @@ class SiteCredentialController extends Controller
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$siteCredential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getUsername()));
$siteCredential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getPassword()));
$siteCredential->setUsername($this->get(CryptoProxy::class)->crypt($siteCredential->getUsername()));
$siteCredential->setPassword($this->get(CryptoProxy::class)->crypt($siteCredential->getPassword()));
$em = $this->getDoctrine()->getManager();
$em->persist($siteCredential);

View file

@ -13,6 +13,9 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Form\Type\NewTagType;
use Wallabag\CoreBundle\Form\Type\RenameTagType;
use Wallabag\CoreBundle\Helper\PreparePagerForEntries;
use Wallabag\CoreBundle\Helper\Redirect;
use Wallabag\CoreBundle\Helper\TagsAssigner;
class TagController extends Controller
{
@ -27,7 +30,7 @@ class TagController extends Controller
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$form->get('label')->getData()
);
@ -69,7 +72,7 @@ class TagController extends Controller
$em->flush();
}
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
return $this->redirect($redirectUrl);
}
@ -117,7 +120,7 @@ class TagController extends Controller
$pagerAdapter = new ArrayAdapter($entriesByTag);
$entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
$entries = $this->get(PreparePagerForEntries::class)->prepare($pagerAdapter);
try {
$entries->setCurrentPage($page);
@ -152,7 +155,7 @@ class TagController extends Controller
$form = $this->createForm(RenameTagType::class, new Tag());
$form->handleRequest($request);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
if ($form->isSubmitted() && $form->isValid()) {
$newTag = new Tag();
@ -173,7 +176,7 @@ class TagController extends Controller
$tag->getId()
);
foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$newTag->getLabel(),
[$newTag]
@ -210,7 +213,7 @@ class TagController extends Controller
$entries = $qb->getQuery()->getResult();
foreach ($entries as $entry) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$this->get(TagsAssigner::class)->assignTagsToEntry(
$entry,
$filter
);
@ -220,7 +223,7 @@ class TagController extends Controller
$em->flush();
return $this->redirect($this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true));
return $this->redirect($this->get(Redirect::class)->to($request->headers->get('referer'), '', true));
}
/**
@ -244,7 +247,7 @@ class TagController extends Controller
$em->flush();
}
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
$redirectUrl = $this->get(Redirect::class)->to($request->headers->get('referer'), '', true);
return $this->redirect($redirectUrl);
}

View file

@ -8,6 +8,7 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Helper\CryptoProxy;
use Wallabag\UserBundle\DataFixtures\UserFixtures;
class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface
@ -29,15 +30,15 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
{
$credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('.super.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('.super'));
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$manager->persist($credential);
$credential = new SiteCredential($this->getReference('admin-user'));
$credential->setHost('paywall.example.com');
$credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example'));
$credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($this->container->get(CryptoProxy::class)->crypt('paywall.example'));
$credential->setPassword($this->container->get(CryptoProxy::class)->crypt('bar'));
$manager->persist($credential);

View file

@ -72,38 +72,38 @@ services:
bd_guzzle_site_authenticator.site_config_builder:
alias: wallabag_core.guzzle_authenticator.config_builder
wallabag_core.http_client_factory:
Wallabag\CoreBundle\Helper\HttpClientFactory:
class: Wallabag\CoreBundle\Helper\HttpClientFactory
arguments:
- "@wallabag_core.guzzle.cookie_jar"
- '@Wallabag\CoreBundle\Helper\FileCookieJar'
- '@=service(''craue_config'').get(''restricted_access'')'
- '@logger'
calls:
- ["addSubscriber", ["@bd_guzzle_site_authenticator.authenticator_subscriber"]]
wallabag_core.guzzle.cookie_jar:
Wallabag\CoreBundle\Helper\FileCookieJar:
class: Wallabag\CoreBundle\Helper\FileCookieJar
arguments:
- "@logger"
- "%kernel.cache_dir%/cookiejar.json"
wallabag_core.content_proxy:
Wallabag\CoreBundle\Helper\ContentProxy:
class: Wallabag\CoreBundle\Helper\ContentProxy
arguments:
- '@Graby\Graby'
- "@wallabag_core.rule_based_tagger"
- "@wallabag_core.rule_based_ignore_origin_processor"
- '@Wallabag\CoreBundle\Helper\RuleBasedTagger'
- '@Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor'
- "@validator"
- "@logger"
- '%wallabag_core.fetching_error_message%'
- '@=service(''craue_config'').get(''store_article_headers'')'
wallabag_core.tags_assigner:
Wallabag\CoreBundle\Helper\TagsAssigner:
class: Wallabag\CoreBundle\Helper\TagsAssigner
arguments:
- "@wallabag_core.tag_repository"
wallabag_core.rule_based_tagger:
Wallabag\CoreBundle\Helper\RuleBasedTagger:
class: Wallabag\CoreBundle\Helper\RuleBasedTagger
arguments:
- "@rulerz"
@ -111,7 +111,7 @@ services:
- "@wallabag_core.entry_repository"
- "@logger"
wallabag_core.rule_based_ignore_origin_processor:
Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor:
class: Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor
arguments:
- "@rulerz"
@ -137,7 +137,7 @@ services:
arguments:
- WallabagCoreBundle:SiteCredential
calls:
- [ setCrypto, [ "@wallabag_core.helper.crypto_proxy" ] ]
- [ setCrypto, [ '@Wallabag\CoreBundle\Helper\CryptoProxy' ] ]
wallabag_core.ignore_origin_instance_rule_repository:
class: Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository
@ -145,7 +145,7 @@ services:
arguments:
- WallabagCoreBundle:IgnoreOriginInstanceRule
wallabag_core.helper.entries_export:
Wallabag\CoreBundle\Helper\EntriesExport:
class: Wallabag\CoreBundle\Helper\EntriesExport
arguments:
- "@translator"
@ -178,13 +178,13 @@ services:
tags:
- { name: rulerz.operator, target: native, operator: "~" }
wallabag_core.helper.redirect:
Wallabag\CoreBundle\Helper\Redirect:
class: Wallabag\CoreBundle\Helper\Redirect
arguments:
- "@router"
- "@security.token_storage"
wallabag_core.helper.prepare_pager_for_entries:
Wallabag\CoreBundle\Helper\PreparePagerForEntries:
class: Wallabag\CoreBundle\Helper\PreparePagerForEntries
arguments:
- "@security.token_storage"
@ -218,13 +218,13 @@ services:
class: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber
arguments:
- "@doctrine.orm.default_entity_manager"
- "@wallabag_core.entry.download_images"
- '@Wallabag\CoreBundle\Helper\DownloadImages'
- '@=service(''craue_config'').get(''download_images_enabled'')'
- "@logger"
tags:
- { name: kernel.event_subscriber }
wallabag_core.entry.download_images:
Wallabag\CoreBundle\Helper\DownloadImages:
class: Wallabag\CoreBundle\Helper\DownloadImages
arguments:
- "@wallabag_core.entry.download_images.client"
@ -235,7 +235,7 @@ services:
wallabag_core.entry.download_images.client:
alias: 'httplug.client.wallabag_core.entry.download_images'
wallabag_core.helper.crypto_proxy:
Wallabag\CoreBundle\Helper\CryptoProxy:
class: Wallabag\CoreBundle\Helper\CryptoProxy
arguments:
- "%wallabag_core.site_credentials.encryption_key_path%"

View file

@ -13,8 +13,8 @@ services:
class: Wallabag\ImportBundle\Import\PocketImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setClient, [ "@wallabag_import.pocket.client" ] ]
@ -26,8 +26,8 @@ services:
class: Wallabag\ImportBundle\Import\WallabagV1Import
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
- "%wallabag_core.fetching_error_message_title%"
- "%wallabag_core.fetching_error_message%"
@ -40,8 +40,8 @@ services:
class: Wallabag\ImportBundle\Import\WallabagV2Import
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -52,8 +52,8 @@ services:
class: Wallabag\ImportBundle\Import\ElcuratorImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -64,8 +64,8 @@ services:
class: Wallabag\ImportBundle\Import\ReadabilityImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -76,8 +76,8 @@ services:
class: Wallabag\ImportBundle\Import\InstapaperImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -88,8 +88,8 @@ services:
class: Wallabag\ImportBundle\Import\PinboardImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -100,8 +100,8 @@ services:
class: Wallabag\ImportBundle\Import\DeliciousImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -112,8 +112,8 @@ services:
class: Wallabag\ImportBundle\Import\FirefoxImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]
@ -124,8 +124,8 @@ services:
class: Wallabag\ImportBundle\Import\ChromeImport
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_core.content_proxy"
- "@wallabag_core.tags_assigner"
- '@Wallabag\CoreBundle\Helper\ContentProxy'
- '@Wallabag\CoreBundle\Helper\TagsAssigner'
- "@event_dispatcher"
calls:
- [ setLogger, [ "@logger" ]]

View file

@ -564,7 +564,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
$contentProxy->expects($this->any())
->method('updateEntry')
->willThrowException(new \Exception('Test Fetch content fails'));
$container->set('wallabag_core.content_proxy', $contentProxy);
$container->set(ContentProxy::class, $contentProxy);
try {
$this->client->request('POST', '/api/entries.json', [

View file

@ -9,6 +9,7 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\SiteCredential;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\ContentProxy;
use Wallabag\CoreBundle\Helper\CryptoProxy;
class EntryControllerTest extends WallabagCoreTestCase
{
@ -1553,8 +1554,8 @@ class EntryControllerTest extends WallabagCoreTestCase
$user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
$credential = new SiteCredential($user);
$credential->setHost('monde-diplomatique.fr');
$credential->setUsername($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('foo'));
$credential->setPassword($client->getContainer()->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
$credential->setUsername($client->getContainer()->get(CryptoProxy::class)->crypt('foo'));
$credential->setPassword($client->getContainer()->get(CryptoProxy::class)->crypt('bar'));
$em->persist($credential);
$em->flush();
@ -1621,7 +1622,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$cookie = $client->getCookieJar()->all();
$client = $this->getNewClient();
$client->getCookieJar()->set($cookie[0]);
$client->getContainer()->set('wallabag_core.content_proxy', $contentProxy);
$client->getContainer()->set(ContentProxy::class, $contentProxy);
$client->submit($form, $data);
$this->assertSame(302, $client->getResponse()->getStatusCode());