1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2021 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\Controller\Frontend\Cms; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $context; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() : void |
19
|
|
|
{ |
20
|
|
|
$this->context = \TestHelperFrontend::getContext(); |
21
|
|
|
$this->context->getLocale()->setLanguageId( 'en' ); |
22
|
|
|
|
23
|
|
|
$this->object = new \Aimeos\Controller\Frontend\Cms\Standard( $this->context ); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
protected function tearDown() : void |
28
|
|
|
{ |
29
|
|
|
unset( $this->object, $this->context ); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
public function testCompare() |
34
|
|
|
{ |
35
|
|
|
$this->assertEquals( 1, count( $this->object->compare( '=~', 'cms.label', 'Con' )->search() ) ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function testFind() |
40
|
|
|
{ |
41
|
|
|
$item = $this->object->uses( ['text'] )->find( '/contact' ); |
42
|
|
|
|
43
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $item ); |
44
|
|
|
$this->assertEquals( 3, count( $item->getRefItems( 'text' ) ) ); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
public function testFunction() |
49
|
|
|
{ |
50
|
|
|
$str = $this->object->function( 'cms:has', ['domain', 'type', 'refid'] ); |
51
|
|
|
$this->assertEquals( 'cms:has("domain","type","refid")', $str ); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
public function testGet() |
56
|
|
|
{ |
57
|
|
|
$item = \Aimeos\MShop::create( $this->context, 'cms' )->find( '/contact' ); |
|
|
|
|
58
|
|
|
$item = $this->object->uses( ['text'] )->get( $item->getId() ); |
59
|
|
|
|
60
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Cms\Item\Iface::class, $item ); |
61
|
|
|
$this->assertEquals( 3, count( $item->getRefItems( 'text' ) ) ); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
public function testHas() |
66
|
|
|
{ |
67
|
|
|
$manager = \Aimeos\MShop::create( $this->context, 'text' ); |
68
|
|
|
$textId = $manager->search( $manager->filter()->add( ['text.domain' => 'cms'] ) )->firstKey(); |
69
|
|
|
|
70
|
|
|
$this->assertEquals( 1, count( $this->object->has( 'text', 'default', $textId )->search() ) ); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
public function testParse() |
75
|
|
|
{ |
76
|
|
|
$cond = ['&&' => [['==' => ['cms.status' => 1]], ['=~' => ['cms.label' => 'Con']]]]; |
77
|
|
|
$this->assertEquals( 1, count( $this->object->parse( $cond )->search() ) ); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
public function testSearch() |
82
|
|
|
{ |
83
|
|
|
$total = 0; |
84
|
|
|
$items = $this->object->uses( ['text'] )->compare( '=~', 'cms.url', '/con' ) |
85
|
|
|
->sort( 'cms.url' )->search( $total ); |
86
|
|
|
|
87
|
|
|
$this->assertEquals( 1, count( $items ) ); |
88
|
|
|
$this->assertEquals( 1, $total ); |
89
|
|
|
$this->assertEquals( 3, count( $items->first()->getRefItems( 'text' ) ) ); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
public function testSlice() |
94
|
|
|
{ |
95
|
|
|
$this->assertEquals( 1, count( $this->object->slice( 0, 1 )->search() ) ); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
public function testSort() |
100
|
|
|
{ |
101
|
|
|
$this->assertGreaterThanOrEqual( 1, count( $this->object->sort()->search() ) ); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
public function testSortGeneric() |
106
|
|
|
{ |
107
|
|
|
$this->assertGreaterThanOrEqual( 1, count( $this->object->sort( 'cms.label' )->search() ) ); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
|
111
|
|
|
public function testSortMultiple() |
112
|
|
|
{ |
113
|
|
|
$this->assertGreaterThanOrEqual( 1, count( $this->object->sort( 'cms.label,-cms.id' )->search() ) ); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
public function testUses() |
118
|
|
|
{ |
119
|
|
|
$this->assertSame( $this->object, $this->object->uses( ['text'] ) ); |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|
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