Issues (12)

lib/custom/tests/MW/View/Helper/Url/Zend2Test.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2014-2018
6
 */
7
8
9
namespace Aimeos\MW\View\Helper\Url;
10
11
12
/**
13
 * Test class for \Aimeos\MW\View\Helper\Url\Zend2.
14
 */
15
class Zend2Test extends \PHPUnit\Framework\TestCase
0 ignored issues
show
The type PHPUnit\Framework\TestCase 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...
16
{
17
	private $object;
18
	private $router;
19
20
21
	/**
22
	 * Sets up the fixture, for example, opens a network connection.
23
	 * This method is called before a test is executed.
24
	 *
25
	 * @access protected
26
	 */
27
	protected function setUp()
28
	{
29
		if( !class_exists( '\Zend\Mvc\Router\Http\Wildcard' ) ) {
30
			$this->markTestSkipped( '\Zend\Mvc\Router\Http\Wildcard is not available' );
31
		}
32
33
		$view = new \Aimeos\MW\View\Standard();
34
		$this->router = $this->getMockBuilder( '\Zend\Mvc\Router\Http\Wildcard' )->getMock();
35
36
		$this->object = new \Aimeos\MW\View\Helper\Url\Zend2( $view, $this->router, 'https://localhost:80' );
37
	}
38
39
40
	/**
41
	 * Tears down the fixture, for example, closes a network connection.
42
	 * This method is called after a test is executed.
43
	 *
44
	 * @access protected
45
	 */
46
	protected function tearDown()
47
	{
48
		$this->object = null;
49
		$this->router = null;
50
	}
51
52
53
	public function testTransform()
54
	{
55
		$this->router->expects( $this->once() )->method( 'assemble' )
56
			->will( $this->returnValue( 'testurl' ) );
57
58
		$this->assertEquals( 'testurl', $this->object->transform() );
59
	}
60
61
62
	public function testTransformSlashes()
63
	{
64
		$this->router->expects( $this->once() )->method( 'assemble' )
65
			->will( $this->returnValue( 'testurl' ) );
66
67
		$this->assertEquals( 'testurl', $this->object->transform( null, null, null, array( 'test' => 'a/b' ) ) );
68
	}
69
70
71
	public function testTransformArrays()
72
	{
73
		$this->router->expects( $this->once() )->method( 'assemble' )
74
			->will( $this->returnValue( 'testurl' ) );
75
76
		$this->assertEquals( 'testurl', $this->object->transform( null, null, null, array( 'test' => array( 'a', 'b' ) ) ) );
77
	}
78
79
80
	public function testTransformTrailing()
81
	{
82
		$this->router->expects( $this->once() )->method( 'assemble' )
83
			->will( $this->returnValue( 'testurl' ) );
84
85
		$this->assertEquals( 'testurl', $this->object->transform( null, null, null, [], array( 'a', 'b' ) ) );
86
	}
87
88
89
	public function testTransformAbsolute()
90
	{
91
		$this->router->expects( $this->once() )->method( 'assemble' )
92
			->will( $this->returnValue( '/testurl' ) );
93
94
		$options = array( 'absoluteUri' => true );
95
		$result = $this->object->transform( null, null, null, [], [], $options );
96
		$this->assertEquals( 'https://localhost:80/testurl', $result );
97
	}
98
}
99