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
|
|
|
|