mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Use FQCN instead of service alias
This commit is contained in:
parent
156158673f
commit
eb43c78720
62 changed files with 579 additions and 404 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\AnnotationBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
@ -29,7 +30,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
*/
|
||||
public function testGetAnnotations($prefixUrl)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
|
@ -70,7 +71,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
*/
|
||||
public function testSetAnnotation($prefixUrl)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
if ('annotations' === $prefixUrl) {
|
||||
$this->logInAs('admin');
|
||||
|
@ -110,7 +111,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
|
||||
public function testAllowEmptyQuote()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
/** @var Entry $entry */
|
||||
$entry = $em
|
||||
|
@ -139,7 +140,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
|
||||
public function testAllowOmmittedQuote()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
/** @var Entry $entry */
|
||||
$entry = $em
|
||||
|
@ -170,7 +171,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
*/
|
||||
public function testSetAnnotationWithQuoteTooLong($prefixUrl)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
if ('annotations' === $prefixUrl) {
|
||||
$this->logInAs('admin');
|
||||
|
@ -202,7 +203,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
*/
|
||||
public function testEditAnnotation($prefixUrl)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
|
@ -250,7 +251,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||
*/
|
||||
public function testDeleteAnnotation($prefixUrl)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace Tests\Wallabag\AnnotationBundle;
|
|||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
abstract class WallabagAnnotationTestCase extends WebTestCase
|
||||
{
|
||||
|
@ -52,10 +54,10 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
|
|||
$loginManager->logInUser($firewallName, $this->user);
|
||||
|
||||
// save the login token into the session and put it in a cookie
|
||||
$container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
|
||||
$container->get('session')->save();
|
||||
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
||||
$container->get(SessionInterface::class)->save();
|
||||
|
||||
$session = $container->get('session');
|
||||
$session = $container->get(SessionInterface::class);
|
||||
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
|
||||
|
||||
return $client;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ApiBundle\Entity\Client;
|
||||
|
||||
|
@ -11,7 +12,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
|
|||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$nbClients = $em->getRepository(Client::class)->findAll();
|
||||
|
||||
$crawler = $client->request('GET', '/developer/client/create');
|
||||
|
@ -74,7 +75,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
|
|||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$nbClients = $em->getRepository(Client::class)->findAll();
|
||||
|
||||
$crawler = $client->request('GET', '/developer');
|
||||
|
@ -95,7 +96,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
|
|||
{
|
||||
$client = $this->getClient();
|
||||
$adminApiClient = $this->createApiClientForUser('admin');
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
// Try to remove an admin's client with a wrong user
|
||||
$this->logInAs('bob');
|
||||
|
@ -134,7 +135,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
|
|||
private function createApiClientForUser($username, $grantTypes = ['password'])
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$userManager = $client->getContainer()->get('fos_user.user_manager.test');
|
||||
$user = $userManager->findUserBy(['username' => $username]);
|
||||
$apiClient = new Client($user);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
@ -13,7 +14,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testGetOneEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
|
||||
|
||||
|
@ -39,7 +40,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testGetOneEntryWithOriginUrl()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'url' => 'http://0.0.0.0/entry2']);
|
||||
|
||||
|
@ -58,7 +59,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testExportEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
|
||||
|
||||
|
@ -106,7 +107,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testGetOneEntryWrongUser()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId('bob'), 'isArchived' => false]);
|
||||
|
||||
|
@ -204,7 +205,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testGetEntriesPublicOnly()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -215,7 +216,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
// generate at least one public entry
|
||||
$entry->generateUid();
|
||||
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
|
@ -421,7 +422,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteEntry()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = new Entry($em->getReference(User::class, 1));
|
||||
$entry->setUrl('http://0.0.0.0/test-delete-entry');
|
||||
$entry->setTitle('Test delete entry');
|
||||
|
@ -455,7 +456,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteEntryExpectId()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = new Entry($em->getReference(User::class, 1));
|
||||
$entry->setUrl('http://0.0.0.0/test-delete-entry-id');
|
||||
$em->persist($entry);
|
||||
|
@ -526,7 +527,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testPostSameEntry()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = new Entry($em->getReference(User::class, $this->getUserId()));
|
||||
$entry->setUrl('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html');
|
||||
$entry->setArchived(true);
|
||||
|
@ -580,7 +581,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
} finally {
|
||||
// Remove the created entry to avoid side effects on other tests
|
||||
if (isset($content['id'])) {
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = $em->getReference(Entry::class, $content['id']);
|
||||
$em->remove($entry);
|
||||
$em->flush();
|
||||
|
@ -654,7 +655,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPatchEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -696,7 +697,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPatchEntryWithoutQuotes()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -730,7 +731,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPatchEntryWithOriginUrl()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -761,7 +762,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPatchEntryRemoveOriginUrl()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -793,7 +794,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPatchEntryNullOriginUrl()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -815,7 +816,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testGetTagsEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneWithTags($this->user->getId());
|
||||
|
||||
|
@ -838,7 +839,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testPostTagsOnEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUser($this->getUserId());
|
||||
|
||||
|
@ -860,7 +861,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertCount($nbTags + 3, $content['tags']);
|
||||
|
||||
$entryDB = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -877,7 +878,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testDeleteOneTagEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneWithTags($this->user->getId());
|
||||
$entry = $entry[0];
|
||||
|
@ -903,7 +904,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testSaveIsArchivedAfterPost()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
|
||||
|
||||
|
@ -925,7 +926,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testSaveIsStarredAfterPost()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
|
||||
|
||||
|
@ -947,7 +948,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
public function testSaveIsArchivedAfterPatch()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
|
||||
|
||||
|
@ -973,7 +974,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
{
|
||||
$now = new \DateTime();
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
|
||||
|
||||
|
@ -1134,7 +1135,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testReloadEntryErrorWhileFetching()
|
||||
{
|
||||
$entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$entry = $this->client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
|
||||
|
||||
|
@ -1170,7 +1171,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testPostEntriesTagsListAction()
|
||||
{
|
||||
$entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$entry = $this->client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
|
||||
|
||||
|
@ -1194,7 +1195,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertIsInt($content[0]['entry']);
|
||||
$this->assertSame('http://0.0.0.0/entry4', $content[0]['url']);
|
||||
|
||||
$entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$entry = $this->client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
|
||||
|
||||
|
@ -1215,7 +1216,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteEntriesTagsListAction()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = new Entry($em->getReference(User::class, $this->getUserId()));
|
||||
$entry->setUrl('http://0.0.0.0/test-entry');
|
||||
$entry->addTag((new Tag())->setLabel('foo-tag'));
|
||||
|
@ -1283,7 +1284,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteEntriesListAction()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$em->persist((new Entry($em->getReference(User::class, $this->getUserId())))->setUrl('http://0.0.0.0/test-entry1'));
|
||||
|
||||
$em->flush();
|
||||
|
@ -1341,7 +1342,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testRePostEntryAndReUsePublishedAt()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = new Entry($em->getReference(User::class, $this->getUserId()));
|
||||
$entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
|
||||
$entry->setContent('hihi');
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
@ -33,9 +34,9 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteUserTag()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneWithTags($this->user->getId());
|
||||
|
||||
|
@ -74,7 +75,7 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteOtherUserTag()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$tag = $em->getRepository(Tag::class)->findOneByLabel($this->otherUserTagLabel);
|
||||
|
||||
$this->client->request('DELETE', '/api/tags/' . $tag->getId() . '.json');
|
||||
|
@ -95,9 +96,9 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
*/
|
||||
public function testDeleteTagByLabel($useQueryString)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneWithTags($this->user->getId());
|
||||
|
||||
|
@ -127,7 +128,7 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertSame($tag->getSlug(), $content['slug']);
|
||||
|
||||
$entries = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findAllByTagId($this->user->getId(), $tag->getId());
|
||||
|
||||
|
@ -153,9 +154,9 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
*/
|
||||
public function testDeleteTagsByLabel($useQueryString)
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneWithTags($this->user->getId());
|
||||
|
||||
|
@ -196,14 +197,14 @@ class TagRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertSame($tag2->getSlug(), $content[1]['slug']);
|
||||
|
||||
$entries = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findAllByTagId($this->user->getId(), $tag->getId());
|
||||
|
||||
$this->assertCount(0, $entries);
|
||||
|
||||
$entries = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findAllByTagId($this->user->getId(), $tag2->getId());
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\ApiBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
|
||||
|
||||
class UserRestControllerTest extends WallabagApiTestCase
|
||||
|
@ -45,7 +46,7 @@ class UserRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testCreateNewUser()
|
||||
{
|
||||
$this->client->getContainer()->get('craue_config')->set('api_user_registration', 1);
|
||||
$this->client->getContainer()->get(Config::class)->set('api_user_registration', 1);
|
||||
$this->client->request('PUT', '/api/user.json', [
|
||||
'username' => 'google',
|
||||
'password' => 'googlegoogle',
|
||||
|
@ -73,14 +74,14 @@ class UserRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
|
||||
|
||||
$this->client->getContainer()->get('craue_config')->set('api_user_registration', 0);
|
||||
$this->client->getContainer()->get(Config::class)->set('api_user_registration', 0);
|
||||
}
|
||||
|
||||
public function testCreateNewUserWithoutAuthentication()
|
||||
{
|
||||
// create a new client instead of using $this->client to be sure client isn't authenticated
|
||||
$client = static::createClient();
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 1);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 1);
|
||||
$client->request('PUT', '/api/user.json', [
|
||||
'username' => 'google',
|
||||
'password' => 'googlegoogle',
|
||||
|
@ -109,13 +110,13 @@ class UserRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 0);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 0);
|
||||
}
|
||||
|
||||
public function testCreateNewUserWithExistingEmail()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 1);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 1);
|
||||
$client->request('PUT', '/api/user.json', [
|
||||
'username' => 'admin',
|
||||
'password' => 'googlegoogle',
|
||||
|
@ -138,13 +139,13 @@ class UserRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 0);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 0);
|
||||
}
|
||||
|
||||
public function testCreateNewUserWithTooShortPassword()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 1);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 1);
|
||||
$client->request('PUT', '/api/user.json', [
|
||||
'username' => 'facebook',
|
||||
'password' => 'face',
|
||||
|
@ -162,7 +163,7 @@ class UserRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertSame('application/json', $client->getResponse()->headers->get('Content-Type'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('api_user_registration', 0);
|
||||
$client->getContainer()->get(Config::class)->set('api_user_registration', 0);
|
||||
}
|
||||
|
||||
public function testCreateNewUserWhenRegistrationIsDisabled()
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
namespace Tests\Wallabag\ApiBundle;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
abstract class WallabagApiTestCase extends WebTestCase
|
||||
|
@ -41,10 +44,10 @@ abstract class WallabagApiTestCase extends WebTestCase
|
|||
$loginManager->logInUser($firewallName, $this->user);
|
||||
|
||||
// save the login token into the session and put it in a cookie
|
||||
$container->get('session')->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
|
||||
$container->get('session')->save();
|
||||
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
||||
$container->get(SessionInterface::class)->save();
|
||||
|
||||
$session = $container->get('session');
|
||||
$session = $container->get(SessionInterface::class);
|
||||
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
|
||||
|
||||
return $client;
|
||||
|
@ -63,7 +66,7 @@ abstract class WallabagApiTestCase extends WebTestCase
|
|||
{
|
||||
return $this->client
|
||||
->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(User::class)
|
||||
->findOneByUserName($username)
|
||||
->getId();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -63,7 +64,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
$url = 'https://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$this->logInAs('admin');
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -63,7 +64,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
|
|||
{
|
||||
$url = 'http://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$this->logInAs('admin');
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
|
|||
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
|
@ -35,7 +36,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
|||
parent::setUp();
|
||||
|
||||
/** @var \Doctrine\DBAL\Connection $connection */
|
||||
$connection = $this->getClient()->getContainer()->get('doctrine')->getConnection();
|
||||
$connection = $this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection();
|
||||
if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
|
||||
/*
|
||||
* LOG: statement: CREATE DATABASE "wallabag"
|
||||
|
@ -142,7 +143,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('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||
$this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
|||
'--force' => true,
|
||||
]), new NullOutput());
|
||||
|
||||
$this->getClient()->getContainer()->get('doctrine')->getConnection()->close();
|
||||
$this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->close();
|
||||
|
||||
$command = new CreateDatabaseDoctrineCommand();
|
||||
$command->setApplication($application);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Command;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -65,7 +66,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase
|
|||
public function testShowUser()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$this->logInAs('admin');
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
use Wallabag\CoreBundle\Entity\Config as ConfigEntity;
|
||||
|
@ -306,7 +310,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
// reset the token
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -571,7 +575,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('bob');
|
||||
$client = $this->getClient();
|
||||
|
||||
$rule = $client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$rule = $client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(TaggingRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
|
@ -587,7 +591,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('bob');
|
||||
$client = $this->getClient();
|
||||
|
||||
$rule = $client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$rule = $client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(TaggingRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
|
@ -708,7 +712,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('bob');
|
||||
$client = $this->getClient();
|
||||
|
||||
$rule = $client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$rule = $client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(IgnoreOriginUserRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
|
@ -724,7 +728,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('bob');
|
||||
$client = $this->getClient();
|
||||
|
||||
$rule = $client->getContainer()->get('doctrine.orm.entity_manager')
|
||||
$rule = $client->getContainer()->get(EntityManagerInterface::class)
|
||||
->getRepository(IgnoreOriginUserRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
|
@ -740,7 +744,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$config = $client->getContainer()->get('craue_config');
|
||||
$config = $client->getContainer()->get(Config::class);
|
||||
$config->set('demo_mode_enabled', 1);
|
||||
$config->set('demo_mode_username', 'admin');
|
||||
|
||||
|
@ -759,7 +763,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client->submit($form, $data);
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.password_not_updated_demo', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$config->set('demo_mode_enabled', 0);
|
||||
$config->set('demo_mode_username', 'wallabag');
|
||||
|
@ -775,7 +779,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('config.form_user.delete.button', $body[0]);
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
|
@ -820,7 +824,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
public function testDeleteAccount()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = new User();
|
||||
$user->setName('Wallace');
|
||||
|
@ -867,7 +871,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client->click($deleteLink);
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->createQueryBuilder('u')
|
||||
|
@ -879,7 +883,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->assertNull($user);
|
||||
|
||||
$entries = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUser($loggedInUserId);
|
||||
|
||||
|
@ -891,9 +895,9 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('empty');
|
||||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser();
|
||||
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
|
||||
|
||||
$tag = new Tag();
|
||||
$tag->setLabel('super');
|
||||
|
@ -930,7 +934,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->click($crawler->selectLink('config.reset.annotations')->link());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.annotations_reset', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$annotationsReset = $em
|
||||
->getRepository(Annotation::class)
|
||||
|
@ -946,7 +950,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->click($crawler->selectLink('config.reset.tags')->link());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.tags_reset', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$tagReset = $em
|
||||
->getRepository(Tag::class)
|
||||
|
@ -962,7 +966,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->click($crawler->selectLink('config.reset.entries')->link());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$entryReset = $em
|
||||
->getRepository(Entry::class)
|
||||
|
@ -976,9 +980,9 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('empty');
|
||||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser();
|
||||
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
|
||||
|
||||
$tag = new Tag();
|
||||
$tag->setLabel('super');
|
||||
|
@ -1026,7 +1030,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->click($crawler->selectLink('config.reset.archived')->link());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.archived_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.archived_reset', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$entryReset = $em
|
||||
->getRepository(Entry::class)
|
||||
|
@ -1052,9 +1056,9 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('empty');
|
||||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser();
|
||||
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
|
||||
|
||||
$tag = new Tag();
|
||||
$tag->setLabel('super');
|
||||
|
@ -1083,7 +1087,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->click($crawler->selectLink('config.reset.entries')->link());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
|
||||
$this->assertStringContainsString('flashes.config.notice.entries_reset', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->get('notice')[0]);
|
||||
|
||||
$entryReset = $em
|
||||
->getRepository(Entry::class)
|
||||
|
@ -1132,7 +1136,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client->followRedirect();
|
||||
|
||||
$this->assertSame('de', $client->getRequest()->getLocale());
|
||||
$this->assertSame('de', $client->getContainer()->get('session')->get('_locale'));
|
||||
$this->assertSame('de', $client->getContainer()->get(SessionInterface::class)->get('_locale'));
|
||||
}
|
||||
|
||||
public function testChangeLocaleWithReferer()
|
||||
|
@ -1144,7 +1148,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client->followRedirect();
|
||||
|
||||
$this->assertSame('de', $client->getRequest()->getLocale());
|
||||
$this->assertSame('de', $client->getContainer()->get('session')->get('_locale'));
|
||||
$this->assertSame('de', $client->getContainer()->get(SessionInterface::class)->get('_locale'));
|
||||
}
|
||||
|
||||
public function testChangeLocaleToBadLocale()
|
||||
|
@ -1156,7 +1160,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$client->followRedirect();
|
||||
|
||||
$this->assertNotSame('yuyuyuyu', $client->getRequest()->getLocale());
|
||||
$this->assertNotSame('yuyuyuyu', $client->getContainer()->get('session')->get('_locale'));
|
||||
$this->assertNotSame('yuyuyuyu', $client->getContainer()->get(SessionInterface::class)->get('_locale'));
|
||||
}
|
||||
|
||||
public function testUserEnable2faEmail()
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
use Wallabag\CoreBundle\Entity\Config as ConfigEntity;
|
||||
|
@ -28,7 +31,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
{
|
||||
if ($this->downloadImagesEnabled) {
|
||||
$client = static::createClient();
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
|
||||
$client->getContainer()->get(Config::class)->set('download_images_enabled', 0);
|
||||
|
||||
$this->downloadImagesEnabled = false;
|
||||
}
|
||||
|
@ -114,7 +117,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertCount(5, $crawler->filter($this->entryDataTestAttribute));
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
$entry = $em
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
|
@ -148,7 +151,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('store_article_headers', 1);
|
||||
$client->getContainer()->get(Config::class)->set('store_article_headers', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/new');
|
||||
|
||||
|
@ -165,7 +168,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -176,7 +179,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('la cryptomonnaie de Facebook', $content->getTitle());
|
||||
$this->assertSame('fr', $content->getLanguage());
|
||||
$this->assertArrayHasKey('x-frame-options', $content->getHeaders());
|
||||
$client->getContainer()->get('craue_config')->set('store_article_headers', 0);
|
||||
$client->getContainer()->get(Config::class)->set('store_article_headers', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,7 +205,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -239,7 +242,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -378,7 +381,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('/', $client->getResponse()->getTargetUrl());
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
$entry = $em
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUrl($url);
|
||||
|
@ -645,7 +648,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -668,7 +671,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneById($entry->getId());
|
||||
|
||||
|
@ -707,7 +710,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
// add a new content to be removed later
|
||||
$user = $em
|
||||
|
@ -743,7 +746,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUsernameAndNotArchived('bob');
|
||||
|
||||
|
@ -948,7 +951,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl($this->url);
|
||||
|
||||
$em = $this->getClient()->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $this->getClient()->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUserName('admin');
|
||||
|
@ -1134,7 +1137,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
// sharing is enabled
|
||||
$client->getContainer()->get('craue_config')->set('share_public', 1);
|
||||
$client->getContainer()->get(Config::class)->set('share_public', 1);
|
||||
|
||||
$content = new Entry($this->getLoggedInUser());
|
||||
$content->setUrl($this->url);
|
||||
|
@ -1168,7 +1171,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('og:image', $client->getResponse()->getContent());
|
||||
|
||||
// sharing is now disabled
|
||||
$client->getContainer()->get('craue_config')->set('share_public', 0);
|
||||
$client->getContainer()->get(Config::class)->set('share_public', 0);
|
||||
$client->request('GET', '/share/' . $content->getUid());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -1191,7 +1194,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
|
||||
$client->getContainer()->get(Config::class)->set('download_images_enabled', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/new');
|
||||
|
||||
|
@ -1208,7 +1211,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
$entry = $em
|
||||
->getRepository(Entry::class)
|
||||
|
@ -1220,7 +1223,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
// instead of checking for the filename (which might change) check that the image is now local
|
||||
$this->assertStringContainsString(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
|
||||
$client->getContainer()->get(Config::class)->set('download_images_enabled', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1233,7 +1236,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$url = self::AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE;
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
|
||||
$client->getContainer()->get(Config::class)->set('download_images_enabled', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/new');
|
||||
|
||||
|
@ -1250,7 +1253,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -1258,7 +1261,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
|
||||
$client->getContainer()->get(Config::class)->set('download_images_enabled', 0);
|
||||
}
|
||||
|
||||
public function testRedirectToHomepage()
|
||||
|
@ -1529,7 +1532,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -1546,13 +1549,13 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$url = 'https://www.monde-diplomatique.fr/2017/05/BONNET/57476';
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
// enable restricted access
|
||||
$client->getContainer()->get('craue_config')->set('restricted_access', 1);
|
||||
$client->getContainer()->get(Config::class)->set('restricted_access', 1);
|
||||
|
||||
// create a new site_credential
|
||||
$user = $client->getContainer()->get('security.token_storage')->getToken()->getUser();
|
||||
$user = $client->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
|
||||
$credential = new SiteCredential($user);
|
||||
$credential->setHost('monde-diplomatique.fr');
|
||||
$credential->setUsername($client->getContainer()->get(CryptoProxy::class)->crypt('foo'));
|
||||
|
@ -1587,7 +1590,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
|
||||
$this->assertSame('Quand Manille manœuvre', $content->getTitle());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('restricted_access', 0);
|
||||
$client->getContainer()->get(Config::class)->set('restricted_access', 0);
|
||||
}
|
||||
|
||||
public function testPostEntryWhenFetchFails()
|
||||
|
@ -1629,7 +1632,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
|
@ -1643,7 +1646,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$entry = $em->getRepository(Entry::class)->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
|
||||
$tag = $entry->getTags()[0];
|
||||
|
||||
|
@ -1720,14 +1723,14 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry1->getId());
|
||||
|
||||
$this->assertSame(1, $res->isArchived());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2->getId());
|
||||
|
||||
|
@ -1742,14 +1745,14 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry1->getId());
|
||||
|
||||
$this->assertSame(1, $res->isStarred());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2->getId());
|
||||
|
||||
|
@ -1765,21 +1768,21 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry1->getId());
|
||||
|
||||
$this->assertContains('foo', $res->getTagsLabel());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2->getId());
|
||||
|
||||
$this->assertContains('foo', $res->getTagsLabel());
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry3->getId());
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
|
@ -49,7 +50,7 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUsernameAndNotArchived('admin');
|
||||
|
||||
|
@ -90,7 +91,7 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findOneByUsernameAndNotArchived('admin');
|
||||
|
||||
|
@ -158,7 +159,7 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
|
||||
// to be sure results are the same
|
||||
$contentInDB = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->createQueryBuilder('e')
|
||||
->select('e, t')
|
||||
|
@ -204,7 +205,7 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$contentInDB = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
|
||||
|
||||
|
@ -278,7 +279,7 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
|
||||
// to be sure results are the same
|
||||
$contentInDB = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->createQueryBuilder('e')
|
||||
->leftJoin('e.user', 'u')
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
@ -91,7 +92,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testUnread()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -112,7 +113,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testStarred()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -134,7 +135,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testArchives()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -156,7 +157,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testAll()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -178,7 +179,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testPagination()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -206,7 +207,7 @@ class FeedControllerTest extends WallabagCoreTestCase
|
|||
public function testTags()
|
||||
{
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
|
@ -39,7 +40,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$client->followRedirects();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
@ -72,7 +73,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$client->followRedirects();
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Entity\SiteCredential;
|
||||
|
@ -13,13 +15,13 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('restricted_access', 0);
|
||||
$client->getContainer()->get(Config::class)->set('restricted_access', 0);
|
||||
|
||||
$client->request('GET', '/site-credentials/');
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('restricted_access', 1);
|
||||
$client->getContainer()->get(Config::class)->set('restricted_access', 1);
|
||||
}
|
||||
|
||||
public function testListSiteCredential()
|
||||
|
@ -144,7 +146,7 @@ class SiteCredentialControllerTest extends WallabagCoreTestCase
|
|||
$credential->setUsername('sergei');
|
||||
$credential->setPassword('microsoft');
|
||||
|
||||
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$em->persist($credential);
|
||||
$em->flush();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
|
@ -77,7 +78,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$entry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry2', $this->getLoggedInUserId());
|
||||
|
||||
|
@ -93,7 +94,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$newEntry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -138,7 +139,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findOneByLabel($this->tagName);
|
||||
|
||||
|
@ -170,7 +171,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$client->click($link);
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findOneByLabel($this->tagName);
|
||||
|
||||
|
@ -181,12 +182,12 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
->findOneByUserName('admin');
|
||||
|
||||
$entry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/foo', $user->getId());
|
||||
|
||||
$entry2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/bar', $user->getId());
|
||||
|
||||
|
@ -199,13 +200,13 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$em = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
$tag = new Tag();
|
||||
$tag->setLabel($this->tagName);
|
||||
|
||||
$entry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getLoggedInUserId());
|
||||
|
||||
|
@ -216,7 +217,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$em->flush();
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findOneByEntryAndTagLabel($entry, $this->tagName);
|
||||
|
||||
|
@ -269,12 +270,12 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$freshEntry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
$freshEntry2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2->getId());
|
||||
|
||||
|
@ -293,7 +294,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertFalse(array_search($tag->getLabel(), $tags, true), 'Previous tag is not attach to entries anymore.');
|
||||
|
||||
$newTag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($newTagLabel);
|
||||
|
||||
|
@ -333,7 +334,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$freshEntry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -347,7 +348,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertNotFalse(array_search($tag->getLabel(), $tags, true), 'Tag is still assigned to the entry.');
|
||||
|
||||
$newTag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($tagLabel);
|
||||
|
||||
|
@ -388,7 +389,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$freshEntry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -402,12 +403,12 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertFalse(array_search($newTagLabel, $tags, true));
|
||||
|
||||
$tagFromRepo = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($tagLabel);
|
||||
|
||||
$newTagFromRepo = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($newTagLabel);
|
||||
|
||||
|
@ -458,22 +459,22 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringNotContainsString('flashes.tag.notice.tag_renamed', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$freshEntry1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry1->getId());
|
||||
|
||||
$freshEntry2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2->getId());
|
||||
|
||||
$tagFromRepo = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($tagLabel);
|
||||
|
||||
$previousTagFromRepo = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Tag::class)
|
||||
->findByLabel($previousTagLabel);
|
||||
|
||||
|
@ -516,7 +517,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$client->submit($form, $data);
|
||||
|
||||
$newEntry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry->getId());
|
||||
|
||||
|
@ -549,7 +550,7 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$client->followRedirect();
|
||||
|
||||
$entries = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->getBuilderForSearchByUser($this->getLoggedInUserId(), 'title', 'unread')
|
||||
->getQuery()->getResult();
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\BrowserKit\Cookie;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
|
||||
|
@ -70,7 +73,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
|||
|
||||
public function getEntityManager()
|
||||
{
|
||||
return $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
return $this->client->getContainer()->get(EntityManagerInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +85,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
|||
public function logInAs($username)
|
||||
{
|
||||
$container = $this->client->getContainer();
|
||||
$session = $container->get('session');
|
||||
$session = $container->get(SessionInterface::class);
|
||||
|
||||
$userManager = $container->get('fos_user.user_manager.test');
|
||||
$loginManager = $container->get('fos_user.security.login_manager.test');
|
||||
|
@ -96,7 +99,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
|||
|
||||
$loginManager->logInUser($firewallName, $user);
|
||||
|
||||
$session->set('_security_' . $firewallName, serialize($container->get('security.token_storage')->getToken()));
|
||||
$session->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
|
||||
$session->save();
|
||||
|
||||
$cookie = new Cookie($session->getName(), $session->getId());
|
||||
|
@ -129,7 +132,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
|
|||
*/
|
||||
public function getLoggedInUser()
|
||||
{
|
||||
$token = static::$kernel->getContainer()->get('security.token_storage')->getToken();
|
||||
$token = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken();
|
||||
|
||||
if (null !== $token) {
|
||||
return $token->getUser();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/chrome');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportChromeBadFile()
|
||||
|
@ -59,7 +61,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/chrome');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.chrome'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagWithChromeFile()
|
||||
|
@ -113,7 +115,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.20minutes.fr/sport/3256363-20220321-tournoi-vi-nations-trophee-gagne-xv-france-fini-fond-seine',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/delicious');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportDeliciousBadFile()
|
||||
|
@ -59,7 +61,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/delicious');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.delicious'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportDeliciousWithFile()
|
||||
|
@ -110,7 +112,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://feross.org/spoofmac/',
|
||||
|
@ -152,7 +154,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://stackoverflow.com/review/',
|
||||
|
@ -162,7 +164,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase
|
|||
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content1);
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://addyosmani.com/basket.js/',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/elcurator');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportElcuratorBadFile()
|
||||
|
@ -60,7 +62,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/elcurator');
|
||||
|
||||
|
@ -87,7 +89,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.elcurator'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportElcuratorWithFile()
|
||||
|
@ -114,7 +116,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://devblog.lexik.fr/git/qualite-de-code-integration-de-php-git-hooks-dans-symfony2-2842',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/firefox');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportFirefoxBadFile()
|
||||
|
@ -59,7 +61,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/firefox');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.firefox'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagWithFirefoxFile()
|
||||
|
@ -113,7 +115,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html',
|
||||
|
@ -127,7 +129,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase
|
|||
$this->assertCount(3, $content->getTags());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/instapaper');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportInstapaperBadFile()
|
||||
|
@ -59,7 +61,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/instapaper');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.instapaper'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportInstapaperWithFile()
|
||||
|
@ -113,7 +115,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.liberation.fr/societe/police-justice/cours-dassises-on-efface-le-peuple-dun-processus-judiciaire-dont-il-est-pourtant-le-coeur-battant-20210414_FYUNIZENHRGHZLAZEKSMKZYEPI/',
|
||||
|
@ -130,7 +132,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe',
|
||||
|
@ -165,7 +167,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://redditblog.com/2016/09/20/amp-and-reactredux/',
|
||||
|
@ -175,7 +177,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
|
|||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/pinboard');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportPinboardBadFile()
|
||||
|
@ -59,7 +61,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/pinboard');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.pinboard'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportPinboardWithFile()
|
||||
|
@ -110,7 +112,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://ma.ttias.be/varnish-explained/',
|
||||
|
@ -157,7 +159,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://ilia.ws/files/nginx_torontophpug.pdf',
|
||||
|
@ -168,7 +170,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
|
|||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://developers.google.com/web/updates/2016/07/infinite-scroller',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
use Wallabag\ImportBundle\Import\PocketImport;
|
||||
|
||||
|
@ -23,14 +25,14 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/pocket');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame(1, $crawler->filter('button[name=action]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportPocketWithRedisEnabled()
|
||||
|
@ -39,14 +41,14 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/pocket');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame(1, $crawler->filter('button[name=action]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportPocketAuthBadToken()
|
||||
|
@ -101,7 +103,7 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
|
||||
$this->assertSame('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
|
||||
$this->assertSame('flashes.import.notice.failed', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->peek('notice')[0]);
|
||||
}
|
||||
|
||||
public function testImportPocketCallback()
|
||||
|
@ -135,6 +137,6 @@ class PocketControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
|
||||
$this->assertSame('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
|
||||
$this->assertSame('flashes.import.notice.summary', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->peek('notice')[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/readability');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportReadabilityBadFile()
|
||||
|
@ -59,7 +61,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->checkRedis();
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/readability');
|
||||
|
||||
|
@ -86,7 +88,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.readability'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportReadabilityWithFile()
|
||||
|
@ -110,7 +112,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.20minutes.fr/bordeaux/2120479-20170823-bordeaux-poche-chocolatine-association-traduit-etudiants-etrangers-mots-sud-ouest',
|
||||
|
@ -155,7 +157,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://blog.travis-ci.com/2016-07-28-what-we-learned-from-analyzing-2-million-travis-builds/',
|
||||
|
@ -166,7 +168,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
|
|||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://facebook.github.io/graphql/October2016/',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/wallabag-v1');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagBadFile()
|
||||
|
@ -60,7 +62,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/wallabag-v1');
|
||||
|
||||
|
@ -87,7 +89,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v1'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagWithFile()
|
||||
|
@ -111,7 +113,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'http://www.framablog.org/index.php/post/2014/02/05/Framabag-service-libre-gratuit-interview-developpeur',
|
||||
|
@ -156,7 +158,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->followRedirect();
|
||||
|
||||
$content1 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'http://gilbert.pellegrom.me/recreating-the-square-slider',
|
||||
|
@ -167,7 +169,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertTrue($content1->isArchived());
|
||||
|
||||
$content2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.wallabag.org/features/',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Predis\Client;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||
|
@ -26,7 +28,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/wallabag-v2');
|
||||
|
||||
|
@ -34,7 +36,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
|
||||
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagBadFile()
|
||||
|
@ -60,7 +62,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 1);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 1);
|
||||
|
||||
$crawler = $client->request('GET', '/import/wallabag-v2');
|
||||
|
||||
|
@ -87,7 +89,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
|
||||
$this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v2'));
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
|
||||
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
|
||||
}
|
||||
|
||||
public function testImportWallabagWithFile()
|
||||
|
@ -114,7 +116,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867',
|
||||
|
@ -133,7 +135,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
|||
$this->assertCount(1, $tags);
|
||||
|
||||
$content = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId(
|
||||
'https://www.mediapart.fr/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue