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

Laravel5Test::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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