Issues (43)

Tests/Unit/Controller/CheckoutControllerTest.php (1 issue)

Labels
Severity
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Controller;
5
6
7
class CheckoutControllerTest extends \Neos\Flow\Tests\UnitTestCase
0 ignored issues
show
The type Neos\Flow\Tests\UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
{
9
	private $object;
10
	private $response;
11
	private $view;
12
13
14
	public function setUp()
15
	{
16
		$this->object = $this->getMockBuilder( '\Aimeos\Shop\Controller\CheckoutController' )
17
			->setMethods( array( 'getOutput', 'get' ) )
18
			->disableOriginalConstructor()
19
			->getMock();
20
21
		$this->view = $this->getMockBuilder( '\Neos\Flow\Mvc\View\JsonView' )
22
			->disableOriginalConstructor()
23
			->getMock();
24
25
		$this->response = $this->getMockBuilder( '\Neos\Flow\Http\Response' )
26
			->disableOriginalConstructor()
27
			->getMock();
28
29
		$this->inject( $this->object, 'view', $this->view );
30
		$this->inject( $this->object, 'response', $this->response );
31
	}
32
33
34
	/**
35
	 * @test
36
	 */
37
	public function indexAction()
38
	{
39
		$expected = array( 'aibody' => 'body', 'aiheader' => 'header' );
40
41
		$this->object->expects( $this->once() )->method( 'get' )
42
			->will( $this->returnValue( $expected ) );
43
44
		$this->view->expects( $this->once() )->method( 'assignMultiple' )
45
			->with( $this->equalTo( $expected ) );
46
47
		$this->response->expects( $this->once() )->method( 'setHeader' );
48
49
		$this->object->indexAction();
50
	}
51
52
53
	/**
54
	 * @test
55
	 */
56
	public function confirmAction()
57
	{
58
		$expected = array( 'aibody' => 'body', 'aiheader' => 'header' );
59
60
		$this->object->expects( $this->once() )->method( 'get' )
61
			->will( $this->returnValue( $expected ) );
62
63
		$this->view->expects( $this->once() )->method( 'assignMultiple' )
64
			->with( $this->equalTo( $expected ) );
65
66
		$this->response->expects( $this->once() )->method( 'setHeader' );
67
68
		$this->object->confirmAction();
69
	}
70
71
72
	/**
73
	 * @test
74
	 */
75
	public function updateAction()
76
	{
77
		$expected = array( 'aibody' => 'body', 'aiheader' => 'header' );
78
79
		$this->object->expects( $this->once() )->method( 'get' )
80
			->will( $this->returnValue( $expected ) );
81
82
		$this->view->expects( $this->once() )->method( 'assignMultiple' )
83
			->with( $this->equalTo( $expected ) );
84
85
		$this->response->expects( $this->once() )->method( 'setHeader' );
86
87
		$this->object->updateAction();
88
	}
89
90
91
	/**
92
	 * @test
93
	 */
94
	public function confirmComponentAction()
95
	{
96
		$this->object->expects( $this->once() )->method( 'getOutput' )
97
			->will( $this->returnValue( 'body' ) );
98
99
		$this->view->expects( $this->once() )->method( 'assign' )
100
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
101
102
		$this->response->expects( $this->once() )->method( 'setHeader' );
103
104
		$this->object->confirmComponentAction();
105
	}
106
107
108
	/**
109
	 * @test
110
	 */
111
	public function standardComponentAction()
112
	{
113
		$this->object->expects( $this->once() )->method( 'getOutput' )
114
			->will( $this->returnValue( 'body' ) );
115
116
		$this->view->expects( $this->once() )->method( 'assign' )
117
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
118
119
		$this->response->expects( $this->once() )->method( 'setHeader' );
120
121
		$this->object->standardComponentAction();
122
	}
123
124
125
	/**
126
	 * @test
127
	 */
128
	public function updateComponentAction()
129
	{
130
		$this->object->expects( $this->once() )->method( 'getOutput' )
131
			->will( $this->returnValue( 'body' ) );
132
133
		$this->view->expects( $this->once() )->method( 'assign' )
134
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
135
136
		$this->response->expects( $this->once() )->method( 'setHeader' );
137
138
		$this->object->updateComponentAction();
139
	}
140
}