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
|
|
|
class FlowTest extends \PHPUnit\Framework\TestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $buildMock; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() |
19
|
|
|
{ |
20
|
|
|
if( !class_exists( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder' ) ) { |
21
|
|
|
$this->markTestSkipped( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder is not available' ); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
$view = new \Aimeos\MW\View\Standard(); |
25
|
|
|
|
26
|
|
|
$this->buildMock = $this->getMockbuilder( '\\Neos\\Flow\\Mvc\\Routing\\UriBuilder' ) |
27
|
|
|
->setMethods( array( 'uriFor' ) ) |
28
|
|
|
->disableOriginalConstructor() |
29
|
|
|
->getMock(); |
30
|
|
|
|
31
|
|
|
$this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $this->buildMock, array( 'site' => 'unittest' ) ); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
protected function tearDown() |
36
|
|
|
{ |
37
|
|
|
$this->object = null; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
public function testTransform() |
42
|
|
|
{ |
43
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
44
|
|
|
->will( $this->returnValue( '/shop/catalog/lists') ); |
45
|
|
|
|
46
|
|
|
$this->assertEquals( '/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
public function testTransformSlashes() |
51
|
|
|
{ |
52
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
53
|
|
|
->will( $this->returnValue( '/shop/catalog/lists?test=a%2Fb') ); |
54
|
|
|
|
55
|
|
|
$this->assertEquals( '/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
public function testTransformArrays() |
60
|
|
|
{ |
61
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
62
|
|
|
->will( $this->returnValue( '/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
63
|
|
|
|
64
|
|
|
$this->assertEquals( '/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => array( 'a', 'b' ) ) ) ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
public function testTransformTrailing() |
69
|
|
|
{ |
70
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
71
|
|
|
->will( $this->returnValue( '/shop/catalog/lists#a/b') ); |
72
|
|
|
|
73
|
|
|
$this->assertEquals( '/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', [], array( 'a', 'b' ) ) ); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
public function testTransformAbsolute() |
78
|
|
|
{ |
79
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
80
|
|
|
->will( $this->returnValue( 'http://localhost/shop/catalog/lists') ); |
81
|
|
|
|
82
|
|
|
$options = array( 'absoluteUri' => true ); |
83
|
|
|
$result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options ); |
84
|
|
|
|
85
|
|
|
$this->assertEquals( 'http://localhost/shop/catalog/lists', $result ); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
|
89
|
|
|
public function testTransformConfig() |
90
|
|
|
{ |
91
|
|
|
$this->buildMock->expects( $this->once() )->method( 'uriFor' ) |
92
|
|
|
->will( $this->returnValue( '/shop/catalog/lists') ); |
93
|
|
|
|
94
|
|
|
$options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' ); |
95
|
|
|
$result = $this->object->transform( 'shop', 'catalog', 'lists', [], [], $options ); |
96
|
|
|
|
97
|
|
|
$this->assertEquals( '/shop/catalog/lists', $result ); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths