Issues (43)

Tests/Unit/Base/ViewTest.php (1 issue)

Labels
Severity
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Base;
5
6
7
class ViewTest 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
11
12
	public function setUp()
13
	{
14
		$i18n = new \Aimeos\Shop\Base\I18n();
15
		$aimeos = new \Aimeos\Shop\Base\Aimeos();
16
		$view = new \Neos\FluidAdaptor\View\StandaloneView();
17
		$security = new \Neos\Flow\Security\DummyContext();
18
19
		$this->object = new \Aimeos\Shop\Base\View();
20
21
		$this->inject( $i18n, 'aimeos', $aimeos );
22
		$this->inject( $this->object, 'i18n', $i18n );
23
		$this->inject( $this->object, 'view', $view );
24
		$this->inject( $this->object, 'security', $security );
25
	}
26
27
28
	/**
29
	 * @test
30
	 */
31
	public function create()
32
	{
33
		$context = new \Aimeos\MShop\Context\Item\Standard();
34
		$context->setConfig( new \Aimeos\MW\Config\PHPArray() );
35
		$context->setSession( new \Aimeos\MW\Session\None() );
36
37
		$uriBuilder = $this->getMockBuilder('\Neos\Flow\Mvc\Routing\UriBuilder')
38
			->disableOriginalConstructor()
39
			->getMock();
40
41
		$view = $this->object->create( $context, $uriBuilder, array() );
42
43
		$this->assertInstanceOf( '\Aimeos\MW\View\Iface', $view );
44
	}
45
46
47
	/**
48
	 * @test
49
	 */
50
	public function createWithRequest()
51
	{
52
		$context = new \Aimeos\MShop\Context\Item\Standard();
53
		$context->setConfig( new \Aimeos\MW\Config\PHPArray() );
54
		$context->setSession( new \Aimeos\MW\Session\None() );
55
56
		$uriBuilder = $this->getMockBuilder( '\Neos\Flow\Mvc\Routing\UriBuilder' )
57
			->disableOriginalConstructor()
58
			->getMock();
59
60
		$httpRequest = new \Neos\Flow\Http\Request( array(), array(), array(), array() );
61
62
		$request = $this->getMockBuilder( '\Neos\Flow\Mvc\ActionRequest' )
63
			->setMethods( array( 'getArguments', 'getControllerActionName', 'getHttpRequest' ) )
64
			->disableOriginalConstructor()
65
			->getMock();
66
67
		$request->expects( $this->exactly( 2 ) )->method( 'getArguments' )
68
			->will( $this->returnValue( array( 'site' => 'unittest', 'locale' => 'de', 'currency' => 'EUR' ) ) );
69
70
		$request->expects( $this->once() )->method( 'getControllerActionName' )
71
			->will( $this->returnValue( 'list' ) );
72
73
		$request->expects( $this->once() )->method( 'getHttpRequest' )
74
			->will( $this->returnValue( $httpRequest ) );
75
76
		$view = $this->object->create( $context, $uriBuilder, array(), $request, 'de' );
77
78
		$this->assertInstanceOf( '\Aimeos\MW\View\Iface', $view );
79
	}
80
}