mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-27 01:50:29 +00:00
Merge pull request #5952 from yguedidi/import-used-classes
This commit is contained in:
commit
e422921fab
77 changed files with 480 additions and 342 deletions
|
@ -3,7 +3,9 @@
|
|||
namespace Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
@ -17,7 +19,7 @@ class DeveloperController extends Controller
|
|||
*
|
||||
* @Route("/developer", name="developer")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
|
@ -33,7 +35,7 @@ class DeveloperController extends Controller
|
|||
*
|
||||
* @Route("/developer/client/create", name="developer_create_client")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function createClientAction(Request $request)
|
||||
{
|
||||
|
@ -69,7 +71,7 @@ class DeveloperController extends Controller
|
|||
*
|
||||
* @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteClientAction(Client $client)
|
||||
{
|
||||
|
@ -94,7 +96,7 @@ class DeveloperController extends Controller
|
|||
*
|
||||
* @Route("/developer/howto/first-app", name="developer_howto_firstapp")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function howtoFirstAppAction()
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Wallabag\ApiBundle\Controller;
|
|||
use Hateoas\Configuration\Route;
|
||||
use Hateoas\Representation\Factory\PagerfantaFactory;
|
||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -139,7 +140,7 @@ class EntryRestController extends WallabagRestController
|
|||
$detail = strtolower($request->query->get('detail', 'full'));
|
||||
|
||||
try {
|
||||
/** @var \Pagerfanta\Pagerfanta $pager */
|
||||
/** @var Pagerfanta $pager */
|
||||
$pager = $this->get(EntryRepository::class)->findEntries(
|
||||
$this->getUser()->getId(),
|
||||
$isArchived,
|
||||
|
|
|
@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ApiBundle\Entity\Client;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Form\NewUserType;
|
||||
|
||||
class UserRestController extends WallabagRestController
|
||||
{
|
||||
|
@ -63,7 +64,7 @@ class UserRestController extends WallabagRestController
|
|||
// user will be disabled BY DEFAULT to avoid spamming account to be enabled
|
||||
$user->setEnabled(false);
|
||||
|
||||
$form = $this->createForm('Wallabag\UserBundle\Form\NewUserType', $user, [
|
||||
$form = $this->createForm(NewUserType::class, $user, [
|
||||
'csrf_protection' => false,
|
||||
]);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\ApiBundle\Entity\Client;
|
||||
|
||||
class ClientType extends AbstractType
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ class ClientType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\ApiBundle\Entity\Client',
|
||||
'data_class' => Client::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
|
|||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return \Wallabag\UserBundle\Entity\User
|
||||
* @return User
|
||||
*/
|
||||
private function getUser($username)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Exception\DriverException;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use FOS\UserBundle\Event\UserEvent;
|
||||
|
@ -384,7 +385,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
try {
|
||||
return \in_array($databaseName, $schemaManager->listDatabases(), true);
|
||||
} catch (\Doctrine\DBAL\Exception\DriverException $e) {
|
||||
} catch (DriverException $e) {
|
||||
// it means we weren't able to get database list, assume the database doesn't exist
|
||||
|
||||
return false;
|
||||
|
|
|
@ -65,7 +65,7 @@ class ShowUserCommand extends ContainerAwareCommand
|
|||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return \Wallabag\UserBundle\Entity\User
|
||||
* @return User
|
||||
*/
|
||||
private function getUser($username)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Repository\UserRepository;
|
||||
|
||||
class TagAllCommand extends ContainerAwareCommand
|
||||
|
@ -62,7 +63,7 @@ class TagAllCommand extends ContainerAwareCommand
|
|||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return \Wallabag\UserBundle\Entity\User
|
||||
* @return User
|
||||
*/
|
||||
private function getUser($username)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use FOS\UserBundle\Model\UserManagerInterface;
|
||||
use JMS\Serializer\SerializationContext;
|
||||
|
@ -565,7 +566,7 @@ class ConfigController extends Controller
|
|||
case 'entries':
|
||||
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
|
||||
// otherwise they won't be removed ...
|
||||
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
|
||||
$this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId());
|
||||
}
|
||||
|
||||
|
@ -575,7 +576,7 @@ class ConfigController extends Controller
|
|||
$this->get(EntryRepository::class)->removeAllByUserId($this->getUser()->getId());
|
||||
break;
|
||||
case 'archived':
|
||||
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
|
||||
$this->removeAnnotationsForArchivedByUserId($this->getUser()->getId());
|
||||
}
|
||||
|
||||
|
@ -601,7 +602,7 @@ class ConfigController extends Controller
|
|||
*
|
||||
* @throws AccessDeniedHttpException
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteAccountAction(Request $request)
|
||||
{
|
||||
|
@ -629,7 +630,7 @@ class ConfigController extends Controller
|
|||
*
|
||||
* @Route("/config/view-mode", name="switch_view_mode")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function changeViewModeAction(Request $request)
|
||||
{
|
||||
|
@ -650,7 +651,7 @@ class ConfigController extends Controller
|
|||
*
|
||||
* @Route("/locale/{language}", name="changeLocale")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function setLocaleAction(Request $request, $language = null)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,9 @@ use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
|||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
@ -34,7 +36,7 @@ class EntryController extends Controller
|
|||
/**
|
||||
* @Route("/mass", name="mass_action")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function massAction(Request $request)
|
||||
{
|
||||
|
@ -121,7 +123,7 @@ class EntryController extends Controller
|
|||
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
|
||||
* because this controller is also called inside the layout template without any page as argument
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function searchFormAction(Request $request, $page = 1, $currentRoute = null)
|
||||
{
|
||||
|
@ -147,7 +149,7 @@ class EntryController extends Controller
|
|||
/**
|
||||
* @Route("/new-entry", name="new_entry")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function addEntryFormAction(Request $request)
|
||||
{
|
||||
|
@ -189,7 +191,7 @@ class EntryController extends Controller
|
|||
/**
|
||||
* @Route("/bookmarklet", name="bookmarklet")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function addEntryViaBookmarkletAction(Request $request)
|
||||
{
|
||||
|
@ -213,7 +215,7 @@ class EntryController extends Controller
|
|||
/**
|
||||
* @Route("/new", name="new")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function addEntryAction()
|
||||
{
|
||||
|
@ -225,7 +227,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/edit/{id}", requirements={"id" = "\d+"}, name="edit")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function editEntryAction(Request $request, Entry $entry)
|
||||
{
|
||||
|
@ -260,7 +262,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/all/list/{page}", name="all", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showAllAction(Request $request, $page)
|
||||
{
|
||||
|
@ -274,7 +276,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/unread/list/{page}", name="unread", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showUnreadAction(Request $request, $page)
|
||||
{
|
||||
|
@ -293,7 +295,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/archive/list/{page}", name="archive", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showArchiveAction(Request $request, $page)
|
||||
{
|
||||
|
@ -307,7 +309,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/starred/list/{page}", name="starred", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showStarredAction(Request $request, $page)
|
||||
{
|
||||
|
@ -321,7 +323,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showUntaggedEntriesAction(Request $request, $page)
|
||||
{
|
||||
|
@ -335,7 +337,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/annotated/list/{page}", name="annotated", defaults={"page" = "1"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showWithAnnotationsEntriesAction(Request $request, $page)
|
||||
{
|
||||
|
@ -349,7 +351,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|annotated|all"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function redirectRandomEntryAction($type = 'all')
|
||||
{
|
||||
|
@ -372,7 +374,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function viewAction(Entry $entry)
|
||||
{
|
||||
|
@ -390,7 +392,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/reload/{id}", requirements={"id" = "\d+"}, name="reload_entry")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function reloadAction(Entry $entry)
|
||||
{
|
||||
|
@ -422,7 +424,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function toggleArchiveAction(Request $request, Entry $entry)
|
||||
{
|
||||
|
@ -451,7 +453,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function toggleStarAction(Request $request, Entry $entry)
|
||||
{
|
||||
|
@ -481,7 +483,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteEntryAction(Request $request, Entry $entry)
|
||||
{
|
||||
|
@ -521,7 +523,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/share/{id}", requirements={"id" = "\d+"}, name="share")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function shareAction(Entry $entry)
|
||||
{
|
||||
|
@ -545,7 +547,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/share/delete/{id}", requirements={"id" = "\d+"}, name="delete_share")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function deleteShareAction(Entry $entry)
|
||||
{
|
||||
|
@ -568,7 +570,7 @@ class EntryController extends Controller
|
|||
* @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry")
|
||||
* @Cache(maxage="25200", smaxage="25200", public=true)
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function shareEntryAction(Entry $entry)
|
||||
{
|
||||
|
@ -589,7 +591,7 @@ class EntryController extends Controller
|
|||
*
|
||||
* @Route("/domain/{id}/{page}", requirements={"id" = ".+"}, defaults={"page" = 1}, name="same_domain")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function getSameDomainEntries(Request $request, $page = 1)
|
||||
{
|
||||
|
@ -603,7 +605,7 @@ class EntryController extends Controller
|
|||
* @param string $type Entries type: unread, starred or archive
|
||||
* @param int $page
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
private function showEntries($type, Request $request, $page)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Controller;
|
|||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
@ -27,7 +28,7 @@ class ExportController extends Controller
|
|||
* "id": "\d+"
|
||||
* })
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function downloadEntryAction(Entry $entry, $format)
|
||||
{
|
||||
|
@ -53,7 +54,7 @@ class ExportController extends Controller
|
|||
* "category": "all|unread|starred|archive|tag_entries|untagged|search|annotated|same_domain"
|
||||
* })
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function downloadEntriesAction(Request $request, $format, $category)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ class FeedController extends Controller
|
|||
*
|
||||
* @param $page
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showUnreadFeedAction(User $user, $page)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ class FeedController extends Controller
|
|||
*
|
||||
* @param $page
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showArchiveFeedAction(User $user, $page)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ class FeedController extends Controller
|
|||
*
|
||||
* @param $page
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showStarredFeedAction(User $user, $page)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ class FeedController extends Controller
|
|||
*
|
||||
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showAllFeedAction(User $user, $page)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ class FeedController extends Controller
|
|||
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showTagsFeedAction(Request $request, User $user, Tag $tag, $page)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ class FeedController extends Controller
|
|||
* @param string $type Entries type: unread, starred or archive
|
||||
* @param int $page
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
private function showEntries($type, User $user, $page = 1)
|
||||
{
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
||||
use Wallabag\CoreBundle\Form\Type\IgnoreOriginInstanceRuleType;
|
||||
use Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository;
|
||||
|
||||
/**
|
||||
|
@ -36,13 +40,13 @@ class IgnoreOriginInstanceRuleController extends Controller
|
|||
*
|
||||
* @Route("/new", name="ignore_origin_instance_rules_new", methods={"GET", "POST"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$ignoreOriginInstanceRule = new IgnoreOriginInstanceRule();
|
||||
|
||||
$form = $this->createForm('Wallabag\CoreBundle\Form\Type\IgnoreOriginInstanceRuleType', $ignoreOriginInstanceRule);
|
||||
$form = $this->createForm(IgnoreOriginInstanceRuleType::class, $ignoreOriginInstanceRule);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
@ -69,12 +73,12 @@ class IgnoreOriginInstanceRuleController extends Controller
|
|||
*
|
||||
* @Route("/{id}/edit", name="ignore_origin_instance_rules_edit", methods={"GET", "POST"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function editAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
|
||||
{
|
||||
$deleteForm = $this->createDeleteForm($ignoreOriginInstanceRule);
|
||||
$editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\IgnoreOriginInstanceRuleType', $ignoreOriginInstanceRule);
|
||||
$editForm = $this->createForm(IgnoreOriginInstanceRuleType::class, $ignoreOriginInstanceRule);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
|
@ -102,7 +106,7 @@ class IgnoreOriginInstanceRuleController extends Controller
|
|||
*
|
||||
* @Route("/{id}", name="ignore_origin_instance_rules_delete", methods={"DELETE"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
|
||||
{
|
||||
|
@ -128,7 +132,7 @@ class IgnoreOriginInstanceRuleController extends Controller
|
|||
*
|
||||
* @param IgnoreOriginInstanceRule $ignoreOriginInstanceRule The ignore origin instance rule entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
* @return Form The form
|
||||
*/
|
||||
private function createDeleteForm(IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
|
||||
{
|
||||
|
|
|
@ -4,11 +4,15 @@ namespace Wallabag\CoreBundle\Controller;
|
|||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Entity\SiteCredential;
|
||||
use Wallabag\CoreBundle\Form\Type\SiteCredentialType;
|
||||
use Wallabag\CoreBundle\Helper\CryptoProxy;
|
||||
use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -41,7 +45,7 @@ class SiteCredentialController extends Controller
|
|||
*
|
||||
* @Route("/new", name="site_credentials_new", methods={"GET", "POST"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
|
@ -49,7 +53,7 @@ class SiteCredentialController extends Controller
|
|||
|
||||
$credential = new SiteCredential($this->getUser());
|
||||
|
||||
$form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
|
||||
$form = $this->createForm(SiteCredentialType::class, $credential);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
@ -79,7 +83,7 @@ class SiteCredentialController extends Controller
|
|||
*
|
||||
* @Route("/{id}/edit", name="site_credentials_edit", methods={"GET", "POST"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function editAction(Request $request, SiteCredential $siteCredential)
|
||||
{
|
||||
|
@ -88,7 +92,7 @@ class SiteCredentialController extends Controller
|
|||
$this->checkUserAction($siteCredential);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($siteCredential);
|
||||
$editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential);
|
||||
$editForm = $this->createForm(SiteCredentialType::class, $siteCredential);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
|
@ -119,7 +123,7 @@ class SiteCredentialController extends Controller
|
|||
*
|
||||
* @Route("/{id}", name="site_credentials_delete", methods={"DELETE"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteAction(Request $request, SiteCredential $siteCredential)
|
||||
{
|
||||
|
@ -159,7 +163,7 @@ class SiteCredentialController extends Controller
|
|||
*
|
||||
* @param SiteCredential $siteCredential The site credential entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
* @return Form The form
|
||||
*/
|
||||
private function createDeleteForm(SiteCredential $siteCredential)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ use Pagerfanta\Exception\OutOfRangeCurrentPageException;
|
|||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
@ -25,7 +26,7 @@ class TagController extends Controller
|
|||
/**
|
||||
* @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function addTagFormAction(Request $request, Entry $entry)
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ class TagController extends Controller
|
|||
*
|
||||
* @Route("/remove-tag/{entry}/{tag}", requirements={"entry" = "\d+", "tag" = "\d+"}, name="remove_tag")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
|
||||
{
|
||||
|
@ -85,7 +86,7 @@ class TagController extends Controller
|
|||
*
|
||||
* @Route("/tag/list", name="tag")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showTagAction()
|
||||
{
|
||||
|
@ -112,7 +113,7 @@ class TagController extends Controller
|
|||
* @Route("/tag/list/{slug}/{page}", name="tag_entries", defaults={"page" = "1"})
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function showEntriesForTagAction(Tag $tag, $page, Request $request)
|
||||
{
|
||||
|
@ -151,7 +152,7 @@ class TagController extends Controller
|
|||
* @Route("/tag/rename/{slug}", name="tag_rename")
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function renameTagAction(Tag $tag, Request $request)
|
||||
{
|
||||
|
@ -203,7 +204,7 @@ class TagController extends Controller
|
|||
*
|
||||
* @Route("/tag/search/{filter}", name="tag_this_search")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function tagThisSearchAction($filter, Request $request)
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ class TagController extends Controller
|
|||
* @Route("/tag/delete/{slug}", name="tag_delete")
|
||||
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function removeTagAction(Tag $tag, Request $request)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Event\Subscriber;
|
|||
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
|
@ -40,7 +41,7 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
|
|||
public function preRemove(LifecycleEventArgs $args)
|
||||
{
|
||||
$entity = $args->getEntity();
|
||||
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform
|
||||
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof SqlitePlatform
|
||||
|| !$entity instanceof Entry) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class ChangePasswordType extends AbstractType
|
||||
{
|
||||
|
@ -26,11 +27,11 @@ class ChangePasswordType extends AbstractType
|
|||
'first_options' => ['label' => 'config.form_password.new_password_label'],
|
||||
'second_options' => ['label' => 'config.form_password.repeat_new_password_label'],
|
||||
'constraints' => [
|
||||
new Constraints\Length([
|
||||
new Length([
|
||||
'min' => 8,
|
||||
'minMessage' => 'validator.password_too_short',
|
||||
]),
|
||||
new Constraints\NotBlank(),
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => 'config.form_password.new_password_label',
|
||||
])
|
||||
|
|
|
@ -77,7 +77,7 @@ class ConfigType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Config',
|
||||
'data_class' => Config::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
class EditEntryType extends AbstractType
|
||||
{
|
||||
|
@ -39,7 +40,7 @@ class EditEntryType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
|
||||
'data_class' => Entry::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
|
||||
class FeedType extends AbstractType
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ class FeedType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Config',
|
||||
'data_class' => Config::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
||||
|
||||
class IgnoreOriginInstanceRuleType extends AbstractType
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ class IgnoreOriginInstanceRuleType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule',
|
||||
'data_class' => IgnoreOriginInstanceRule::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule;
|
||||
|
||||
class IgnoreOriginUserRuleType extends AbstractType
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ class IgnoreOriginUserRuleType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\IgnoreOriginUserRule',
|
||||
'data_class' => IgnoreOriginUserRule::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
class NewEntryType extends AbstractType
|
||||
{
|
||||
|
@ -23,7 +24,7 @@ class NewEntryType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
|
||||
'data_class' => Entry::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
||||
class NewTagType extends AbstractType
|
||||
{
|
||||
|
@ -28,7 +29,7 @@ class NewTagType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Tag',
|
||||
'data_class' => Tag::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
||||
class RenameTagType extends AbstractType
|
||||
{
|
||||
|
@ -24,7 +25,7 @@ class RenameTagType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Tag',
|
||||
'data_class' => Tag::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\SiteCredential;
|
||||
|
||||
class SiteCredentialType extends AbstractType
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ class SiteCredentialType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\SiteCredential',
|
||||
'data_class' => SiteCredential::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\TaggingRule;
|
||||
use Wallabag\CoreBundle\Form\DataTransformer\StringToListTransformer;
|
||||
|
||||
class TaggingRuleType extends AbstractType
|
||||
|
@ -35,7 +36,7 @@ class TaggingRuleType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\TaggingRule',
|
||||
'data_class' => TaggingRule::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Wallabag\CoreBundle\Form\Type;
|
||||
|
||||
use FOS\UserBundle\Form\Type\RegistrationFormType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
|
@ -9,6 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class UserInformationType extends AbstractType
|
||||
{
|
||||
|
@ -40,13 +42,13 @@ class UserInformationType extends AbstractType
|
|||
|
||||
public function getParent()
|
||||
{
|
||||
return 'FOS\UserBundle\Form\Type\RegistrationFormType';
|
||||
return RegistrationFormType::class;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\UserBundle\Entity\User',
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class DownloadImages
|
|||
switch ($ext) {
|
||||
case 'gif':
|
||||
// use Imagick if available to keep GIF animation
|
||||
if (class_exists('\\Imagick')) {
|
||||
if (class_exists(\Imagick::class)) {
|
||||
try {
|
||||
$imagick = new \Imagick();
|
||||
$imagick->readImageBlob($res->getBody());
|
||||
|
|
|
@ -18,7 +18,7 @@ class HttpClientFactory implements ClientFactory
|
|||
/** @var [\GuzzleHttp\Event\SubscriberInterface] */
|
||||
private $subscribers = [];
|
||||
|
||||
/** @var \GuzzleHttp\Cookie\CookieJar */
|
||||
/** @var CookieJar */
|
||||
private $cookieJar;
|
||||
|
||||
private $restrictedAccess;
|
||||
|
|
|
@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||
|
||||
abstract class BrowserController extends Controller
|
||||
{
|
||||
|
@ -76,7 +77,7 @@ abstract class BrowserController extends Controller
|
|||
/**
|
||||
* Return the service to handle the import.
|
||||
*
|
||||
* @return \Wallabag\ImportBundle\Import\ImportInterface
|
||||
* @return ImportInterface
|
||||
*/
|
||||
abstract protected function getImportService();
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class PocketController extends Controller
|
|||
/**
|
||||
* Return Pocket Import Service with or without RabbitMQ enabled.
|
||||
*
|
||||
* @return \Wallabag\ImportBundle\Import\PocketImport
|
||||
* @return PocketImport
|
||||
*/
|
||||
private function getPocketImportService()
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\ImportBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||
|
||||
/**
|
||||
* Define Wallabag import for v1 and v2, since there are very similar.
|
||||
|
@ -80,7 +81,7 @@ abstract class WallabagController extends Controller
|
|||
/**
|
||||
* Return the service to handle the import.
|
||||
*
|
||||
* @return \Wallabag\ImportBundle\Import\ImportInterface
|
||||
* @return ImportInterface
|
||||
*/
|
||||
abstract protected function getImportService();
|
||||
|
||||
|
|
|
@ -11,12 +11,16 @@ use Pagerfanta\Pagerfanta;
|
|||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Form\NewUserType;
|
||||
use Wallabag\UserBundle\Form\SearchUserType;
|
||||
use Wallabag\UserBundle\Form\UserType;
|
||||
|
||||
/**
|
||||
* User controller.
|
||||
|
@ -36,7 +40,7 @@ class ManageController extends Controller
|
|||
// enable created user by default
|
||||
$user->setEnabled(true);
|
||||
|
||||
$form = $this->createForm('Wallabag\UserBundle\Form\NewUserType', $user);
|
||||
$form = $this->createForm(NewUserType::class, $user);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
@ -70,7 +74,7 @@ class ManageController extends Controller
|
|||
$userManager = $this->container->get(UserManagerInterface::class);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($user);
|
||||
$form = $this->createForm('Wallabag\UserBundle\Form\UserType', $user);
|
||||
$form = $this->createForm(UserType::class, $user);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// `googleTwoFactor` isn't a field within the User entity, we need to define it's value in a different way
|
||||
|
@ -139,7 +143,7 @@ class ManageController extends Controller
|
|||
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
|
||||
* because this controller is also called inside the layout template without any page as argument
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function searchFormAction(Request $request, $page = 1)
|
||||
{
|
||||
|
@ -178,7 +182,7 @@ class ManageController extends Controller
|
|||
*
|
||||
* @param User $user The User entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
* @return Form The form
|
||||
*/
|
||||
private function createDeleteForm(User $user)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,9 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class NewUserType extends AbstractType
|
||||
{
|
||||
|
@ -27,11 +29,11 @@ class NewUserType extends AbstractType
|
|||
'first_options' => ['label' => 'user.form.password_label'],
|
||||
'second_options' => ['label' => 'user.form.repeat_new_password_label'],
|
||||
'constraints' => [
|
||||
new Constraints\Length([
|
||||
new Length([
|
||||
'min' => 8,
|
||||
'minMessage' => 'validator.password_too_short',
|
||||
]),
|
||||
new Constraints\NotBlank(),
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => 'user.form.plain_password_label',
|
||||
])
|
||||
|
@ -47,7 +49,7 @@ class NewUserType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\UserBundle\Entity\User',
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class UserType extends AbstractType
|
||||
{
|
||||
|
@ -49,7 +50,7 @@ class UserType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Wallabag\UserBundle\Entity\User',
|
||||
'data_class' => User::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\AnnotationBundle;
|
||||
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
@ -10,12 +12,12 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
|||
abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @var Client
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* @var \FOS\UserBundle\Model\UserInterface
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
|
@ -37,7 +39,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @return Client
|
||||
*/
|
||||
protected function createAuthorizedClient()
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
@ -556,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testPostEntryWhenFetchContentFails()
|
||||
{
|
||||
/** @var \Symfony\Component\DependencyInjection\Container $container */
|
||||
/** @var Container $container */
|
||||
$container = $this->client->getContainer();
|
||||
$contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
namespace Tests\Wallabag\ApiBundle;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
@ -12,12 +14,12 @@ use Wallabag\UserBundle\Entity\User;
|
|||
abstract class WallabagApiTestCase extends WebTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @var Client
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* @var \FOS\UserBundle\Model\UserInterface
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
|
@ -27,7 +29,7 @@ abstract class WallabagApiTestCase extends WebTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Bundle\FrameworkBundle\Client
|
||||
* @return Client
|
||||
*/
|
||||
protected function createAuthorizedClient()
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\ExportCommand;
|
||||
|
@ -11,7 +12,7 @@ class ExportCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
public function testExportCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
|
|
@ -6,6 +6,7 @@ use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
|
|||
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
@ -35,7 +36,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
/** @var \Doctrine\DBAL\Connection $connection */
|
||||
/** @var Connection $connection */
|
||||
$connection = $this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection();
|
||||
if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
|
||||
/*
|
||||
|
@ -143,7 +144,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
// skipped SQLite check when database is removed because while testing for the connection,
|
||||
// the driver will create the file (so the database) before testing if database exist
|
||||
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
|
||||
$this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Tests\Wallabag\CoreBundle\Command;
|
|||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\ShowUserCommand;
|
||||
|
@ -13,7 +14,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
public function testRunShowUserCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Command\TagAllCommand;
|
||||
|
@ -11,7 +12,7 @@ class TagAllCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
public function testRunTagAllCommandWithoutUsername()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
|
|
@ -174,7 +174,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$author = $content->getPublishedBy();
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertSame($this->url, $content->getUrl());
|
||||
$this->assertStringContainsString('la cryptomonnaie de Facebook', $content->getTitle());
|
||||
$this->assertSame('fr', $content->getLanguage());
|
||||
|
@ -246,7 +246,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$authors = $content->getPublishedBy();
|
||||
$this->assertSame('2017-04-05', $content->getPublishedAt()->format('Y-m-d'));
|
||||
$this->assertSame('fr', $content->getLanguage());
|
||||
|
@ -1217,7 +1217,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
|
||||
$this->assertInstanceOf(Entry::class, $entry);
|
||||
$this->assertSame($url, $entry->getUrl());
|
||||
$this->assertStringContainsString('Judo', $entry->getTitle());
|
||||
// instead of checking for the filename (which might change) check that the image is now local
|
||||
|
@ -1536,7 +1536,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertSame($url, $content->getUrl());
|
||||
$this->assertSame($expectedLanguage, $content->getLanguage());
|
||||
}
|
||||
|
@ -1587,7 +1587,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertSame('Quand Manille manœuvre', $content->getTitle());
|
||||
|
||||
$client->getContainer()->get(Config::class)->set('restricted_access', 0);
|
||||
|
|
|
@ -78,7 +78,7 @@ class LocaleListenerTest extends TestCase
|
|||
|
||||
private function getEvent(Request $request)
|
||||
{
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
|
||||
$kernel = $this->getMockBuilder(HttpKernelInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -3,31 +3,36 @@
|
|||
namespace Tests\Wallabag\CoreBundle\Event\Subscriber;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Platforms\MySqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class TablePrefixSubscriberTest extends TestCase
|
||||
{
|
||||
public function dataForPrefix()
|
||||
{
|
||||
return [
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['wallabag_', User::class, '`user`', 'user', 'wallabag_user', '"wallabag_user"', new PostgreSqlPlatform()],
|
||||
['wallabag_', User::class, '`user`', 'user', 'wallabag_user', '`wallabag_user`', new MySqlPlatform()],
|
||||
['wallabag_', User::class, '`user`', 'user', 'wallabag_user', '"wallabag_user"', new SqlitePlatform()],
|
||||
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['wallabag_', User::class, 'user', 'user', 'wallabag_user', 'wallabag_user', new PostgreSqlPlatform()],
|
||||
['wallabag_', User::class, 'user', 'user', 'wallabag_user', 'wallabag_user', new MySqlPlatform()],
|
||||
['wallabag_', User::class, 'user', 'user', 'wallabag_user', 'wallabag_user', new SqlitePlatform()],
|
||||
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['', User::class, '`user`', 'user', 'user', '"user"', new PostgreSqlPlatform()],
|
||||
['', User::class, '`user`', 'user', 'user', '`user`', new MySqlPlatform()],
|
||||
['', User::class, '`user`', 'user', 'user', '"user"', new SqlitePlatform()],
|
||||
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
|
||||
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
|
||||
['', User::class, 'user', 'user', 'user', 'user', new PostgreSqlPlatform()],
|
||||
['', User::class, 'user', 'user', 'user', 'user', new MySqlPlatform()],
|
||||
['', User::class, 'user', 'user', 'user', 'user', new SqlitePlatform()],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -36,7 +41,7 @@ class TablePrefixSubscriberTest extends TestCase
|
|||
*/
|
||||
public function testPrefix($prefix, $entityName, $tableName, $tableNameExpected, $finalTableName, $finalTableNameQuoted, $platform)
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -60,7 +65,7 @@ class TablePrefixSubscriberTest extends TestCase
|
|||
*/
|
||||
public function testSubscribedEvents($prefix, $entityName, $tableName, $tableNameExpected, $finalTableName, $finalTableNameQuoted, $platform)
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -82,7 +87,7 @@ class TablePrefixSubscriberTest extends TestCase
|
|||
|
||||
public function testPrefixManyToMany()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -110,6 +115,6 @@ class TablePrefixSubscriberTest extends TestCase
|
|||
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName());
|
||||
$this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']);
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform()));
|
||||
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new MySqlPlatform()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator;
|
||||
|
||||
use Graby\SiteConfig\ConfigBuilder;
|
||||
use Graby\SiteConfig\SiteConfig as GrabySiteConfig;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
|
@ -10,6 +11,7 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
|||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder;
|
||||
use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
||||
{
|
||||
|
@ -17,7 +19,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
|
||||
public function testBuildConfigExists()
|
||||
{
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder('Graby\SiteConfig\ConfigBuilder')
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder(ConfigBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -38,7 +40,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
$handler = new TestHandler();
|
||||
$logger->pushHandler($handler);
|
||||
|
||||
$siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
|
||||
$siteCrentialRepo = $this->getMockBuilder(SiteCredentialRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$siteCrentialRepo->expects($this->once())
|
||||
|
@ -46,7 +48,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
->with(['api.example.com', '.example.com'], 1)
|
||||
->willReturn(['username' => 'foo', 'password' => 'bar']);
|
||||
|
||||
$user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$user->expects($this->once())
|
||||
|
@ -84,7 +86,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
|
||||
public function testBuildConfigDoesntExist()
|
||||
{
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder('\Graby\SiteConfig\ConfigBuilder')
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder(ConfigBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -97,7 +99,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
$handler = new TestHandler();
|
||||
$logger->pushHandler($handler);
|
||||
|
||||
$siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
|
||||
$siteCrentialRepo = $this->getMockBuilder(SiteCredentialRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$siteCrentialRepo->expects($this->once())
|
||||
|
@ -105,7 +107,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
->with(['unknown.com', '.com'], 1)
|
||||
->willReturn(null);
|
||||
|
||||
$user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$user->expects($this->once())
|
||||
|
@ -135,7 +137,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
|
||||
public function testBuildConfigWithBadExtraFields()
|
||||
{
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder('Graby\SiteConfig\ConfigBuilder')
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder(ConfigBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -156,7 +158,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
$handler = new TestHandler();
|
||||
$logger->pushHandler($handler);
|
||||
|
||||
$siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
|
||||
$siteCrentialRepo = $this->getMockBuilder(SiteCredentialRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$siteCrentialRepo->expects($this->once())
|
||||
|
@ -164,7 +166,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
->with(['example.com', '.com'], 1)
|
||||
->willReturn(['username' => 'foo', 'password' => 'bar']);
|
||||
|
||||
$user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$user->expects($this->once())
|
||||
|
@ -202,7 +204,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
|
||||
public function testBuildConfigUserNotDefined()
|
||||
{
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder('\Graby\SiteConfig\ConfigBuilder')
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder(ConfigBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -215,7 +217,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
$handler = new TestHandler();
|
||||
$logger->pushHandler($handler);
|
||||
|
||||
$siteCrentialRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\SiteCredentialRepository')
|
||||
$siteCrentialRepo = $this->getMockBuilder(SiteCredentialRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -265,7 +267,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
*/
|
||||
public function testBuildConfigWithDbAccess($host, $expectedUsername = null, $expectedPassword = null)
|
||||
{
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder('Graby\SiteConfig\ConfigBuilder')
|
||||
$grabyConfigBuilderMock = $this->getMockBuilder(ConfigBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -282,7 +284,7 @@ class GrabySiteConfigBuilderTest extends WallabagCoreTestCase
|
|||
->with($host)
|
||||
->willReturn($grabySiteConfig);
|
||||
|
||||
$user = $this->getMockBuilder('Wallabag\UserBundle\Entity\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$user->expects($this->once())
|
||||
|
|
|
@ -28,7 +28,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -67,7 +67,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -106,7 +106,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -150,7 +150,7 @@ class ContentProxyTest extends TestCase
|
|||
$ruleBasedIgnoreOriginProcessor->expects($this->once())
|
||||
->method('process');
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -195,7 +195,7 @@ class ContentProxyTest extends TestCase
|
|||
$ruleBasedIgnoreOriginProcessor->expects($this->once())
|
||||
->method('process');
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -240,7 +240,7 @@ class ContentProxyTest extends TestCase
|
|||
$ruleBasedIgnoreOriginProcessor->expects($this->once())
|
||||
->method('process');
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -284,7 +284,7 @@ class ContentProxyTest extends TestCase
|
|||
$ruleBasedIgnoreOriginProcessor->expects($this->once())
|
||||
->method('process');
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -333,7 +333,7 @@ class ContentProxyTest extends TestCase
|
|||
->method('validate')
|
||||
->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')]));
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -383,7 +383,7 @@ class ContentProxyTest extends TestCase
|
|||
new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'url', 'https://')])
|
||||
));
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -635,7 +635,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -678,7 +678,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -717,7 +717,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -755,7 +755,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -793,7 +793,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -831,7 +831,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -870,7 +870,7 @@ class ContentProxyTest extends TestCase
|
|||
|
||||
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
|
||||
|
||||
$graby = $this->getMockBuilder('Graby\Graby')
|
||||
$graby = $this->getMockBuilder(Graby::class)
|
||||
->setMethods(['fetchContent'])
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Wallabag\CoreBundle\Helper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
|
@ -22,7 +23,7 @@ class RedirectTest extends TestCase
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->routerMock = $this->getMockBuilder('Symfony\Component\Routing\Router')
|
||||
$this->routerMock = $this->getMockBuilder(Router::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@ namespace Tests\Wallabag\CoreBundle\Helper;
|
|||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RulerZ\RulerZ;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule;
|
||||
use Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor;
|
||||
use Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class RuleBasedIgnoreOriginProcessorTest extends TestCase
|
||||
|
@ -193,14 +195,14 @@ class RuleBasedIgnoreOriginProcessorTest extends TestCase
|
|||
|
||||
private function getRulerZMock()
|
||||
{
|
||||
return $this->getMockBuilder('RulerZ\RulerZ')
|
||||
return $this->getMockBuilder(RulerZ::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
||||
private function getIgnoreOriginInstanceRuleRepositoryMock()
|
||||
{
|
||||
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository')
|
||||
return $this->getMockBuilder(IgnoreOriginInstanceRuleRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
|
|
@ -2,14 +2,19 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Helper;
|
||||
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RulerZ\RulerZ;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Entity\TaggingRule;
|
||||
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\CoreBundle\Repository\TagRepository;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
class RuleBasedTaggerTest extends TestCase
|
||||
|
@ -202,7 +207,7 @@ class RuleBasedTaggerTest extends TestCase
|
|||
->method('satisfies')
|
||||
->willReturn(true);
|
||||
|
||||
$query = $this->getMockBuilder('Doctrine\ORM\AbstractQuery')
|
||||
$query = $this->getMockBuilder(AbstractQuery::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -211,7 +216,7 @@ class RuleBasedTaggerTest extends TestCase
|
|||
->method('getResult')
|
||||
->willReturn([new Entry($user), new Entry($user)]);
|
||||
|
||||
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
|
||||
$qb = $this->getMockBuilder(QueryBuilder::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -263,21 +268,21 @@ class RuleBasedTaggerTest extends TestCase
|
|||
|
||||
private function getRulerZMock()
|
||||
{
|
||||
return $this->getMockBuilder('RulerZ\RulerZ')
|
||||
return $this->getMockBuilder(RulerZ::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
||||
private function getTagRepositoryMock()
|
||||
{
|
||||
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
|
||||
return $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
||||
private function getEntryRepositoryMock()
|
||||
{
|
||||
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
return $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
|
|
@ -2,11 +2,16 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\ParamConverter;
|
||||
|
||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Repository\UserRepository;
|
||||
|
||||
class UsernameFeedTokenConverterTest extends TestCase
|
||||
{
|
||||
|
@ -20,7 +25,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
|
||||
public function testSupportsWithNoRegistryManagers()
|
||||
{
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -36,7 +41,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
|
||||
public function testSupportsWithNoConfigurationClass()
|
||||
{
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -52,7 +57,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
|
||||
public function testSupportsWithNotTheGoodClass()
|
||||
{
|
||||
$meta = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')
|
||||
$meta = $this->getMockBuilder(ClassMetadata::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -60,7 +65,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->method('getName')
|
||||
->willReturn('nothingrelated');
|
||||
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
|
||||
$em = $this->getMockBuilder(ObjectManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -69,7 +74,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with('superclass')
|
||||
->willReturn($meta);
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -90,15 +95,15 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
|
||||
public function testSupportsWithGoodClass()
|
||||
{
|
||||
$meta = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')
|
||||
$meta = $this->getMockBuilder(ClassMetadata::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$meta->expects($this->once())
|
||||
->method('getName')
|
||||
->willReturn('Wallabag\UserBundle\Entity\User');
|
||||
->willReturn(User::class);
|
||||
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
|
||||
$em = $this->getMockBuilder(ObjectManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -107,7 +112,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with(User::class)
|
||||
->willReturn($meta);
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -138,10 +143,10 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
|
||||
public function testApplyUserNotFound()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
|
||||
$this->expectException(NotFoundHttpException::class);
|
||||
$this->expectExceptionMessage('User not found');
|
||||
|
||||
$repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$repo = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -150,7 +155,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with('test', 'test')
|
||||
->willReturn(null);
|
||||
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
|
||||
$em = $this->getMockBuilder(ObjectManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -159,7 +164,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with(User::class)
|
||||
->willReturn($repo);
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -179,7 +184,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
{
|
||||
$user = new User();
|
||||
|
||||
$repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$repo = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -188,7 +193,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with('test', 'test')
|
||||
->willReturn($user);
|
||||
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
|
||||
$em = $this->getMockBuilder(ObjectManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -197,7 +202,7 @@ class UsernameFeedTokenConverterTest extends TestCase
|
|||
->with(User::class)
|
||||
->willReturn($repo);
|
||||
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')
|
||||
$registry = $this->getMockBuilder(ManagerRegistry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -3,25 +3,29 @@
|
|||
namespace Tests\Wallabag\CoreBundle\Twig;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\CoreBundle\Repository\TagRepository;
|
||||
use Wallabag\CoreBundle\Twig\WallabagExtension;
|
||||
|
||||
class WallabagExtensionTest extends TestCase
|
||||
{
|
||||
public function testRemoveWww()
|
||||
{
|
||||
$entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepository = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
|
||||
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
|
||||
$translator = $this->getMockBuilder(TranslatorInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -34,19 +38,19 @@ class WallabagExtensionTest extends TestCase
|
|||
|
||||
public function testRemoveScheme()
|
||||
{
|
||||
$entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepository = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
|
||||
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
|
||||
$translator = $this->getMockBuilder(TranslatorInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -59,19 +63,19 @@ class WallabagExtensionTest extends TestCase
|
|||
|
||||
public function testRemoveSchemeAndWww()
|
||||
{
|
||||
$entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepository = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
|
||||
$tagRepository = $this->getMockBuilder(TagRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
|
||||
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
|
||||
$translator = $this->getMockBuilder(TranslatorInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Command;
|
||||
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ImportBundle\Command\ImportCommand;
|
||||
|
@ -11,7 +14,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
public function testRunImportCommandWithoutArguments()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
@ -27,7 +30,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
|||
|
||||
public function testRunImportCommandWithoutFilepath()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('not found');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
@ -45,7 +48,7 @@ class ImportCommandTest extends WallabagCoreTestCase
|
|||
|
||||
public function testRunImportCommandWithWrongUsername()
|
||||
{
|
||||
$this->expectException(\Doctrine\ORM\NoResultException::class);
|
||||
$this->expectException(NoResultException::class);
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
$application->add(new ImportCommand());
|
||||
|
|
|
@ -5,6 +5,8 @@ namespace Tests\Wallabag\ImportBundle\Command;
|
|||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Predis\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ImportBundle\Command\RedisWorkerCommand;
|
||||
|
@ -13,7 +15,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
public function testRunRedisWorkerCommandWithoutArguments()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Not enough arguments (missing: "serviceName")');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
@ -29,7 +31,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
|
|||
|
||||
public function testRunRedisWorkerCommandWithBadService()
|
||||
{
|
||||
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('No queue or consumer found for service name');
|
||||
|
||||
$application = new Application($this->getClient()->getKernel());
|
||||
|
@ -50,7 +52,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
|
|||
$application->add(new RedisWorkerCommand());
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$application->getKernel()->getContainer()->set(Client::class, $redisMock);
|
||||
|
||||
|
|
|
@ -2,17 +2,21 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Consumer;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\ImportBundle\Consumer\AMQPEntryConsumer;
|
||||
use Wallabag\ImportBundle\Import\AbstractImport;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Repository\UserRepository;
|
||||
|
||||
class AMQPEntryConsumerTest extends TestCase
|
||||
{
|
||||
public function testMessageOk()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -87,7 +91,7 @@ JSON;
|
|||
$user = new User();
|
||||
$entry = new Entry($user);
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -98,7 +102,7 @@ JSON;
|
|||
->with(1)
|
||||
->willReturn($user);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -113,7 +117,7 @@ JSON;
|
|||
->with(json_decode($body, true))
|
||||
->willReturn($entry);
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -135,7 +139,7 @@ JSON;
|
|||
|
||||
public function testMessageWithBadUser()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -152,7 +156,7 @@ JSON;
|
|||
$user = new User();
|
||||
$entry = new Entry($user);
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -163,11 +167,11 @@ JSON;
|
|||
->with(123)
|
||||
->willReturn(null);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -191,7 +195,7 @@ JSON;
|
|||
|
||||
public function testMessageWithEntryProcessed()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -207,7 +211,7 @@ JSON;
|
|||
|
||||
$user = new User();
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -218,7 +222,7 @@ JSON;
|
|||
->with(123)
|
||||
->willReturn($user);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -233,7 +237,7 @@ JSON;
|
|||
->with(json_decode($body, true))
|
||||
->willReturn(null);
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,16 +2,20 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Consumer;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\ImportBundle\Consumer\RedisEntryConsumer;
|
||||
use Wallabag\ImportBundle\Import\AbstractImport;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\UserBundle\Repository\UserRepository;
|
||||
|
||||
class RedisEntryConsumerTest extends TestCase
|
||||
{
|
||||
public function testMessageOk()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -86,7 +90,7 @@ JSON;
|
|||
$user = new User();
|
||||
$entry = new Entry($user);
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -97,7 +101,7 @@ JSON;
|
|||
->with(1)
|
||||
->willReturn($user);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -112,7 +116,7 @@ JSON;
|
|||
->with(json_decode($body, true))
|
||||
->willReturn($entry);
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -134,7 +138,7 @@ JSON;
|
|||
|
||||
public function testMessageWithBadUser()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -151,7 +155,7 @@ JSON;
|
|||
$user = new User();
|
||||
$entry = new Entry($user);
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -162,11 +166,11 @@ JSON;
|
|||
->with(123)
|
||||
->willReturn(null);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -188,7 +192,7 @@ JSON;
|
|||
|
||||
public function testMessageWithEntryProcessed()
|
||||
{
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -204,7 +208,7 @@ JSON;
|
|||
|
||||
$user = new User();
|
||||
|
||||
$userRepository = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')
|
||||
$userRepository = $this->getMockBuilder(UserRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -215,7 +219,7 @@ JSON;
|
|||
->with(123)
|
||||
->willReturn($user);
|
||||
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\AbstractImport')
|
||||
$import = $this->getMockBuilder(AbstractImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -230,7 +234,7 @@ JSON;
|
|||
->with(json_decode($body, true))
|
||||
->willReturn(null);
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.20minutes.fr is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.20minutes.fr is ok');
|
||||
$this->assertCount(1, $content->getTags());
|
||||
|
|
|
@ -122,7 +122,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
|
||||
$tags = $content->getTagsLabel();
|
||||
$this->assertContains('osx', $tags, 'It includes the "osx" tag');
|
||||
|
@ -161,7 +161,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content1);
|
||||
$this->assertInstanceOf(Entry::class, $content1);
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get(EntityManagerInterface::class)
|
||||
|
@ -171,7 +171,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content2);
|
||||
$this->assertInstanceOf(Entry::class, $content2);
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
|
|
@ -123,7 +123,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
|
||||
$this->assertStringContainsString('Qualité de code - Intégration de php-git-hooks dans Symfony2', $content->getTitle());
|
||||
$this->assertSame('2015-09-09', $content->getCreatedAt()->format('Y-m-d'));
|
||||
|
|
|
@ -122,7 +122,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
|
||||
|
@ -136,7 +136,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.lemonde.fr is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.lemonde.fr is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.lemonde.fr is ok');
|
||||
|
|
|
@ -122,7 +122,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.liberation.fr is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is ok');
|
||||
|
|
|
@ -122,7 +122,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://ma.ttias.be is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://ma.ttias.be is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for https://ma.ttias.be is ok');
|
||||
|
@ -166,7 +166,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content1);
|
||||
$this->assertInstanceOf(Entry::class, $content1);
|
||||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
|
@ -177,7 +177,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content2);
|
||||
$this->assertInstanceOf(Entry::class, $content2);
|
||||
$this->assertTrue($content2->isArchived());
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
|
|
@ -66,7 +66,7 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$pocketImport = $this->getMockBuilder('Wallabag\ImportBundle\Import\PocketImport')
|
||||
$pocketImport = $this->getMockBuilder(PocketImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -88,7 +88,7 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$pocketImport = $this->getMockBuilder('Wallabag\ImportBundle\Import\PocketImport')
|
||||
$pocketImport = $this->getMockBuilder(PocketImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -111,7 +111,7 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$pocketImport = $this->getMockBuilder('Wallabag\ImportBundle\Import\PocketImport')
|
||||
$pocketImport = $this->getMockBuilder(PocketImport::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.20minutes.fr is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.20minutes.fr is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.20minutes.fr is ok');
|
||||
|
@ -164,7 +164,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content1);
|
||||
$this->assertInstanceOf(Entry::class, $content1);
|
||||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
|
@ -175,7 +175,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content2);
|
||||
$this->assertInstanceOf(Entry::class, $content2);
|
||||
$this->assertTrue($content2->isArchived());
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
|
|
@ -123,7 +123,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is empty');
|
||||
$this->assertSame($content->getPreviewPicture(), 'http://www.framablog.org/public/_img/framablog/wallaby_baby.jpg');
|
||||
$this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is empty');
|
||||
|
@ -165,7 +165,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content1);
|
||||
$this->assertInstanceOf(Entry::class, $content1);
|
||||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
|
@ -176,7 +176,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content2);
|
||||
$this->assertInstanceOf(Entry::class, $content2);
|
||||
$this->assertTrue($content2->isArchived());
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
|
|
@ -123,7 +123,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
|
||||
// empty because it wasn't re-imported
|
||||
$this->assertEmpty($content->getMimetype(), 'Mimetype for https://www.liberation.fr is empty');
|
||||
|
@ -142,7 +142,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->getLoggedInUserId()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertInstanceOf(Entry::class, $content);
|
||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.mediapart.fr is ok');
|
||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.mediapart.fr is ok');
|
||||
$this->assertNotEmpty($content->getLanguage(), 'Language for https://www.mediapart.fr is ok');
|
||||
|
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\ChromeImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -34,7 +40,7 @@ class ChromeImportTest extends TestCase
|
|||
$chromeImport = $this->getChromeImport(false, 1);
|
||||
$chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -47,7 +53,7 @@ class ChromeImportTest extends TestCase
|
|||
->method('getRepository')
|
||||
->willReturn($entryRepo);
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -67,7 +73,7 @@ class ChromeImportTest extends TestCase
|
|||
$chromeImport = $this->getChromeImport(false, 1);
|
||||
$chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -105,7 +111,7 @@ class ChromeImportTest extends TestCase
|
|||
$chromeImport = $this->getChromeImport();
|
||||
$chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -116,7 +122,7 @@ class ChromeImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -124,7 +130,7 @@ class ChromeImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -145,7 +151,7 @@ class ChromeImportTest extends TestCase
|
|||
$chromeImport = $this->getChromeImport();
|
||||
$chromeImport->setFilepath(__DIR__ . '/../fixtures/chrome-bookmarks');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -156,7 +162,7 @@ class ChromeImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -165,7 +171,7 @@ class ChromeImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'chrome');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -212,19 +218,19 @@ class ChromeImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\FirefoxImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -34,7 +40,7 @@ class FirefoxImportTest extends TestCase
|
|||
$firefoxImport = $this->getFirefoxImport(false, 2);
|
||||
$firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -47,7 +53,7 @@ class FirefoxImportTest extends TestCase
|
|||
->method('getRepository')
|
||||
->willReturn($entryRepo);
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -67,7 +73,7 @@ class FirefoxImportTest extends TestCase
|
|||
$firefoxImport = $this->getFirefoxImport(false, 1);
|
||||
$firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -105,7 +111,7 @@ class FirefoxImportTest extends TestCase
|
|||
$firefoxImport = $this->getFirefoxImport();
|
||||
$firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -116,7 +122,7 @@ class FirefoxImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -124,7 +130,7 @@ class FirefoxImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -145,7 +151,7 @@ class FirefoxImportTest extends TestCase
|
|||
$firefoxImport = $this->getFirefoxImport();
|
||||
$firefoxImport->setFilepath(__DIR__ . '/../fixtures/firefox-bookmarks.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -156,7 +162,7 @@ class FirefoxImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -165,7 +171,7 @@ class FirefoxImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'firefox');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -212,19 +218,19 @@ class FirefoxImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@ namespace Tests\Wallabag\ImportBundle\Import;
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Wallabag\ImportBundle\Import\ImportChain;
|
||||
use Wallabag\ImportBundle\Import\ImportInterface;
|
||||
|
||||
class ImportChainTest extends TestCase
|
||||
{
|
||||
public function testGetAll()
|
||||
{
|
||||
$import = $this->getMockBuilder('Wallabag\ImportBundle\Import\ImportInterface')
|
||||
$import = $this->getMockBuilder(ImportInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,12 +2,19 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\InstapaperImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -35,7 +42,7 @@ class InstapaperImportTest extends TestCase
|
|||
$instapaperImport = $this->getInstapaperImport(false, 4);
|
||||
$instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -48,7 +55,7 @@ class InstapaperImportTest extends TestCase
|
|||
->method('getRepository')
|
||||
->willReturn($entryRepo);
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -68,7 +75,7 @@ class InstapaperImportTest extends TestCase
|
|||
$instapaperImport = $this->getInstapaperImport(false, 1);
|
||||
$instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -106,7 +113,7 @@ class InstapaperImportTest extends TestCase
|
|||
$instapaperImport = $this->getInstapaperImport();
|
||||
$instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -117,7 +124,7 @@ class InstapaperImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -125,7 +132,7 @@ class InstapaperImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -146,7 +153,7 @@ class InstapaperImportTest extends TestCase
|
|||
$instapaperImport = $this->getInstapaperImport();
|
||||
$instapaperImport->setFilepath(__DIR__ . '/../fixtures/instapaper-export.csv');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -157,7 +164,7 @@ class InstapaperImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -166,7 +173,7 @@ class InstapaperImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'instapaper');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -213,11 +220,11 @@ class InstapaperImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
|
||||
$this->uow = $this->getMockBuilder(UnitOfWork::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -231,15 +238,15 @@ class InstapaperImportTest extends TestCase
|
|||
->method('getScheduledEntityInsertions')
|
||||
->willReturn([]);
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,15 +2,22 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Http\Mock\Client as HttpMockClient;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\PocketImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -187,7 +194,7 @@ JSON
|
|||
|
||||
$pocketImport = $this->getPocketImport('ConsumerKey', 1);
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -277,7 +284,7 @@ JSON
|
|||
|
||||
$pocketImport = $this->getPocketImport('ConsumerKey', 2);
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -357,7 +364,7 @@ JSON
|
|||
|
||||
$pocketImport = $this->getPocketImport();
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -374,7 +381,7 @@ JSON
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -440,7 +447,7 @@ JSON
|
|||
|
||||
$pocketImport = $this->getPocketImport();
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -458,7 +465,7 @@ JSON
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'pocket');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -517,7 +524,7 @@ JSON
|
|||
|
||||
$pocketImport = $this->getPocketImport('ConsumerKey', 1);
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -555,19 +562,19 @@ JSON
|
|||
|
||||
$this->user->setConfig($config);
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
|
||||
$this->uow = $this->getMockBuilder(UnitOfWork::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -581,7 +588,7 @@ JSON
|
|||
->method('getScheduledEntityInsertions')
|
||||
->willReturn([]);
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,12 +2,18 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\ReadabilityImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -34,7 +40,7 @@ class ReadabilityImportTest extends TestCase
|
|||
$readabilityImport = $this->getReadabilityImport(false, 3);
|
||||
$readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -47,7 +53,7 @@ class ReadabilityImportTest extends TestCase
|
|||
->method('getRepository')
|
||||
->willReturn($entryRepo);
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -67,7 +73,7 @@ class ReadabilityImportTest extends TestCase
|
|||
$readabilityImport = $this->getReadabilityImport(false, 1);
|
||||
$readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability-read.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -105,7 +111,7 @@ class ReadabilityImportTest extends TestCase
|
|||
$readabilityImport = $this->getReadabilityImport();
|
||||
$readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -116,7 +122,7 @@ class ReadabilityImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -124,7 +130,7 @@ class ReadabilityImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -145,7 +151,7 @@ class ReadabilityImportTest extends TestCase
|
|||
$readabilityImport = $this->getReadabilityImport();
|
||||
$readabilityImport->setFilepath(__DIR__ . '/../fixtures/readability.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -156,7 +162,7 @@ class ReadabilityImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -165,7 +171,7 @@ class ReadabilityImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'readability');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -212,19 +218,19 @@ class ReadabilityImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,12 +2,19 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\WallabagV1Import;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -37,7 +44,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
$wallabagV1Import = $this->getWallabagV1Import(false, 1);
|
||||
$wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -50,7 +57,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
->method('getRepository')
|
||||
->willReturn($entryRepo);
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -70,7 +77,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
$wallabagV1Import = $this->getWallabagV1Import(false, 3);
|
||||
$wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1-read.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -108,7 +115,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
$wallabagV1Import = $this->getWallabagV1Import();
|
||||
$wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -119,7 +126,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -127,7 +134,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -148,7 +155,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
$wallabagV1Import = $this->getWallabagV1Import();
|
||||
$wallabagV1Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v1.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -159,7 +166,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('getRepository');
|
||||
|
||||
$entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
|
||||
$entry = $this->getMockBuilder(Entry::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -168,7 +175,7 @@ class WallabagV1ImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'wallabag_v1');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -215,11 +222,11 @@ class WallabagV1ImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
|
||||
$this->uow = $this->getMockBuilder(UnitOfWork::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -233,15 +240,15 @@ class WallabagV1ImportTest extends TestCase
|
|||
->method('getScheduledEntityInsertions')
|
||||
->willReturn([]);
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,12 +2,19 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Import;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use M6Web\Component\RedisMock\RedisMockFactory;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\CoreBundle\Repository\EntryRepository;
|
||||
use Wallabag\ImportBundle\Import\WallabagV2Import;
|
||||
use Wallabag\ImportBundle\Redis\Producer;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -35,7 +42,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
$wallabagV2Import = $this->getWallabagV2Import(false, 2);
|
||||
$wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -64,7 +71,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
$wallabagV2Import = $this->getWallabagV2Import(false, 2);
|
||||
$wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2-read.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -102,7 +109,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
$wallabagV2Import = $this->getWallabagV2Import();
|
||||
$wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -117,7 +124,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
->expects($this->never())
|
||||
->method('updateEntry');
|
||||
|
||||
$producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
|
||||
$producer = $this->getMockBuilder(\OldSound\RabbitMqBundle\RabbitMq\Producer::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -138,7 +145,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
$wallabagV2Import = $this->getWallabagV2Import();
|
||||
$wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -154,7 +161,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
->method('updateEntry');
|
||||
|
||||
$factory = new RedisMockFactory();
|
||||
$redisMock = $factory->getAdapter('Predis\Client', true);
|
||||
$redisMock = $factory->getAdapter(Client::class, true);
|
||||
|
||||
$queue = new RedisQueue($redisMock, 'wallabag_v2');
|
||||
$producer = new Producer($queue);
|
||||
|
@ -213,7 +220,7 @@ class WallabagV2ImportTest extends TestCase
|
|||
$wallabagV2Import = $this->getWallabagV2Import(false, 2);
|
||||
$wallabagV2Import->setFilepath(__DIR__ . '/../fixtures/wallabag-v2.json');
|
||||
|
||||
$entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
|
||||
$entryRepo = $this->getMockBuilder(EntryRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -241,11 +248,11 @@ class WallabagV2ImportTest extends TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->uow = $this->getMockBuilder('Doctrine\ORM\UnitOfWork')
|
||||
$this->uow = $this->getMockBuilder(UnitOfWork::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -259,15 +266,15 @@ class WallabagV2ImportTest extends TestCase
|
|||
->method('getScheduledEntityInsertions')
|
||||
->willReturn([]);
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
$this->contentProxy = $this->getMockBuilder(ContentProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner')
|
||||
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@ use PHPUnit\Framework\TestCase;
|
|||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
||||
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Wallabag\UserBundle\EventListener\AuthenticationFailureListener;
|
||||
|
||||
class AuthenticationFailureListenerTest extends TestCase
|
||||
|
@ -41,11 +43,11 @@ class AuthenticationFailureListenerTest extends TestCase
|
|||
|
||||
public function testOnAuthenticationFailure()
|
||||
{
|
||||
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')
|
||||
$token = $this->getMockBuilder(TokenInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$exception = $this->getMockBuilder('Symfony\Component\Security\Core\Exception\AuthenticationException')
|
||||
$exception = $this->getMockBuilder(AuthenticationException::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\UserBundle\EventListener;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use FOS\UserBundle\Event\FilterUserResponseEvent;
|
||||
use FOS\UserBundle\FOSUserEvents;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
@ -25,7 +26,7 @@ class CreateConfigListenerTest extends TestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$this->em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
Loading…
Reference in a new issue