mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +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\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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue