Use ::class notation where possible

This commit is contained in:
Yassine Guedidi
2022-09-01 20:54:56 +02:00
parent d1d56fbe25
commit 98af2e25f2
52 changed files with 347 additions and 250 deletions

View File

@ -52,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);

View File

@ -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();

View File

@ -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();

View File

@ -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());

View File

@ -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]);

View File

@ -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'));

View File

@ -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');

View File

@ -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');

View File

@ -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']));

View File

@ -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();

View File

@ -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']));

View File

@ -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']));

View File

@ -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');

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();