diff --git a/app/config/routing.yml b/app/config/routing.yml index d4defca02..86c6602e6 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -33,7 +33,7 @@ rest : homepage: path: "/{page}" defaults: - _controller: WallabagCoreBundle:Entry:showUnread + _controller: 'Wallabag\CoreBundle\Controller\EntryController::showUnreadAction' page : 1 requirements: page: \d+ @@ -47,7 +47,7 @@ fos_oauth_server_token: craue_config_settings_modify: path: /settings defaults: - _controller: CraueConfigBundle:Settings:modify + _controller: 'Craue\ConfigBundle\Controller\SettingsController::modifyAction' fos_js_routing: resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml" @@ -64,34 +64,34 @@ fos_js_routing: rss_to_atom_unread: path: /{username}/{token}/unread.xml defaults: - _controller: FrameworkBundle:Redirect:redirect + _controller: 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction' route: unread_feed permanent: true rss_to_atom_archive: path: /{username}/{token}/archive.xml defaults: - _controller: FrameworkBundle:Redirect:redirect + _controller: 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction' route: archive_feed permanent: true rss_to_atom_starred: path: /{username}/{token}/starred.xml defaults: - _controller: FrameworkBundle:Redirect:redirect + _controller: 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction' route: starred_feed permanent: true rss_to_atom_all: path: /{username}/{token}/all.xml defaults: - _controller: FrameworkBundle:Redirect:redirect + _controller: 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction' route: all_feed permanent: true rss_to_atom_tags: path: /{username}/{token}/tags/{slug}.xml defaults: - _controller: FrameworkBundle:Redirect:redirect + _controller: 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction' route: tag_feed permanent: true diff --git a/app/config/security.yml b/app/config/security.yml index 5e74e82fb..2a09648f3 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -9,7 +9,7 @@ security: providers: administrators: entity: - class: WallabagUserBundle:User + class: 'Wallabag\UserBundle\Entity\User' property: username fos_userbundle: id: fos_user.user_provider.username_email diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index c13e6d449..4fd3023a6 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -24,7 +24,7 @@ class WallabagAnnotationController extends AbstractFOSRestController { $annotationRows = $this ->getDoctrine() - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); $total = \count($annotationRows); $annotations = ['total' => $total, 'rows' => $annotationRows]; @@ -72,7 +72,7 @@ class WallabagAnnotationController extends AbstractFOSRestController * * @see Wallabag\ApiBundle\Controller\WallabagRestController * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ @@ -104,7 +104,7 @@ class WallabagAnnotationController extends AbstractFOSRestController * * @see Wallabag\ApiBundle\Controller\WallabagRestController * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ diff --git a/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml b/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml index 4f3a5c93b..ba076b9f4 100644 --- a/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml +++ b/src/Wallabag/AnnotationBundle/Resources/config/routing_annotations.yml @@ -1,4 +1,4 @@ annotations: type: rest - resource: "WallabagAnnotationBundle:WallabagAnnotation" - name_prefix: annotations_ + resource: 'Wallabag\AnnotationBundle\Controller\WallabagAnnotationController' + name_prefix: annotations_ diff --git a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php index 66693189a..58c942d40 100644 --- a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php +++ b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php @@ -26,7 +26,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:getAnnotations', [ + return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::getAnnotationsAction', [ 'entry' => $entry, ]); } @@ -48,7 +48,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:postAnnotation', [ + return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::postAnnotationAction', [ 'request' => $request, 'entry' => $entry, ]); @@ -63,7 +63,7 @@ class AnnotationRestController extends WallabagRestController * } * ) * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ @@ -71,7 +71,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:putAnnotation', [ + return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::putAnnotationAction', [ 'annotation' => $annotation, 'request' => $request, ]); @@ -86,7 +86,7 @@ class AnnotationRestController extends WallabagRestController * } * ) * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ @@ -94,7 +94,7 @@ class AnnotationRestController extends WallabagRestController { $this->validateAuthentication(); - return $this->forward('WallabagAnnotationBundle:WallabagAnnotation:deleteAnnotation', [ + return $this->forward('Wallabag\AnnotationBundle\Controller\WallabagAnnotationController::deleteAnnotationAction', [ 'annotation' => $annotation, ]); } diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index 3224d7893..6c0784e5f 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -19,7 +19,7 @@ class DeveloperController extends Controller */ public function indexAction() { - $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findByUser($this->getUser()->getId()); + $clients = $this->getDoctrine()->getRepository(Client::class)->findByUser($this->getUser()->getId()); return $this->render('@WallabagCore/themes/common/Developer/index.html.twig', [ 'clients' => $clients, diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index a4e475305..44c8412f8 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -44,7 +44,7 @@ class EntryRestController extends WallabagRestController public function getEntriesExistsAction(Request $request) { $this->validateAuthentication(); - $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); + $repo = $this->getDoctrine()->getRepository(Entry::class); $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); @@ -753,7 +753,7 @@ class EntryRestController extends WallabagRestController $label = trim($label); $tag = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findOneByLabel($label); if (false !== $tag) { diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php index f3498f55a..84f6a2975 100644 --- a/src/Wallabag/ApiBundle/Controller/TagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php @@ -22,7 +22,7 @@ class TagRestController extends WallabagRestController $this->validateAuthentication(); $tags = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findAllTags($this->getUser()->getId()); $json = $this->get('jms_serializer')->serialize($tags, 'json'); @@ -46,7 +46,7 @@ class TagRestController extends WallabagRestController $this->validateAuthentication(); $label = $request->get('tag', ''); - $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findByLabelsAndUser([$label], $this->getUser()->getId()); + $tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$label], $this->getUser()->getId()); if (empty($tags)) { throw $this->createNotFoundException('Tag not found'); @@ -55,7 +55,7 @@ class TagRestController extends WallabagRestController $tag = $tags[0]; $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->removeTag($this->getUser()->getId(), $tag); $this->cleanOrphanTag($tag); @@ -82,14 +82,14 @@ class TagRestController extends WallabagRestController $tagsLabels = $request->get('tags', ''); - $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId()); + $tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId()); if (empty($tags)) { throw $this->createNotFoundException('Tags not found'); } $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->removeTags($this->getUser()->getId(), $tags); $this->cleanOrphanTag($tags); @@ -114,14 +114,14 @@ class TagRestController extends WallabagRestController { $this->validateAuthentication(); - $tagFromDb = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId()); + $tagFromDb = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId()); if (empty($tagFromDb)) { throw $this->createNotFoundException('Tag not found'); } $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->removeTag($this->getUser()->getId(), $tag); $this->cleanOrphanTag($tag); diff --git a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml index 7785d25f2..de592c217 100644 --- a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml +++ b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml @@ -1,39 +1,39 @@ entry: type: rest - resource: "WallabagApiBundle:EntryRest" + resource: 'Wallabag\ApiBundle\Controller\EntryRestController' name_prefix: api_ search: type: rest - resource: "WallabagApiBundle:SearchRest" + resource: 'Wallabag\ApiBundle\Controller\SearchRestController' name_prefix: api_ tag: type: rest - resource: "WallabagApiBundle:TagRest" + resource: 'Wallabag\ApiBundle\Controller\TagRestController' name_prefix: api_ tagging_rule: type: rest - resource: "WallabagApiBundle:TaggingRuleRest" + resource: 'Wallabag\ApiBundle\Controller\TaggingRuleRestController' name_prefix: api_ annotation: type: rest - resource: "WallabagApiBundle:AnnotationRest" + resource: 'Wallabag\ApiBundle\Controller\AnnotationRestController' name_prefix: api_ misc: type: rest - resource: "WallabagApiBundle:WallabagRest" + resource: 'Wallabag\ApiBundle\Controller\WallabagRestController' name_prefix: api_ user: type: rest - resource: "WallabagApiBundle:UserRest" + resource: 'Wallabag\ApiBundle\Controller\UserRestController' name_prefix: api_ config: type: rest - resource: "WallabagApiBundle:ConfigRest" + resource: 'Wallabag\ApiBundle\Controller\ConfigRestController' name_prefix: api_ diff --git a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php index f870059bb..258b41f7c 100644 --- a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php +++ b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php @@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Helper\UrlHasher; use Wallabag\UserBundle\Entity\User; @@ -40,7 +41,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand return 1; } } else { - $users = $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findAll(); + $users = $this->getDoctrine()->getRepository(User::class)->findAll(); $output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users))); @@ -57,7 +58,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand private function generateHashedUrls(User $user) { $em = $this->getContainer()->get('doctrine.orm.entity_manager'); - $repo = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); + $repo = $this->getDoctrine()->getRepository(Entry::class); $entries = $repo->findByEmptyHashedUrlAndUserId($user->getId()); @@ -86,7 +87,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand */ private function getUser($username) { - return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username); + return $this->getDoctrine()->getRepository(User::class)->findOneByUserName($username); } private function getDoctrine() diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 8d08187a9..bdecf661d 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -277,8 +277,8 @@ class InstallCommand extends ContainerAwareCommand $em = $this->getContainer()->get('doctrine.orm.entity_manager'); // cleanup before insert new stuff - $em->createQuery('DELETE FROM WallabagCoreBundle:InternalSetting')->execute(); - $em->createQuery('DELETE FROM WallabagCoreBundle:IgnoreOriginInstanceRule')->execute(); + $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\InternalSetting')->execute(); + $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule')->execute(); foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) { $newSetting = new InternalSetting(); diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index f535df917..eb119f6bb 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint; +use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule; use Wallabag\CoreBundle\Entity\RuleInterface; @@ -132,7 +133,7 @@ class ConfigController extends Controller if ($request->query->has('tagging-rule')) { $taggingRule = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:TaggingRule') + ->getRepository(TaggingRule::class) ->find($request->query->get('tagging-rule')); if ($this->getUser()->getId() !== $taggingRule->getConfig()->getUser()->getId()) { @@ -195,7 +196,7 @@ class ConfigController extends Controller if ($request->query->has('ignore-origin-user-rule')) { $ignoreOriginUserRule = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:IgnoreOriginUserRule') + ->getRepository(IgnoreOriginUserRule::class) ->find($request->query->get('ignore-origin-user-rule')); if ($this->getUser()->getId() !== $ignoreOriginUserRule->getConfig()->getUser()->getId()) { @@ -548,7 +549,7 @@ class ConfigController extends Controller switch ($type) { case 'annotations': $this->getDoctrine() - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->removeAllByUserId($this->getUser()->getId()); break; case 'tags': @@ -558,7 +559,7 @@ class ConfigController extends Controller // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff // otherwise they won't be removed ... if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { - $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); + $this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId()); } // manually remove tags to avoid orphan tag @@ -735,7 +736,7 @@ class ConfigController extends Controller $em = $this->getDoctrine()->getManager(); $archivedEntriesAnnotations = $this->getDoctrine() - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findAllArchivedEntriesByUser($userId); foreach ($archivedEntriesAnnotations as $archivedEntriesAnnotation) { @@ -764,7 +765,7 @@ class ConfigController extends Controller private function getConfig() { $config = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Config') + ->getRepository(Config::class) ->findOneByUser($this->getUser()); // should NEVER HAPPEN ... diff --git a/src/Wallabag/CoreBundle/Controller/FeedController.php b/src/Wallabag/CoreBundle/Controller/FeedController.php index c24876695..ae68356fa 100644 --- a/src/Wallabag/CoreBundle/Controller/FeedController.php +++ b/src/Wallabag/CoreBundle/Controller/FeedController.php @@ -25,7 +25,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -41,7 +41,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -57,7 +57,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -73,7 +73,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/all/{page}", name="all_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @return \Symfony\Component\HttpFoundation\Response */ @@ -87,7 +87,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/tags/{slug}/{page}", name="tag_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * @ParamConverter("tag", options={"mapping": {"slug": "slug"}}) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 3de117da6..a3d912839 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -123,19 +123,19 @@ services: class: Wallabag\CoreBundle\Repository\EntryRepository factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - - WallabagCoreBundle:Entry + - 'Wallabag\CoreBundle\Entity\Entry' Wallabag\CoreBundle\Repository\TagRepository: class: Wallabag\CoreBundle\Repository\TagRepository factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - - WallabagCoreBundle:Tag + - 'Wallabag\CoreBundle\Entity\Tag' Wallabag\CoreBundle\Repository\SiteCredentialRepository: class: Wallabag\CoreBundle\Repository\SiteCredentialRepository factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - - WallabagCoreBundle:SiteCredential + - 'Wallabag\CoreBundle\Entity\SiteCredential' calls: - [ setCrypto, [ '@Wallabag\CoreBundle\Helper\CryptoProxy' ] ] @@ -143,7 +143,7 @@ services: class: Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - - WallabagCoreBundle:IgnoreOriginInstanceRule + - 'Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule' Wallabag\CoreBundle\Helper\EntriesExport: class: Wallabag\CoreBundle\Helper\EntriesExport diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index bad89a0e5..0ec0dec14 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -92,7 +92,7 @@ {% endfor %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/new.html.twig index 2664647e0..4e1942056 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/new.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/new.html.twig @@ -3,5 +3,5 @@ {% block title %}{{ 'entry.new.page_title'|trans }}{% endblock %} {% block content %} - {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} + {{ render(controller('Wallabag\\CoreBundle\\Controller\\EntryController::addEntryFormAction')) }} {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig index 945b3fe09..77fab331e 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig @@ -35,7 +35,7 @@
  • {{ 'menu.left.search'|trans }}
  • {% if craue_setting('restricted_access') %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index e9eea8694..bf48d2801 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig @@ -297,7 +297,7 @@ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig index 2664647e0..4e1942056 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig @@ -3,5 +3,5 @@ {% block title %}{{ 'entry.new.page_title'|trans }}{% endblock %} {% block content %} - {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} + {{ render(controller('Wallabag\\CoreBundle\\Controller\\EntryController::addEntryFormAction')) }} {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 50bd02dac..c0d41b665 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -154,8 +154,8 @@ - {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': current_route})) }} - {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} + {{ render(controller('Wallabag\\CoreBundle\\Controller\\EntryController::searchFormAction', {'currentRoute': current_route})) }} + {{ render(controller('Wallabag\\CoreBundle\\Controller\\EntryController::addEntryFormAction')) }} {% endblock %} diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index 7de8dace8..a5d92dd3f 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -17,6 +17,7 @@ use Wallabag\ImportBundle\Import\PinboardImport; use Wallabag\ImportBundle\Import\ReadabilityImport; use Wallabag\ImportBundle\Import\WallabagV1Import; use Wallabag\ImportBundle\Import\WallabagV2Import; +use Wallabag\UserBundle\Entity\User; class ImportCommand extends ContainerAwareCommand { @@ -47,9 +48,9 @@ class ImportCommand extends ContainerAwareCommand $em->getConnection()->getConfiguration()->setSQLLogger(null); if ($input->getOption('useUserId')) { - $entityUser = $em->getRepository('WallabagUserBundle:User')->findOneById($input->getArgument('username')); + $entityUser = $em->getRepository(User::class)->findOneById($input->getArgument('username')); } else { - $entityUser = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username')); + $entityUser = $em->getRepository(User::class)->findOneByUsername($input->getArgument('username')); } if (!\is_object($entityUser)) { diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index ea7afd3dd..3d3979af7 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -108,7 +108,7 @@ abstract class BrowserImport extends AbstractImport $url = \array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/DeliciousImport.php b/src/Wallabag/ImportBundle/Import/DeliciousImport.php index fa287cce4..9c991748f 100644 --- a/src/Wallabag/ImportBundle/Import/DeliciousImport.php +++ b/src/Wallabag/ImportBundle/Import/DeliciousImport.php @@ -98,7 +98,7 @@ class DeliciousImport extends AbstractImport public function parseEntry(array $importedEntry) { $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($importedEntry['url'], $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index f7bee9ef0..fbab4f3ad 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -126,7 +126,7 @@ class InstapaperImport extends AbstractImport public function parseEntry(array $importedEntry) { $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($importedEntry['url'], $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php index 202eb1b3e..a8b7ced44 100644 --- a/src/Wallabag/ImportBundle/Import/PinboardImport.php +++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php @@ -98,7 +98,7 @@ class PinboardImport extends AbstractImport public function parseEntry(array $importedEntry) { $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($importedEntry['href'], $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 469a8f16c..03103a193 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -179,7 +179,7 @@ class PocketImport extends AbstractImport $url = isset($importedEntry['resolved_url']) && '' !== $importedEntry['resolved_url'] ? $importedEntry['resolved_url'] : $importedEntry['given_url']; $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index c5abf1892..2b0829f77 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -98,7 +98,7 @@ class ReadabilityImport extends AbstractImport public function parseEntry(array $importedEntry) { $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($importedEntry['article__url'], $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index 75a28fbf5..7a03b9377 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php @@ -104,7 +104,7 @@ abstract class WallabagImport extends AbstractImport public function parseEntry(array $importedEntry) { $existingEntry = $this->em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($importedEntry['url'], $this->user->getId()); if (false !== $existingEntry) { diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index ee26c84de..6903a5fd4 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig @@ -3,7 +3,7 @@ {% block title %}{{ 'import.page_title'|trans }}{% endblock %} {% block messages %} - {{ render(controller("WallabagImportBundle:Import:checkQueue")) }} + {{ render(controller('Wallabag\\ImportBundle\\Controller\\ImportController::checkQueueAction')) }} {{ parent() }} {% endblock %} diff --git a/src/Wallabag/UserBundle/Controller/ManageController.php b/src/Wallabag/UserBundle/Controller/ManageController.php index ecc646a81..983c24562 100644 --- a/src/Wallabag/UserBundle/Controller/ManageController.php +++ b/src/Wallabag/UserBundle/Controller/ManageController.php @@ -139,7 +139,7 @@ class ManageController extends Controller public function searchFormAction(Request $request, $page = 1) { $em = $this->getDoctrine()->getManager(); - $qb = $em->getRepository('WallabagUserBundle:User')->createQueryBuilder('u'); + $qb = $em->getRepository(User::class)->createQueryBuilder('u'); $form = $this->createForm(SearchUserType::class); $form->handleRequest($request); @@ -147,7 +147,7 @@ class ManageController extends Controller if ($form->isSubmitted() && $form->isValid()) { $searchTerm = (isset($request->get('search_user')['term']) ? $request->get('search_user')['term'] : ''); - $qb = $em->getRepository('WallabagUserBundle:User')->getQueryBuilderForSearch($searchTerm); + $qb = $em->getRepository(User::class)->getQueryBuilderForSearch($searchTerm); } $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index 22417ee47..5ec400a85 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -27,7 +27,7 @@ services: class: Wallabag\UserBundle\Repository\UserRepository factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - - WallabagUserBundle:User + - 'Wallabag\UserBundle\Entity\User' Wallabag\UserBundle\EventListener\CreateConfigListener: class: Wallabag\UserBundle\EventListener\CreateConfigListener diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 260edd770..22074790e 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\AnnotationBundle\Controller; use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase; use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\UserBundle\Entity\User; class AnnotationControllerTest extends WallabagAnnotationTestCase { @@ -31,10 +32,10 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $annotation = new Annotation($user); @@ -57,7 +58,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->assertSame($annotation->getText(), $content['rows'][0]['text']); // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager - $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId()); + $annotation = $em->getRepository(Annotation::class)->findAnnotationById($annotation->getId()); $em->remove($annotation); $em->flush(); } @@ -77,7 +78,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Entry $entry */ $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $headers = ['CONTENT_TYPE' => 'application/json']; @@ -101,7 +102,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Annotation $annotation */ $annotation = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findLastAnnotationByPageId($entry->getId(), 1); $this->assertSame('my annotation', $annotation->getText()); @@ -113,7 +114,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Entry $entry */ $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $headers = ['CONTENT_TYPE' => 'application/json']; @@ -142,7 +143,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Entry $entry */ $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $headers = ['CONTENT_TYPE' => 'application/json']; @@ -177,7 +178,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Entry $entry */ $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $longQuote = str_repeat('a', 10001); @@ -204,10 +205,10 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $annotation = new Annotation($user); @@ -234,7 +235,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase /** @var Annotation $annotationUpdated */ $annotationUpdated = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findOneById($annotation->getId()); $this->assertSame('a modified annotation', $annotationUpdated->getText()); @@ -252,10 +253,10 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $annotation = new Annotation($user); @@ -282,7 +283,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->assertSame('This is my annotation /o/', $content['text']); $annotationDeleted = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findOneById($annotation->getId()); $this->assertNull($annotationDeleted); diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index fecd616d3..e2a17498a 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -12,7 +12,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); - $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $nbClients = $em->getRepository(Client::class)->findAll(); $crawler = $client->request('GET', '/developer/client/create'); $this->assertSame(200, $client->getResponse()->getStatusCode()); @@ -27,7 +27,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertSame(200, $client->getResponse()->getStatusCode()); - $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $newNbClients = $em->getRepository(Client::class)->findAll(); $this->assertGreaterThan(\count($nbClients), \count($newNbClients)); $this->assertGreaterThan(1, $alert = $crawler->filter('.settings table strong')->extract(['_text'])); @@ -75,7 +75,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->logInAs('admin'); $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); - $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $nbClients = $em->getRepository(Client::class)->findAll(); $crawler = $client->request('GET', '/developer'); $this->assertSame(200, $client->getResponse()->getStatusCode()); @@ -120,7 +120,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertNull( - $em->getRepository('WallabagApiBundle:Client')->find($adminApiClient->getId()), + $em->getRepository(Client::class)->find($adminApiClient->getId()), 'The client should have been removed' ); } diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index ed90324f3..3eb4caffc 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -14,7 +14,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]); if (!$entry) { @@ -40,7 +40,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'url' => 'http://0.0.0.0/entry2']); if (!$entry) { @@ -59,7 +59,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]); if (!$entry) { @@ -107,7 +107,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId('bob'), 'isArchived' => false]); if (!$entry) { @@ -205,7 +205,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -581,7 +581,7 @@ class EntryRestControllerTest extends WallabagApiTestCase // Remove the created entry to avoid side effects on other tests if (isset($content['id'])) { $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); - $entry = $em->getReference('WallabagCoreBundle:Entry', $content['id']); + $entry = $em->getReference(Entry::class, $content['id']); $em->remove($entry); $em->flush(); } @@ -655,7 +655,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -697,7 +697,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -731,7 +731,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -762,7 +762,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -794,7 +794,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -816,7 +816,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneWithTags($this->user->getId()); $entry = $entry[0]; @@ -839,7 +839,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUser($this->getUserId()); if (!$entry) { @@ -861,7 +861,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $entryDB = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $tagsInDB = []; @@ -878,7 +878,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneWithTags($this->user->getId()); $entry = $entry[0]; @@ -904,7 +904,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]); if (!$entry) { @@ -926,7 +926,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]); if (!$entry) { @@ -948,7 +948,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]); if (!$entry) { @@ -974,7 +974,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $now = new \DateTime(); $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]); if (!$entry) { @@ -1135,7 +1135,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testReloadEntryErrorWhileFetching() { $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); if (!$entry) { @@ -1171,7 +1171,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntriesTagsListAction() { $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); $tags = $entry->getTags(); @@ -1195,7 +1195,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertSame('http://0.0.0.0/entry4', $content[0]['url']); $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); $tags = $entry->getTags(); @@ -1235,7 +1235,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list)); $this->assertSame(200, $this->client->getResponse()->getStatusCode()); - $entry = $em->getRepository('WallabagCoreBundle:Entry')->find($entry->getId()); + $entry = $em->getRepository(Entry::class)->find($entry->getId()); $this->assertCount(0, $entry->getTags()); } diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php index 9daa94cd5..034cb1143 100644 --- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php @@ -3,6 +3,7 @@ namespace Tests\Wallabag\ApiBundle\Controller; use Tests\Wallabag\ApiBundle\WallabagApiTestCase; +use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; class TagRestControllerTest extends WallabagApiTestCase @@ -35,7 +36,7 @@ class TagRestControllerTest extends WallabagApiTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneWithTags($this->user->getId()); $entry = $entry[0]; @@ -61,12 +62,12 @@ class TagRestControllerTest extends WallabagApiTestCase $this->assertSame($tag->getLabel(), $content['label']); $this->assertSame($tag->getSlug(), $content['slug']); - $entries = $em->getRepository('WallabagCoreBundle:Entry') + $entries = $em->getRepository(Entry::class) ->findAllByTagId($this->user->getId(), $tag->getId()); $this->assertCount(0, $entries); - $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($tagLabel); + $tag = $em->getRepository(Tag::class)->findOneByLabel($tagLabel); $this->assertNull($tag, $tagLabel . ' was removed because it begun an orphan tag'); } @@ -74,7 +75,7 @@ class TagRestControllerTest extends WallabagApiTestCase public function testDeleteOtherUserTag() { $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); - $tag = $em->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($this->otherUserTagLabel); + $tag = $em->getRepository(Tag::class)->findOneByLabel($this->otherUserTagLabel); $this->client->request('DELETE', '/api/tags/' . $tag->getId() . '.json'); @@ -97,7 +98,7 @@ class TagRestControllerTest extends WallabagApiTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneWithTags($this->user->getId()); $entry = $entry[0]; @@ -127,7 +128,7 @@ class TagRestControllerTest extends WallabagApiTestCase $entries = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findAllByTagId($this->user->getId(), $tag->getId()); $this->assertCount(0, $entries); @@ -155,7 +156,7 @@ class TagRestControllerTest extends WallabagApiTestCase $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneWithTags($this->user->getId()); $entry = $entry[0]; @@ -196,14 +197,14 @@ class TagRestControllerTest extends WallabagApiTestCase $entries = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findAllByTagId($this->user->getId(), $tag->getId()); $this->assertCount(0, $entries); $entries = $this->client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findAllByTagId($this->user->getId(), $tag2->getId()); $this->assertCount(0, $entries); diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index 49f5bcdc7..a27a11d48 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php @@ -4,6 +4,7 @@ namespace Tests\Wallabag\ApiBundle; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Cookie; +use Wallabag\UserBundle\Entity\User; abstract class WallabagApiTestCase extends WebTestCase { @@ -63,7 +64,7 @@ abstract class WallabagApiTestCase extends WebTestCase return $this->client ->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName($username) ->getId(); } diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php index ab0d3f879..06c84ac07 100644 --- a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php @@ -7,6 +7,7 @@ use Symfony\Component\Console\Tester\CommandTester; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\CoreBundle\Command\CleanDuplicatesCommand; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\UserBundle\Entity\User; class CleanDuplicatesCommandTest extends WallabagCoreTestCase { @@ -66,10 +67,10 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase $this->logInAs('admin'); - $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); + $nbEntries = $em->getRepository(Entry::class)->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertCount(0, $nbEntries); - $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId()); + $user = $em->getRepository(User::class)->findOneById($this->getLoggedInUserId()); $entry1 = new Entry($user); $entry1->setUrl($url); @@ -82,7 +83,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase $em->flush(); - $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); + $nbEntries = $em->getRepository(Entry::class)->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertCount(2, $nbEntries); $application = new Application($this->getClient()->getKernel()); @@ -98,7 +99,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase $this->assertStringContainsString('Cleaned 1 duplicates for user admin', $tester->getDisplay()); - $nbEntries = $em->getRepository('WallabagCoreBundle:Entry')->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); + $nbEntries = $em->getRepository(Entry::class)->findAllByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertCount(1, $nbEntries); $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url'); diff --git a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php index 5870a037f..34f6b3afd 100644 --- a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php @@ -7,6 +7,7 @@ use Symfony\Component\Console\Tester\CommandTester; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\CoreBundle\Command\GenerateUrlHashesCommand; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\UserBundle\Entity\User; class GenerateUrlHashesCommandTest extends WallabagCoreTestCase { @@ -66,7 +67,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase $this->logInAs('admin'); - $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId()); + $user = $em->getRepository(User::class)->findOneById($this->getLoggedInUserId()); $entry1 = new Entry($user); $entry1->setUrl($url); @@ -87,7 +88,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase $this->assertStringContainsString('Generated hashed urls for user: admin', $tester->getDisplay()); - $entry = $em->getRepository('WallabagCoreBundle:Entry')->findOneByUrl($url); + $entry = $em->getRepository(Entry::class)->findOneByUrl($url); $this->assertSame($entry->getHashedUrl(), hash('sha1', $url)); diff --git a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php index 5cdb825d2..247537000 100644 --- a/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ShowUserCommandTest.php @@ -70,7 +70,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase $this->logInAs('admin'); /** @var User $user */ - $user = $em->getRepository('WallabagUserBundle:User')->findOneById($this->getLoggedInUserId()); + $user = $em->getRepository(User::class)->findOneById($this->getLoggedInUserId()); $user->setName('Bug boss'); $em->persist($user); diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index acd8d58e7..d37e8cfd6 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -7,7 +7,9 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule; use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\CoreBundle\Entity\TaggingRule; use Wallabag\UserBundle\Entity\User; class ConfigControllerTest extends WallabagCoreTestCase @@ -306,7 +308,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // reset the token $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); if (!$user) { @@ -570,7 +572,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $rule = $client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:TaggingRule') + ->getRepository(TaggingRule::class) ->findAll()[0]; $crawler = $client->request('GET', '/tagging-rule/delete/' . $rule->getId()); @@ -586,7 +588,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $rule = $client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:TaggingRule') + ->getRepository(TaggingRule::class) ->findAll()[0]; $crawler = $client->request('GET', '/tagging-rule/edit/' . $rule->getId()); @@ -707,7 +709,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $rule = $client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:IgnoreOriginUserRule') + ->getRepository(IgnoreOriginUserRule::class) ->findAll()[0]; $crawler = $client->request('GET', '/ignore-origin-user-rule/edit/' . $rule->getId()); @@ -723,7 +725,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $rule = $client->getContainer()->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:IgnoreOriginUserRule') + ->getRepository(IgnoreOriginUserRule::class) ->findAll()[0]; $crawler = $client->request('GET', '/ignore-origin-user-rule/edit/' . $rule->getId()); @@ -776,13 +778,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('empty'); $user->setEnabled(false); $em->persist($user); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('bob'); $user->setEnabled(false); $em->persist($user); @@ -798,13 +800,13 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(403, $client->getResponse()->getStatusCode()); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('empty'); $user->setEnabled(true); $em->persist($user); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('bob'); $user->setEnabled(true); $em->persist($user); @@ -867,7 +869,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->createQueryBuilder('u') ->where('u.username = :username')->setParameter('username', 'wallace') ->getQuery() @@ -878,7 +880,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $entries = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUser($loggedInUserId); $this->assertEmpty($entries); @@ -931,7 +933,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $annotationsReset = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findAnnotationsByPageId($entry->getId(), $user->getId()); $this->assertEmpty($annotationsReset, 'Annotations were reset'); @@ -947,7 +949,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $tagReset = $em - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->countAllTags($user->getId()); $this->assertSame(0, $tagReset, 'Tags were reset'); @@ -963,7 +965,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->countAllEntriesByUser($user->getId()); $this->assertSame(0, $entryReset, 'Entries were reset'); @@ -1027,19 +1029,19 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->countAllEntriesByUser($user->getId()); $this->assertSame(1, $entryReset, 'Entries were reset'); $tagReset = $em - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->countAllTags($user->getId()); $this->assertSame(1, $tagReset, 'Tags were reset'); $annotationsReset = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findAnnotationsByPageId($annotationArchived->getId(), $user->getId()); $this->assertEmpty($annotationsReset, 'Annotations were reset'); @@ -1084,19 +1086,19 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); $entryReset = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->countAllEntriesByUser($user->getId()); $this->assertSame(0, $entryReset, 'Entries were reset'); $tagReset = $em - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->countAllTags($user->getId()); $this->assertSame(0, $tagReset, 'Tags were reset'); $annotationsReset = $em - ->getRepository('WallabagAnnotationBundle:Annotation') + ->getRepository(Annotation::class) ->findAnnotationsByPageId($entry->getId(), $user->getId()); $this->assertEmpty($annotationsReset, 'Annotations were reset'); @@ -1174,7 +1176,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // restore user $em = $this->getEntityManager(); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertTrue($user->isEmailTwoFactor()); @@ -1201,7 +1203,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // restore user $em = $this->getEntityManager(); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertFalse($user->isEmailTwoFactor()); @@ -1219,7 +1221,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // restore user $em = $this->getEntityManager(); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertTrue($user->isGoogleTwoFactor()); @@ -1243,7 +1245,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // restore user $em = $this->getEntityManager(); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertTrue($user->isGoogleTwoFactor()); @@ -1254,7 +1256,7 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertSame(302, $client->getResponse()->getStatusCode()); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertFalse($user->isGoogleTwoFactor()); @@ -1278,7 +1280,7 @@ class ConfigControllerTest extends WallabagCoreTestCase // restore user $em = $this->getEntityManager(); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $this->assertEmpty($user->getGoogleAuthenticatorSecret()); diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 650161806..28f3a2dc5 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -10,6 +10,7 @@ use Wallabag\CoreBundle\Entity\SiteCredential; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\ContentProxy; use Wallabag\CoreBundle\Helper\CryptoProxy; +use Wallabag\UserBundle\Entity\User; class EntryControllerTest extends WallabagCoreTestCase { @@ -115,7 +116,7 @@ class EntryControllerTest extends WallabagCoreTestCase $em = $client->getContainer() ->get('doctrine.orm.entity_manager'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); $em->remove($entry); $em->flush(); @@ -165,7 +166,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); $author = $content->getPublishedBy(); @@ -202,7 +203,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); $tags = $content->getTagsLabel(); @@ -239,7 +240,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); @@ -379,7 +380,7 @@ class EntryControllerTest extends WallabagCoreTestCase $em = $client->getContainer() ->get('doctrine.orm.entity_manager'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUrl($url); $tags = $entry->getTagsLabel(); @@ -408,7 +409,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('/', $client->getResponse()->getTargetUrl()); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUrl($url); $tags = $entry->getTagsLabel(); @@ -511,7 +512,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertSame(302, $client->getResponse()->getStatusCode()); $entry = $this->getEntityManager() - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $this->assertNotEmpty($entry->getContent()); @@ -535,7 +536,7 @@ class EntryControllerTest extends WallabagCoreTestCase // otherwise, retrieve the same entity will retrieve change from the previous request :0 $this->getEntityManager()->clear(); $newContent = $this->getEntityManager() - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $this->assertNotSame($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); @@ -645,7 +646,7 @@ class EntryControllerTest extends WallabagCoreTestCase $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $this->assertSame(1, $res->isArchived()); @@ -668,7 +669,7 @@ class EntryControllerTest extends WallabagCoreTestCase $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneById($entry->getId()); $this->assertSame(1, $res->isStarred()); @@ -710,7 +711,7 @@ class EntryControllerTest extends WallabagCoreTestCase // add a new content to be removed later $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $content = new Entry($user); @@ -743,7 +744,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('bob'); $client->request('GET', '/view/' . $content->getId()); @@ -949,7 +950,7 @@ class EntryControllerTest extends WallabagCoreTestCase $em = $this->getClient()->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $annotation = new Annotation($user); @@ -1210,7 +1211,7 @@ class EntryControllerTest extends WallabagCoreTestCase ->get('doctrine.orm.entity_manager'); $entry = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); @@ -1250,7 +1251,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $client->request('GET', '/delete/' . $content->getId()); @@ -1529,7 +1530,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); @@ -1580,7 +1581,7 @@ class EntryControllerTest extends WallabagCoreTestCase $this->assertStringContainsString('flashes.entry.notice.entry_saved', $crawler->filter('body')->extract(['_text'])[0]); $content = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); @@ -1629,7 +1630,7 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId($url, $this->getLoggedInUserId()); $authors = $content->getPublishedBy(); @@ -1643,7 +1644,7 @@ class EntryControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); - $entry = $em->getRepository('WallabagCoreBundle:Entry')->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); + $entry = $em->getRepository(Entry::class)->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); $tag = $entry->getTags()[0]; $crawler = $client->request('GET', '/view/' . $entry->getId()); @@ -1720,14 +1721,14 @@ class EntryControllerTest extends WallabagCoreTestCase $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry1->getId()); $this->assertSame(1, $res->isArchived()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry2->getId()); $this->assertSame(1, $res->isArchived()); @@ -1742,14 +1743,14 @@ class EntryControllerTest extends WallabagCoreTestCase $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry1->getId()); $this->assertSame(1, $res->isStarred()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry2->getId()); $this->assertSame(1, $res->isStarred()); @@ -1765,21 +1766,21 @@ class EntryControllerTest extends WallabagCoreTestCase $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry1->getId()); $this->assertContains('foo', $res->getTagsLabel()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry2->getId()); $this->assertContains('foo', $res->getTagsLabel()); $res = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry3->getId()); $this->assertNotContains('foo', $res->getTagsLabel()); diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index 41b995efa..ad688ba41 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -50,7 +50,7 @@ class ExportControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); $client->request('GET', '/export/' . $content->getId() . '.doc'); @@ -91,7 +91,7 @@ class ExportControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findOneByUsernameAndNotArchived('admin'); ob_start(); @@ -159,7 +159,7 @@ class ExportControllerTest extends WallabagCoreTestCase // to be sure results are the same $contentInDB = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->createQueryBuilder('e') ->select('e, t') ->leftJoin('e.user', 'u') @@ -205,7 +205,7 @@ class ExportControllerTest extends WallabagCoreTestCase $contentInDB = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId()); ob_start(); @@ -279,7 +279,7 @@ class ExportControllerTest extends WallabagCoreTestCase // to be sure results are the same $contentInDB = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('u.username = :username')->setParameter('username', 'admin') diff --git a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php index e35a636e3..77fd4dce3 100644 --- a/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php @@ -3,6 +3,8 @@ namespace Tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\UserBundle\Entity\User; class FeedControllerTest extends WallabagCoreTestCase { @@ -91,7 +93,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -112,7 +114,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -134,7 +136,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -156,7 +158,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -178,7 +180,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -206,7 +208,7 @@ class FeedControllerTest extends WallabagCoreTestCase $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $config = $user->getConfig(); @@ -215,12 +217,12 @@ class FeedControllerTest extends WallabagCoreTestCase $em->persist($config); $entry1 = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find(1) ; $entry4 = $em - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find(4) ; diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php index 9730dce9d..db9c9f235 100644 --- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php @@ -3,6 +3,7 @@ namespace Tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\UserBundle\Entity\User; class SecurityControllerTest extends WallabagCoreTestCase { @@ -40,7 +41,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $user->setEmailTwoFactor(true); $em->persist($user); @@ -52,7 +53,7 @@ class SecurityControllerTest extends WallabagCoreTestCase // restore user $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $user->setEmailTwoFactor(false); $em->persist($user); @@ -73,7 +74,7 @@ class SecurityControllerTest extends WallabagCoreTestCase $em = $client->getContainer()->get('doctrine.orm.entity_manager'); $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $user->setGoogleAuthenticatorSecret('26LDIHYGHNELOQEM'); $em->persist($user); @@ -85,7 +86,7 @@ class SecurityControllerTest extends WallabagCoreTestCase // restore user $user = $em - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUsername('admin'); $user->setGoogleAuthenticatorSecret(null); $em->persist($user); diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index 843d638c9..a651ce0eb 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\UserBundle\Entity\User; /** * @group Tag @@ -77,7 +78,7 @@ class TagControllerTest extends WallabagCoreTestCase $entry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId()); $crawler = $client->request('GET', '/view/' . $entry->getId()); @@ -93,7 +94,7 @@ class TagControllerTest extends WallabagCoreTestCase $newEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $tags = $newEntry->getTags()->toArray(); @@ -138,7 +139,7 @@ class TagControllerTest extends WallabagCoreTestCase $tag = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findOneByLabel($this->tagName); $this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag'); @@ -170,23 +171,23 @@ class TagControllerTest extends WallabagCoreTestCase $tag = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findOneByLabel($this->tagName); $this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag'); $user = $this->getEntityManager() - ->getRepository('WallabagUserBundle:User') + ->getRepository(User::class) ->findOneByUserName('admin'); $entry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/foo', $user->getId()); $entry2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/bar', $user->getId()); $this->assertEmpty($entry->getTagsLabel()); @@ -205,7 +206,7 @@ class TagControllerTest extends WallabagCoreTestCase $entry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getLoggedInUserId()); $tag->addEntry($entry); @@ -216,7 +217,7 @@ class TagControllerTest extends WallabagCoreTestCase $tag = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findOneByEntryAndTagLabel($entry, $this->tagName); $crawler = $client->request('GET', '/tag/list/' . $tag->getSlug()); @@ -269,12 +270,12 @@ class TagControllerTest extends WallabagCoreTestCase $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $freshEntry2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry2->getId()); $tags = []; @@ -293,7 +294,7 @@ class TagControllerTest extends WallabagCoreTestCase $newTag = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($newTagLabel); $this->assertCount(1, $newTag, 'New tag exists.'); @@ -333,7 +334,7 @@ class TagControllerTest extends WallabagCoreTestCase $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $tags = []; @@ -347,7 +348,7 @@ class TagControllerTest extends WallabagCoreTestCase $newTag = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($tagLabel); $this->assertCount(1, $newTag); @@ -388,7 +389,7 @@ class TagControllerTest extends WallabagCoreTestCase $freshEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $tags = []; @@ -402,12 +403,12 @@ class TagControllerTest extends WallabagCoreTestCase $tagFromRepo = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($tagLabel); $newTagFromRepo = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($newTagLabel); $this->assertCount(0, $newTagFromRepo); @@ -458,22 +459,22 @@ class TagControllerTest extends WallabagCoreTestCase $freshEntry1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry1->getId()); $freshEntry2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry2->getId()); $tagFromRepo = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($tagLabel); $previousTagFromRepo = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Tag') + ->getRepository(Tag::class) ->findByLabel($previousTagLabel); $this->assertCount(1, $tagFromRepo); @@ -516,7 +517,7 @@ class TagControllerTest extends WallabagCoreTestCase $newEntry = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->find($entry->getId()); $tags = $newEntry->getTags()->toArray(); @@ -549,7 +550,7 @@ class TagControllerTest extends WallabagCoreTestCase $entries = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->getBuilderForSearchByUser($this->getLoggedInUserId(), 'title', 'unread') ->getQuery()->getResult(); diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php index af009b8a1..f6533714d 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php @@ -104,7 +104,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getClassMetadata') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($meta); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -117,10 +117,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); + $params = new ParamConverter(['class' => User::class]); $converter = new UsernameFeedTokenConverter($registry); $this->assertTrue($converter->supports($params)); @@ -156,7 +156,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getRepository') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($repo); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -165,10 +165,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); + $params = new ParamConverter(['class' => User::class]); $converter = new UsernameFeedTokenConverter($registry); $request = new Request([], [], ['username' => 'test', 'token' => 'test']); @@ -194,7 +194,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getRepository') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($repo); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -203,10 +203,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']); + $params = new ParamConverter(['class' => User::class, 'name' => 'user']); $converter = new UsernameFeedTokenConverter($registry); $request = new Request([], [], ['username' => 'test', 'token' => 'test']); diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php index b1c2c3254..3594de447 100644 --- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class ChromeControllerTest extends WallabagCoreTestCase { @@ -113,7 +114,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.20minutes.fr/sport/3256363-20220321-tournoi-vi-nations-trophee-gagne-xv-france-fini-fond-seine', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php b/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php index 54ca9199f..c5cd9579a 100644 --- a/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class DeliciousControllerTest extends WallabagCoreTestCase { @@ -110,7 +111,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://feross.org/spoofmac/', $this->getLoggedInUserId() @@ -152,7 +153,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase $content1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://stackoverflow.com/review/', $this->getLoggedInUserId() @@ -162,7 +163,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase $content2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://addyosmani.com/basket.js/', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php index ed702a245..83e8e0bbf 100644 --- a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class ElcuratorControllerTest extends WallabagCoreTestCase { @@ -114,7 +115,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://devblog.lexik.fr/git/qualite-de-code-integration-de-php-git-hooks-dans-symfony2-2842', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index c3c9bf964..144deee2e 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class FirefoxControllerTest extends WallabagCoreTestCase { @@ -113,7 +114,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html', $this->getLoggedInUserId() @@ -127,7 +128,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index f7739bc85..68394afb8 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class InstapaperControllerTest extends WallabagCoreTestCase { @@ -113,7 +114,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.liberation.fr/societe/police-justice/cours-dassises-on-efface-le-peuple-dun-processus-judiciaire-dont-il-est-pourtant-le-coeur-battant-20210414_FYUNIZENHRGHZLAZEKSMKZYEPI/', $this->getLoggedInUserId() @@ -130,7 +131,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe', $this->getLoggedInUserId() @@ -165,7 +166,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $content1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://redditblog.com/2016/09/20/amp-and-reactredux/', $this->getLoggedInUserId() @@ -175,7 +176,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $content2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php index ca2289d50..3c1784e9b 100644 --- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class PinboardControllerTest extends WallabagCoreTestCase { @@ -110,7 +111,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://ma.ttias.be/varnish-explained/', $this->getLoggedInUserId() @@ -157,7 +158,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $content1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://ilia.ws/files/nginx_torontophpug.pdf', $this->getLoggedInUserId() @@ -168,7 +169,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $content2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://developers.google.com/web/updates/2016/07/infinite-scroller', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php index 8c4689490..17df1b890 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class ReadabilityControllerTest extends WallabagCoreTestCase { @@ -110,7 +111,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.20minutes.fr/bordeaux/2120479-20170823-bordeaux-poche-chocolatine-association-traduit-etudiants-etrangers-mots-sud-ouest', $this->getLoggedInUserId() @@ -155,7 +156,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $content1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://blog.travis-ci.com/2016-07-28-what-we-learned-from-analyzing-2-million-travis-builds/', $this->getLoggedInUserId() @@ -166,7 +167,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $content2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://facebook.github.io/graphql/October2016/', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index eee358a18..6c6969c93 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class WallabagV1ControllerTest extends WallabagCoreTestCase { @@ -111,7 +112,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'http://www.framablog.org/index.php/post/2014/02/05/Framabag-service-libre-gratuit-interview-developpeur', $this->getLoggedInUserId() @@ -156,7 +157,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $content1 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'http://gilbert.pellegrom.me/recreating-the-square-slider', $this->getLoggedInUserId() @@ -167,7 +168,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $content2 = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.wallabag.org/features/', $this->getLoggedInUserId() diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index b36879732..731602963 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Entry; class WallabagV2ControllerTest extends WallabagCoreTestCase { @@ -114,7 +115,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867', $this->getLoggedInUserId() @@ -133,7 +134,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $content = $client->getContainer() ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagCoreBundle:Entry') + ->getRepository(Entry::class) ->findByUrlAndUserId( 'https://www.mediapart.fr/', $this->getLoggedInUserId()