]> 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 8bed180a6fd8855bc0bb4652da8092b120f42817..8e1c528de3373177de03a06db0b1937c6142adc7 100644 (file)
@@ -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,10 +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());
     }
 }