Passed
Push — master ( bfeba0...b198de )
by Aimeos
06:28 queued 03:22
created

Laravel5Test   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
dl 0
loc 42
rs 10
c 1
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testTransformAbsolute() 0 7 1
A setUp() 0 11 2
A tearDown() 0 3 1
A testTransform() 0 6 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2022
6
 */
7
8
9
namespace Aimeos\Base\View\Helper\Url;
10
11
12
class Laravel5Test extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
	private $mock;
16
17
18
	protected function setUp() : void
19
	{
20
		if( !class_exists( '\\Illuminate\\Routing\\UrlGenerator' ) ) {
21
			$this->markTestSkipped( '\\Illuminate\\Routing\\UrlGenerator is not available' );
22
		}
23
24
		$view = new \Aimeos\Base\View\Standard();
25
		$this->mock = $this->getMockBuilder( '\\Illuminate\\Routing\\UrlGenerator' )
26
			->disableOriginalConstructor()->getMock();
27
28
		$this->object = new \Aimeos\Base\View\Helper\Url\Laravel5( $view, $this->mock, [] );
29
	}
30
31
32
	protected function tearDown() : void
33
	{
34
		unset( $this->object, $this->mock );
35
	}
36
37
38
	public function testTransform()
39
	{
40
		$this->mock->expects( $this->once() )->method( 'route' )
41
			->with( $this->equalTo( 'route' ), $this->equalTo( array( 'key' => 'value' ) ), $this->equalTo( false ) );
42
43
		$this->object->transform( 'route', 'catalog', 'lists', array( 'key' => 'value' ) );
44
	}
45
46
47
	public function testTransformAbsolute()
48
	{
49
		$this->mock->expects( $this->once() )->method( 'route' )
50
			->with( $this->equalTo( 'route' ), $this->equalTo( [] ), $this->equalTo( true ) );
51
52
		$options = array( 'absoluteUri' => true );
53
		$this->object->transform( 'route', 'catalog', 'lists', [], [], $options );
54
	}
55
}
56