Remove useless command input parameter

This commit is contained in:
Yassine Guedidi 2022-09-03 02:28:07 +02:00 committed by Jérémy Benoist
parent 17497275b2
commit e32794e9d6
10 changed files with 15 additions and 74 deletions

View file

@ -18,9 +18,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:clean-duplicates');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Cleaning through 3 user accounts', $tester->getDisplay());
$this->assertStringContainsString('Finished cleaning. 0 duplicates found in total', $tester->getDisplay());
@ -34,7 +32,6 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'unknown',
]);
@ -49,7 +46,6 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);
@ -89,7 +85,6 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);

View file

@ -19,9 +19,7 @@ class ExportCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:export');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
}
public function testExportCommandWithBadUsername()
@ -32,7 +30,6 @@ class ExportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'unknown',
]);
@ -47,7 +44,6 @@ class ExportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);
@ -64,7 +60,6 @@ class ExportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
'filepath' => 'specialexport.json',
]);

View file

@ -18,9 +18,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:generate-hashed-urls');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Generating hashed urls for "3" users', $tester->getDisplay());
$this->assertStringContainsString('Finished generated hashed urls', $tester->getDisplay());
@ -34,7 +32,6 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'unknown',
]);
@ -49,7 +46,6 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);
@ -78,7 +74,6 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);

View file

@ -98,9 +98,7 @@ class InstallCommandTest extends WallabagCoreTestCase
'password_' . uniqid('', true), // password
'email_' . uniqid('', true) . '@wallabag.it', // email
]);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Checking system requirements.', $tester->getDisplay());
$this->assertStringContainsString('Setting up database.', $tester->getDisplay());
@ -124,7 +122,6 @@ class InstallCommandTest extends WallabagCoreTestCase
'email_' . uniqid('', true) . '@wallabag.it', // email
]);
$tester->execute([
'command' => $command->getName(),
'--reset' => true,
]);
@ -151,7 +148,6 @@ class InstallCommandTest extends WallabagCoreTestCase
// drop database first, so the install command won't ask to reset things
$command = $application->find('doctrine:database:drop');
$command->run(new ArrayInput([
'command' => 'doctrine:database:drop',
'--force' => true,
]), new NullOutput());
@ -168,9 +164,7 @@ class InstallCommandTest extends WallabagCoreTestCase
'password_' . uniqid('', true), // password
'email_' . uniqid('', true) . '@wallabag.it', // email
]);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Checking system requirements.', $tester->getDisplay());
$this->assertStringContainsString('Setting up database.', $tester->getDisplay());
@ -195,9 +189,7 @@ class InstallCommandTest extends WallabagCoreTestCase
'y', // do want to reset the schema
'n', // don't want to create a new user
]);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Checking system requirements.', $tester->getDisplay());
$this->assertStringContainsString('Setting up database.', $tester->getDisplay());
@ -214,17 +206,13 @@ class InstallCommandTest extends WallabagCoreTestCase
// drop database first, so the install command won't ask to reset things
$command = $application->find('doctrine:database:drop');
$command->run(new ArrayInput([
'command' => 'doctrine:database:drop',
'--force' => true,
]), new NullOutput());
$this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->close();
$command = $application->find('doctrine:database:create');
$command->run(new ArrayInput([
'command' => 'doctrine:database:create',
'--env' => 'test',
]), new NullOutput());
$command->run(new ArrayInput([]), new NullOutput());
$command = $application->find('wallabag:install');
@ -233,9 +221,7 @@ class InstallCommandTest extends WallabagCoreTestCase
'n', // don't want to reset the entire database
'n', // don't want to create a new user
]);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('Checking system requirements.', $tester->getDisplay());
$this->assertStringContainsString('Setting up database.', $tester->getDisplay());
@ -254,9 +240,7 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->disableRunOtherCommands();
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
], [
$tester->execute([], [
'interactive' => false,
]);

View file

@ -15,9 +15,7 @@ class ListUserCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:user:list');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
$this->assertStringContainsString('3/3 user(s) displayed.', $tester->getDisplay());
}
@ -30,7 +28,6 @@ class ListUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'--limit' => 2,
]);
@ -45,7 +42,6 @@ class ListUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'search' => 'boss',
]);
@ -60,7 +56,6 @@ class ListUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'search' => 'bo',
'--limit' => 1,
]);

View file

@ -53,9 +53,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:entry:reload');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
], [
$tester->execute([], [
'interactive' => false,
]);
@ -81,7 +79,6 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:entry:reload');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
], [
'interactive' => false,
@ -105,7 +102,6 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:entry:reload');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'empty',
], [
'interactive' => false,

View file

@ -21,9 +21,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:user:show');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
}
public function testRunShowUserCommandWithBadUsername()
@ -34,7 +32,6 @@ class ShowUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'unknown',
]);
@ -49,7 +46,6 @@ class ShowUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);
@ -81,7 +77,6 @@ class ShowUserCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);

View file

@ -19,9 +19,7 @@ class TagAllCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
}
public function testRunTagAllCommandWithBadUsername()
@ -32,7 +30,6 @@ class TagAllCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'unknown',
]);
@ -47,7 +44,6 @@ class TagAllCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
]);

View file

@ -21,9 +21,7 @@ class ImportCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:import');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
}
public function testRunImportCommandWithoutFilepath()
@ -37,7 +35,6 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
'filepath' => 1,
]);
@ -53,7 +50,6 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'random',
'filepath' => './',
]);
@ -67,7 +63,6 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => 'admin',
'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
'--importer' => 'v2',
@ -87,7 +82,6 @@ class ImportCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'username' => $this->getLoggedInUserId(),
'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
'--useUserId' => true,

View file

@ -22,9 +22,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:import:redis-worker');
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
]);
$tester->execute([]);
}
public function testRunRedisWorkerCommandWithBadService()
@ -38,7 +36,6 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'serviceName' => 'YOMONSERVICE',
]);
}
@ -60,7 +57,6 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
$tester = new CommandTester($command);
$tester->execute([
'command' => $command->getName(),
'serviceName' => 'readability',
'--maxIterations' => 1,
]);