]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
Fix tests
[github/wallabag/wallabag.git] / tests / Wallabag / ImportBundle / Command / ImportCommandTest.php
index 7043c3450b73c63d267057c20e13b160840767e4..8e1c528de3373177de03a06db0b1937c6142adc7 100644 (file)
@@ -4,8 +4,8 @@ namespace Tests\Wallabag\ImportBundle\Command;
 
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Tester\CommandTester;
-use Wallabag\ImportBundle\Command\ImportCommand;
 use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\ImportBundle\Command\ImportCommand;
 
 class ImportCommandTest extends WallabagCoreTestCase
 {
@@ -74,7 +74,7 @@ class ImportCommandTest extends WallabagCoreTestCase
         $tester->execute([
             'command' => $command->getName(),
             'username' => 'admin',
-            'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
+            'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
             '--importer' => 'v2',
         ]);
 
@@ -84,6 +84,8 @@ class ImportCommandTest extends WallabagCoreTestCase
 
     public function testRunImportCommandWithUserId()
     {
+        $this->logInAs('admin');
+
         $application = new Application($this->getClient()->getKernel());
         $application->add(new ImportCommand());
 
@@ -92,9 +94,13 @@ class ImportCommandTest extends WallabagCoreTestCase
         $tester = new CommandTester($command);
         $tester->execute([
             'command' => $command->getName(),
-            'username' => 1,
-            'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.root_dir').'/../tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
+            'username' => $this->getLoggedInUserId(),
+            'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
             '--useUserId' => true,
+            '--importer' => 'v2',
         ]);
+
+        $this->assertContains('imported', $tester->getDisplay());
+        $this->assertContains('already saved', $tester->getDisplay());
     }
 }