Issues (43)

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

Labels
Severity
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Controller;
5
6
7
class BasketControllerTest 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\BasketController' )
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 miniComponentAction()
57
	{
58
		$this->object->expects( $this->once() )->method( 'getOutput' )
59
			->will( $this->returnValue( 'body' ) );
60
61
		$this->view->expects( $this->once() )->method( 'assign' )
62
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
63
64
		$this->response->expects( $this->once() )->method( 'setHeader' );
65
66
		$this->object->miniComponentAction();
67
	}
68
69
70
	/**
71
	 * @test
72
	 */
73
	public function relatedComponentAction()
74
	{
75
		$this->object->expects( $this->once() )->method( 'getOutput' )
76
			->will( $this->returnValue( 'body' ) );
77
78
		$this->view->expects( $this->once() )->method( 'assign' )
79
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
80
81
		$this->response->expects( $this->once() )->method( 'setHeader' );
82
83
		$this->object->relatedComponentAction();
84
	}
85
86
87
	/**
88
	 * @test
89
	 */
90
	public function standardComponentAction()
91
	{
92
		$this->object->expects( $this->once() )->method( 'getOutput' )
93
			->will( $this->returnValue( 'body' ) );
94
95
		$this->view->expects( $this->once() )->method( 'assign' )
96
			->with( $this->equalTo( 'output' ), $this->equalTo( 'body' ) );
97
98
		$this->response->expects( $this->once() )->method( 'setHeader' );
99
100
		$this->object->standardComponentAction();
101
	}
102
}