Completed
Push — master ( 28f97d...964a34 )
by Aimeos
03:23
created

AccountControllerTest::downloadAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Controller;
5
6
7
class AccountControllerTest extends \TYPO3\Flow\Tests\UnitTestCase
8
{
9
	private $object;
10
	private $view;
11
12
13
	public function setUp()
14
	{
15
		$this->object = $this->getMockBuilder( '\Aimeos\Shop\Controller\AccountController' )
16
			->setMethods( array( 'getOutput', 'getSections' ) )
17
			->disableOriginalConstructor()
18
			->getMock();
19
20
		$this->view = $this->getMockBuilder( '\TYPO3\Flow\Mvc\View\JsonView' )
21
			->disableOriginalConstructor()
22
			->getMock();
23
24
		$this->inject( $this->object, 'view', $this->view );
25
	}
26
27
28
	/**
29
	 * @test
30
	 */
31
	public function indexAction()
32
	{
33
		$expected = array( 'aibody' => 'body', 'aiheader' => 'header' );
34
35
		$this->object->expects( $this->once() )->method( 'getSections' )
36
			->will( $this->returnValue( $expected ) );
37
38
		$this->view->expects( $this->once() )->method( 'assignMultiple' )
39
			->with( $this->equalTo( $expected ) );
40
41
		$this->object->indexAction();
42
	}
43
44
45
	/**
46
	 * @test
47
	 */
48
	public function downloadAction()
49
	{
50
		$response = $this->object->downloadAction();
51
52
		$this->assertEquals( 401, $response->getStatus() );
53
	}
54
55
56
	/**
57
	 * @test
58
	 */
59
	public function favoriteComponentAction()
60
	{
61
		$this->object->expects( $this->once() )->method( 'getOutput' )
62
			->will( $this->returnValue( 'body' ) );
63
64
		$this->view->expects( $this->once() )->method( 'assign' )
65
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
66
67
		$this->object->favoriteComponentAction();
68
	}
69
70
71
	/**
72
	 * @test
73
	 */
74
	public function historyComponentAction()
75
	{
76
		$this->object->expects( $this->once() )->method( 'getOutput' )
77
			->will( $this->returnValue( 'body' ) );
78
79
		$this->view->expects( $this->once() )->method( 'assign' )
80
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
81
82
		$this->object->historyComponentAction();
83
	}
84
85
86
	/**
87
	 * @test
88
	 */
89
	public function watchComponentAction()
90
	{
91
		$this->object->expects( $this->once() )->method( 'getOutput' )
92
			->will( $this->returnValue( 'body' ) );
93
94
		$this->view->expects( $this->once() )->method( 'assign' )
95
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
96
97
		$this->object->watchComponentAction();
98
	}
99
}