Issues (43)

Tests/Unit/Base/PageTest.php (2 issues)

Labels
Severity
1
<?php
2
3
4
namespace Aimeos\Shop\Tests\Unit\Base;
5
6
7
class ShopTest 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
		$this->object = new \Aimeos\Shop\Base\Shop();
15
16
		$aimeos = new \Aimeos\Shop\Base\Aimeos();
17
18
		$uriBuilder = $this->getMockBuilder( '\Neos\Flow\Mvc\Routing\UriBuilder' )
19
			->disableOriginalConstructor()
20
			->getMock();
21
22
		$this->inject( $this->object, 'aimeos', $aimeos );
23
		$this->inject( $this->object, 'uriBuilder', $uriBuilder );
24
	}
25
26
27
	/**
28
	 * @test
29
	 */
30
	public function get()
31
	{
32
		$view = $this->getMockBuilder( '\Aimeos\Shop\Base\View' )
33
			->setMethods( array( 'create' ) )
34
			->disableOriginalConstructor()
35
			->getMock();
36
37
		$mwView = new \Aimeos\MW\View\Standard();
38
39
		$view->expects( $this->once() )->method( 'create' )
40
			->will( $this->returnValue( $mwView ) );
41
42
		$this->inject( $this->object, 'view', $view );
43
44
45
		$context = $this->getMockBuilder( '\Aimeos\Shop\Base\Context' )
46
			->setMethods( array( 'get' ) )
47
			->disableOriginalConstructor()
48
			->getMock();
49
50
		$ctx = new \Aimeos\MShop\Context\Item\Standard();
51
		$ctx->setConfig( new \Aimeos\MW\Config\PHPArray() );
52
		$ctx->setLocale( new \Aimeos\MShop\Locale\Item\Standard( array( 'langid' => 'de' ) ) );
53
54
		$context->expects( $this->once() )->method( 'get' )
55
			->will( $this->returnValue( $ctx ) );
56
57
		$this->inject( $this->object, 'context', $context );
58
59
60
		$settings = array(
61
			'flow' => array( 'cache' => array( 'name' => 'None' ) ),
62
			'page' => array(),
63
		);
64
		$this->inject( $this->object, 'settings', $settings );
65
66
67
		$request = $this->getMockBuilder( '\Neos\Flow\Mvc\ActionRequest' )
68
			->setMethods( array( 'getArguments' ) )
69
			->disableOriginalConstructor()
70
			->getMock();
71
72
73
		$result = $this->object->get( $request, 'catalog/list' );
74
75
		$this->assertInternalType( 'array', $result );
76
		$this->assertArrayHasKey( 'aibody', $result );
77
		$this->assertArrayHasKey( 'aiheader', $result );
78
	}
79
80
81
	/**
82
	 * @test
83
	 */
84
	public function injectSettings()
85
	{
86
		$this->object->injectSettings( array( 'test' ) );
87
88
		$this->assertEquals( array( 'test' ), \PHPUnit\Framework\Assert::readAttribute( $this->object, 'settings' ) );
0 ignored issues
show
The type PHPUnit\Framework\Assert 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...
89
	}
90
}