]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
add filepath test
authorThomas Citharel <tcit@tcit.fr>
Sun, 22 Jan 2017 12:19:46 +0000 (13:19 +0100)
committerThomas Citharel <tcit@tcit.fr>
Sun, 22 Jan 2017 12:19:46 +0000 (13:19 +0100)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
src/Wallabag/CoreBundle/Command/ExportCommand.php
tests/Wallabag/CoreBundle/Command/ExportCommandTest.php

index 9c3c3fefea4a575feb0796e84daf5156a83126bb..0cf5de488fa62ee9f8312e076ab58fd4ea307122 100644 (file)
@@ -23,7 +23,7 @@ class ExportCommand extends ContainerAwareCommand
                 'User from which to export entries'
             )
             ->addArgument(
-                'filename',
+                'filepath',
                 InputArgument::OPTIONAL,
                 'Path of the exported file'
             )
@@ -46,7 +46,7 @@ class ExportCommand extends ContainerAwareCommand
 
         $output->write(sprintf('Exporting %d entrie(s) for user « <comment>%s</comment> »... ', count($entries), $user->getUserName()));
 
-        $filePath = $input->getArgument('filename');
+        $filePath = $input->getArgument('filepath');
         if (!$filePath) {
             $filePath = $this->getContainer()->getParameter('kernel.root_dir') . '/../' . sprintf('%s-export', $user->getUsername());
         }
index 41491838b330f79c4be1a3dfe6f2e59616a43076..4c66e051c77d56308b427ba67d474f3664620cdb 100644 (file)
@@ -57,4 +57,21 @@ class ExportCommandTest extends WallabagCoreTestCase
 
         $this->assertContains('Exporting 6 entrie(s) for user « admin »... Done', $tester->getDisplay());
     }
+
+    public function testExportCommandWithSpecialPath()
+    {
+        $application = new Application($this->getClient()->getKernel());
+        $application->add(new ExportCommand());
+
+        $command = $application->find('wallabag:export');
+
+        $tester = new CommandTester($command);
+        $tester->execute([
+            'command' => $command->getName(),
+            'username' => 'admin',
+            'filepath' => 'specialexport.json'
+        ]);
+
+        $this->assertFileExists('specialexport.json');
+    }
 }