Completed
Push — master ( 76ac09...8c1d79 )
by Aimeos
04:15
created

AccountControllerTest::testWatchComponent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
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