Completed
Pull Request — master (#181)
by Beñat
13:17
created

UserFixturesCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 8
nc 2
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Kreta\IdentityAccess\Infrastructure\Ui\Cli\Symfony\Command;
14
15
use BenGorUser\User\Application\Command\SignUp\SignUpUserCommand;
16
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Output\OutputInterface;
19
20
class UserFixturesCommand extends ContainerAwareCommand
21
{
22
    protected function configure()
23
    {
24
        $this->setName('fixtures:user');
25
    }
26
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        for ($i = 0; $i < 20; $i++) {
30
            $this->getContainer()->get('bengor_user.user.command_bus')->handle(
31
                new SignUpUserCommand(
32
                    'user'.$i.'@gmail.com',
33
                    '123456',
34
                    ['ROLE_USER']
35
                )
36
            );
37
        }
38
39
        $output->writeln('Population is successfully done');
40
    }
41
}
42