Completed
Push — master ( 089724...86712e )
by Aimeos
45:58
created

AccountControllerTest::profileComponentAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
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 favoriteComponentAction()
49
	{
50
		$this->object->expects( $this->once() )->method( 'getOutput' )
51
			->will( $this->returnValue( 'body' ) );
52
53
		$this->view->expects( $this->once() )->method( 'assign' )
54
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
55
56
		$this->object->favoriteComponentAction();
57
	}
58
59
60
	/**
61
	 * @test
62
	 */
63
	public function historyComponentAction()
64
	{
65
		$this->object->expects( $this->once() )->method( 'getOutput' )
66
			->will( $this->returnValue( 'body' ) );
67
68
		$this->view->expects( $this->once() )->method( 'assign' )
69
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
70
71
		$this->object->historyComponentAction();
72
	}
73
74
75
	/**
76
	 * @test
77
	 */
78
	public function profileComponentAction()
79
	{
80
		$this->object->expects( $this->once() )->method( 'getOutput' )
81
			->will( $this->returnValue( 'body' ) );
82
83
		$this->view->expects( $this->once() )->method( 'assign' )
84
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
85
86
		$this->object->profileComponentAction();
87
	}
88
89
90
	/**
91
	 * @test
92
	 */
93
	public function watchComponentAction()
94
	{
95
		$this->object->expects( $this->once() )->method( 'getOutput' )
96
			->will( $this->returnValue( 'body' ) );
97
98
		$this->view->expects( $this->once() )->method( 'assign' )
99
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
100
101
		$this->object->watchComponentAction();
102
	}
103
}