Code Duplication    Length = 46-46 lines in 2 locations

src/Drupal/UserRegistry/Command/CreateTestUsersCommand.php 1 location

@@ 16-61 (lines=46) @@
13
 *
14
 * @package Codeception\Module\DrupalUserRegistry\Command\TestUsersCommand
15
 */
16
class CreateTestUsersCommand extends Command
17
{
18
    use TestUsersCommandTrait;
19
20
    /**
21
     * Configuration for this command.
22
     */
23
    protected function configure()
24
    {
25
        $this
26
            ->setName('users:create')
27
            ->setDescription('Create test users.')
28
            ->addArgument(
29
                'suite',
30
                InputArgument::OPTIONAL,
31
                "Which suite configuration to use. Defaults to 'acceptance'."
32
            );
33
    }
34
35
    /**
36
     * Execute command: create any defined test users on the configured Drush alias.
37
     *
38
     * @todo Codeception debug calls won't work here.
39
     *
40
     * @param InputInterface $input
41
     *   The command input.
42
     *
43
     * @param OutputInterface $output
44
     *   The command output.
45
     *
46
     * @return int|null|void
47
     *
48
     * @throws ModuleException
49
     */
50
    protected function execute(InputInterface $input, OutputInterface $output)
51
    {
52
        // The suite name can be passed as an argument. Without it, the command defaults to 'acceptance'.
53
        $suiteName = $input->getArgument('suite');
54
        if (!$suiteName) {
55
            $suiteName = 'acceptance';
56
        }
57
58
        $this->getTestUsers($suiteName);
59
        $this->testUserManager->createUsers($this->users);
60
    }
61
}
62

src/Drupal/UserRegistry/Command/DeleteTestUsersCommand.php 1 location

@@ 16-61 (lines=46) @@
13
 *
14
 * @package Codeception\Module\Drupal\UserRegistry\Command
15
 */
16
class DeleteTestUsersCommand extends Command
17
{
18
    use TestUsersCommandTrait;
19
20
    /**
21
     * Configuration for this command.
22
     */
23
    protected function configure()
24
    {
25
        $this
26
            ->setName('users:delete')
27
            ->setDescription('Delete test users.')
28
            ->addArgument(
29
                'suite',
30
                InputArgument::OPTIONAL,
31
                "Which suite configuration to use. Defaults to 'acceptance'."
32
            );
33
    }
34
35
    /**
36
     * Execute command: create any defined test users on the configured Drush alias.
37
     *
38
     * @todo Codeception debug calls won't work here.
39
     *
40
     * @param InputInterface $input
41
     *   The command input.
42
     *
43
     * @param OutputInterface $output
44
     *   The command output.
45
     *
46
     * @return int|null|void
47
     *
48
     * @throws ModuleException
49
     */
50
    protected function execute(InputInterface $input, OutputInterface $output)
51
    {
52
        // The suite name can be passed as an argument. Without it, the command defaults to 'acceptance'.
53
        $suiteName = $input->getArgument('suite');
54
        if (!$suiteName) {
55
            $suiteName = 'acceptance';
56
        }
57
58
        $this->getTestUsers($suiteName);
59
        $this->testUserManager->deleteUsers($this->users);
60
    }
61
}
62