1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aimeos\ShopBundle\Tests\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
class AccountControllerTest extends WebTestCase |
9
|
|
|
{ |
10
|
|
|
public function testAccount() |
11
|
|
|
{ |
12
|
|
|
$client = static::createClient(); |
13
|
|
|
$client->request( 'GET', '/unittest/de/EUR/myaccount' ); |
14
|
|
|
|
15
|
|
|
$this->assertContains( 'aimeos account-history', $client->getResponse()->getContent() ); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
public function testDownload() |
20
|
|
|
{ |
21
|
|
|
$client = static::createClient(); |
22
|
|
|
$client->request( 'GET', '/unittest/de/EUR/myaccount/download/0' ); |
23
|
|
|
|
24
|
|
|
$this->assertEquals( 401, $client->getResponse()->getStatusCode() ); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
public function testFavoriteComponent() |
29
|
|
|
{ |
30
|
|
|
$client = static::createClient(); |
31
|
|
|
$client->request( 'GET', '/unittest/de/EUR/test/favoritecomponent' ); |
32
|
|
|
|
33
|
|
|
$this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
public function testHistoryComponent() |
38
|
|
|
{ |
39
|
|
|
$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' ) |
40
|
|
|
->setMethods( array( 'getOutput' ) ) |
41
|
|
|
->disableOriginalConstructor() |
42
|
|
|
->getMock(); |
43
|
|
|
|
44
|
|
|
$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
45
|
|
|
|
46
|
|
|
$this->assertEquals( 'test', $mock->historyComponentAction() ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
public function testWatchComponent() |
51
|
|
|
{ |
52
|
|
|
$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' ) |
53
|
|
|
->setMethods( array( 'getOutput' ) ) |
54
|
|
|
->disableOriginalConstructor() |
55
|
|
|
->getMock(); |
56
|
|
|
|
57
|
|
|
$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
58
|
|
|
|
59
|
|
|
$this->assertEquals( 'test', $mock->watchComponentAction() ); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|