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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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