1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aimeos\ShopBundle\Tests\Command; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
7
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
8
|
|
|
use Symfony\Component\Console\Tester\CommandTester; |
9
|
|
|
use Aimeos\ShopBundle\Command; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class AccountCommandTest extends WebTestCase |
13
|
|
|
{ |
14
|
|
|
public function testAccountCommandNew() |
15
|
|
|
{ |
16
|
|
|
$kernel = $this->createKernel(); |
17
|
|
|
$kernel->boot(); |
18
|
|
|
|
19
|
|
|
$container = static::getContainer(); |
20
|
|
|
|
21
|
|
|
$application = new Application( $kernel ); |
22
|
|
|
$application->add( new Command\AccountCommand( $container ) ); |
23
|
|
|
|
24
|
|
|
$command = $application->find( 'aimeos:account' ); |
25
|
|
|
$commandTester = new CommandTester( $command ); |
26
|
|
|
$commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test' ) ); |
27
|
|
|
|
28
|
|
|
$this->assertEquals( 0, $commandTester->getStatusCode() ); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
public function testAccountCommandAdmin() |
33
|
|
|
{ |
34
|
|
|
$kernel = $this->createKernel(); |
35
|
|
|
$kernel->boot(); |
36
|
|
|
|
37
|
|
|
$container = static::getContainer(); |
38
|
|
|
|
39
|
|
|
$application = new Application( $kernel ); |
40
|
|
|
$application->add( new Command\AccountCommand( $container ) ); |
41
|
|
|
|
42
|
|
|
$command = $application->find( 'aimeos:account' ); |
43
|
|
|
$commandTester = new CommandTester( $command ); |
44
|
|
|
$commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test', '--admin' => true ) ); |
45
|
|
|
|
46
|
|
|
$this->assertEquals( 0, $commandTester->getStatusCode() ); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|