@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * @param string $name Name of the manager |
26 | 26 | * @return \Aimeos\MShop\Common\Manager\Iface Manager object |
27 | 27 | */ |
28 | - public function createManager( $name ) |
|
28 | + public function createManager($name) |
|
29 | 29 | { |
30 | - return $this->getController()->createManager( $name ); |
|
30 | + return $this->getController()->createManager($name); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
53 | 53 | * @since 2015.08 |
54 | 54 | */ |
55 | - public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) ) |
|
55 | + public function getCatalogPath($id, array $domains = array('text', 'media')) |
|
56 | 56 | { |
57 | - return $this->getController()->getCatalogPath( $id, $domains ); |
|
57 | + return $this->getController()->getCatalogPath($id, $domains); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
70 | 70 | * @since 2015.08 |
71 | 71 | */ |
72 | - public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ), |
|
73 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
72 | + public function getCatalogTree($id = null, array $domains = array('text', 'media'), |
|
73 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
74 | 74 | { |
75 | - return $this->getController()->getCatalogTree( $id, $domains, $level, $search ); |
|
75 | + return $this->getController()->getCatalogTree($id, $domains, $level, $search); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @return array Associative list of key values as key and the product count for this key as value |
85 | 85 | * @since 2015.08 |
86 | 86 | */ |
87 | - public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
87 | + public function aggregateIndex(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
88 | 88 | { |
89 | - return $this->getController()->aggregateIndex( $filter, $key ); |
|
89 | + return $this->getController()->aggregateIndex($filter, $key); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
99 | 99 | * @since 2015.08 |
100 | 100 | */ |
101 | - public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid ) |
|
101 | + public function addIndexFilterCategory(\Aimeos\MW\Criteria\Iface $search, $catid) |
|
102 | 102 | { |
103 | - return $this->getController()->addIndexFilterCategory( $search, $catid ); |
|
103 | + return $this->getController()->addIndexFilterCategory($search, $catid); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
114 | 114 | * @since 2015.08 |
115 | 115 | */ |
116 | - public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' ) |
|
116 | + public function addIndexFilterText(\Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default') |
|
117 | 117 | { |
118 | - return $this->getController()->addIndexFilterText( $search, $input, $listtype ); |
|
118 | + return $this->getController()->addIndexFilterText($search, $input, $listtype); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
131 | 131 | * @since 2015.08 |
132 | 132 | */ |
133 | - public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
133 | + public function createIndexFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
134 | 134 | { |
135 | - return $this->getController()->createIndexFilter( $sort, $direction, $start, $size, $listtype ); |
|
135 | + return $this->getController()->createIndexFilter($sort, $direction, $start, $size, $listtype); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
149 | 149 | * @since 2015.08 |
150 | 150 | */ |
151 | - public function createIndexFilterCategory( $catid, $sort = 'position', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default' ) |
|
151 | + public function createIndexFilterCategory($catid, $sort = 'position', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default') |
|
152 | 152 | { |
153 | - return $this->getController()->createIndexFilter( $catid, $sort, $direction, $start, $size, $listtype ); |
|
153 | + return $this->getController()->createIndexFilter($catid, $sort, $direction, $start, $size, $listtype); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
167 | 167 | * @since 2015.08 |
168 | 168 | */ |
169 | - public function createIndexFilterText( $input, $sort = 'relevance', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default' ) |
|
169 | + public function createIndexFilterText($input, $sort = 'relevance', $direction = 'asc', $start = 0, $size = 100, $listtype = 'default') |
|
170 | 170 | { |
171 | - return $this->getController()->createIndexFilter( $input, $sort, $direction, $start, $size, $listtype ); |
|
171 | + return $this->getController()->createIndexFilter($input, $sort, $direction, $start, $size, $listtype); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
182 | 182 | * @since 2015.08 |
183 | 183 | */ |
184 | - public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
184 | + public function getIndexItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
185 | 185 | { |
186 | - return $this->getController()->getIndexItems( $filter, $domains, $total ); |
|
186 | + return $this->getController()->getIndexItems($filter, $domains, $total); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | * @return array List of product items implementing \Aimeos\MShop\Product\Item\Iface |
196 | 196 | * @since 2015.08 |
197 | 197 | */ |
198 | - public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
198 | + public function getProductItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
199 | 199 | { |
200 | - return $this->getController()->getProductItems( $ids, $domains ); |
|
200 | + return $this->getController()->getProductItems($ids, $domains); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | * @param string $type Type of the text like "name", "short", "long", etc. |
214 | 214 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
215 | 215 | */ |
216 | - public function createTextFilter( $input, $sort = null, $direction = 'desc', $start = 0, $size = 25, $listtype = 'default', $type = 'name' ) |
|
216 | + public function createTextFilter($input, $sort = null, $direction = 'desc', $start = 0, $size = 25, $listtype = 'default', $type = 'name') |
|
217 | 217 | { |
218 | - return $this->getController()->createTextFilter( $input, $sort, $direction, $start, $size, $listtype, $type ); |
|
218 | + return $this->getController()->createTextFilter($input, $sort, $direction, $start, $size, $listtype, $type); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
226 | 226 | * @return array Associative list of the product ID as key and the product text as value |
227 | 227 | */ |
228 | - public function getTextList( \Aimeos\MW\Criteria\Iface $filter ) |
|
228 | + public function getTextList(\Aimeos\MW\Criteria\Iface $filter) |
|
229 | 229 | { |
230 | - return $this->getController()->getTextList( $filter ); |
|
230 | + return $this->getController()->getTextList($filter); |
|
231 | 231 | } |
232 | 232 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
28 | 28 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
29 | 29 | */ |
30 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
31 | - $ref = array( 'media', 'price', 'text' ) ) |
|
30 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
31 | + $ref = array('media', 'price', 'text')) |
|
32 | 32 | { |
33 | - return $this->getController()->getServices( $type, $basket, $ref ); |
|
33 | + return $this->getController()->getServices($type, $basket, $ref); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
44 | 44 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
45 | 45 | */ |
46 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
46 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
47 | 47 | { |
48 | - return $this->getController()->getServiceAttributes( $type, $serviceId, $basket ); |
|
48 | + return $this->getController()->getServiceAttributes($type, $serviceId, $basket); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
61 | 61 | * @throws \Exception If an error occurs |
62 | 62 | */ |
63 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
63 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
64 | 64 | { |
65 | - return $this->getController()->getServicePrice( $type, $serviceId, $basket ); |
|
65 | + return $this->getController()->getServicePrice($type, $serviceId, $basket); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
77 | 77 | * missing |
78 | 78 | */ |
79 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
79 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
80 | 80 | { |
81 | - return $this->getController()->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
81 | + return $this->getController()->checkServiceAttributes($type, $serviceId, $attributes); |
|
82 | 82 | } |
83 | 83 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored |
30 | 30 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
31 | 31 | */ |
32 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
32 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
33 | 33 | { |
34 | - return $this->getController()->store( $basket ); |
|
34 | + return $this->getController()->store($basket); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
55 | 55 | * @return void |
56 | 56 | */ |
57 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
57 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
58 | 58 | { |
59 | - $this->getController()->block( $orderItem ); |
|
59 | + $this->getController()->block($orderItem); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
80 | 80 | * @return void |
81 | 81 | */ |
82 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
82 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
83 | 83 | { |
84 | - $this->getController()->unblock( $orderItem ); |
|
84 | + $this->getController()->unblock($orderItem); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
103 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
104 | 104 | { |
105 | - $this->getController()->update( $orderItem ); |
|
105 | + $this->getController()->update($orderItem); |
|
106 | 106 | } |
107 | 107 | } |
@@ -15,63 +15,63 @@ discard block |
||
15 | 15 | |
16 | 16 | protected function setUp() |
17 | 17 | { |
18 | - $this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( \TestHelperFrontend::getContext() ); |
|
18 | + $this->object = new \Aimeos\Controller\Frontend\Catalog\Standard(\TestHelperFrontend::getContext()); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | 22 | protected function tearDown() |
23 | 23 | { |
24 | - unset( $this->object ); |
|
24 | + unset($this->object); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | public function testCreateManager() |
29 | 29 | { |
30 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager( 'product' ) ); |
|
30 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager('product')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | public function testCreateCatalogFilter() |
35 | 35 | { |
36 | - $filter = $this->object->createCatalogFilter( true ); |
|
36 | + $filter = $this->object->createCatalogFilter(true); |
|
37 | 37 | |
38 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
39 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions() ); |
|
40 | - $this->assertEquals( 'catalog.status', $filter->getConditions()->getName() ); |
|
38 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
39 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions()); |
|
40 | + $this->assertEquals('catalog.status', $filter->getConditions()->getName()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetCatalogPath() |
45 | 45 | { |
46 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
47 | - $item = $manager->getTree( null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST ); |
|
46 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
47 | + $item = $manager->getTree(null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST); |
|
48 | 48 | |
49 | 49 | $list = array(); |
50 | - foreach( $this->object->getCatalogPath( $item->getChild( 0 )->getId(), array( 'text' ) ) as $item ) { |
|
50 | + foreach ($this->object->getCatalogPath($item->getChild(0)->getId(), array('text')) as $item) { |
|
51 | 51 | $list[$item->getCode()] = $item; |
52 | 52 | } |
53 | 53 | |
54 | - $this->assertEquals( 2, count( $list ) ); |
|
55 | - $this->assertArrayHasKey( 'root', $list ); |
|
56 | - $this->assertArrayHasKey( 'categories', $list ); |
|
54 | + $this->assertEquals(2, count($list)); |
|
55 | + $this->assertArrayHasKey('root', $list); |
|
56 | + $this->assertArrayHasKey('categories', $list); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testGetCatalogTree() |
61 | 61 | { |
62 | - $item = $this->object->getCatalogTree( null, array( 'text' ), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
|
62 | + $item = $this->object->getCatalogTree(null, array('text'), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE); |
|
63 | 63 | |
64 | - $this->assertEquals( 'Root', $item->getName() ); |
|
65 | - $this->assertEquals( 0, count( $item->getChildren() ) ); |
|
64 | + $this->assertEquals('Root', $item->getName()); |
|
65 | + $this->assertEquals(0, count($item->getChildren())); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testAggregateIndex() |
70 | 70 | { |
71 | 71 | $filter = $this->object->createIndexFilter(); |
72 | - $list = $this->object->aggregateIndex( $filter, 'index.attribute.id' ); |
|
72 | + $list = $this->object->aggregateIndex($filter, 'index.attribute.id'); |
|
73 | 73 | |
74 | - $this->assertGreaterThan( 0, count( $list ) ); |
|
74 | + $this->assertGreaterThan(0, count($list)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -79,279 +79,279 @@ discard block |
||
79 | 79 | { |
80 | 80 | $filter = $this->object->createIndexFilter(); |
81 | 81 | |
82 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
83 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
84 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
85 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
82 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
83 | + $this->assertEquals(array(), $filter->getSortations()); |
|
84 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
85 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testCreateIndexFilterCategory() |
90 | 90 | { |
91 | - $filter = $this->object->createIndexFilterCategory( 0 ); |
|
91 | + $filter = $this->object->createIndexFilterCategory(0); |
|
92 | 92 | |
93 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
93 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
94 | 94 | |
95 | 95 | $list = $filter->getConditions()->getExpressions(); |
96 | 96 | |
97 | 97 | |
98 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
99 | - throw new \Exception( 'Wrong expression' ); |
|
98 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
99 | + throw new \Exception('Wrong expression'); |
|
100 | 100 | } |
101 | - $this->assertEquals( 'index.catalog.id', $list[0]->getName() ); |
|
102 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
101 | + $this->assertEquals('index.catalog.id', $list[0]->getName()); |
|
102 | + $this->assertEquals(0, $list[0]->getValue()); |
|
103 | 103 | |
104 | 104 | |
105 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
106 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
107 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
105 | + $this->assertEquals(array(), $filter->getSortations()); |
|
106 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
107 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | public function testCreateIndexFilterCategoryPosition() |
112 | 112 | { |
113 | - $filter = $this->object->createIndexFilterCategory( 0, 'relevance', '-', 1, 2, 'test' ); |
|
113 | + $filter = $this->object->createIndexFilterCategory(0, 'relevance', '-', 1, 2, 'test'); |
|
114 | 114 | |
115 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
115 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
116 | 116 | |
117 | 117 | $sort = $filter->getSortations(); |
118 | - if( ( $item = reset( $sort ) ) === false ) { |
|
119 | - throw new \Exception( 'Sortation not set' ); |
|
118 | + if (($item = reset($sort)) === false) { |
|
119 | + throw new \Exception('Sortation not set'); |
|
120 | 120 | } |
121 | 121 | |
122 | - $this->assertEquals( 'sort:index.catalog.position("test",0)', $item->getName() ); |
|
123 | - $this->assertEquals( '-', $item->getOperator() ); |
|
122 | + $this->assertEquals('sort:index.catalog.position("test",0)', $item->getName()); |
|
123 | + $this->assertEquals('-', $item->getOperator()); |
|
124 | 124 | |
125 | - $this->assertEquals( 1, $filter->getSliceStart() ); |
|
126 | - $this->assertEquals( 2, $filter->getSliceSize() ); |
|
125 | + $this->assertEquals(1, $filter->getSliceStart()); |
|
126 | + $this->assertEquals(2, $filter->getSliceSize()); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
130 | 130 | public function testCreateIndexFilterCategoryCode() |
131 | 131 | { |
132 | - $filter = $this->object->createIndexFilterCategory( 0, 'code' ); |
|
132 | + $filter = $this->object->createIndexFilterCategory(0, 'code'); |
|
133 | 133 | |
134 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
134 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
135 | 135 | |
136 | 136 | $sort = $filter->getSortations(); |
137 | - if( ( $item = reset( $sort ) ) === false ) { |
|
138 | - throw new \Exception( 'Sortation not set' ); |
|
137 | + if (($item = reset($sort)) === false) { |
|
138 | + throw new \Exception('Sortation not set'); |
|
139 | 139 | } |
140 | 140 | |
141 | - $this->assertStringStartsWith( 'product.code', $item->getName() ); |
|
141 | + $this->assertStringStartsWith('product.code', $item->getName()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | 145 | public function testCreateIndexFilterCategoryName() |
146 | 146 | { |
147 | - $filter = $this->object->createIndexFilterCategory( 0, 'name' ); |
|
147 | + $filter = $this->object->createIndexFilterCategory(0, 'name'); |
|
148 | 148 | |
149 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
149 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
150 | 150 | |
151 | 151 | $sort = $filter->getSortations(); |
152 | - if( ( $item = reset( $sort ) ) === false ) { |
|
153 | - throw new \Exception( 'Sortation not set' ); |
|
152 | + if (($item = reset($sort)) === false) { |
|
153 | + throw new \Exception('Sortation not set'); |
|
154 | 154 | } |
155 | 155 | |
156 | - $this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() ); |
|
156 | + $this->assertEquals('sort:index.text.value("default","de","name")', $item->getName()); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
160 | 160 | public function testCreateIndexFilterCategoryPrice() |
161 | 161 | { |
162 | - $filter = $this->object->createIndexFilterCategory( 0, 'price' ); |
|
162 | + $filter = $this->object->createIndexFilterCategory(0, 'price'); |
|
163 | 163 | |
164 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
164 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
165 | 165 | |
166 | 166 | $sort = $filter->getSortations(); |
167 | - if( ( $item = reset( $sort ) ) === false ) { |
|
168 | - throw new \Exception( 'Sortation not set' ); |
|
167 | + if (($item = reset($sort)) === false) { |
|
168 | + throw new \Exception('Sortation not set'); |
|
169 | 169 | } |
170 | 170 | |
171 | - $this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() ); |
|
171 | + $this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName()); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
175 | 175 | public function testCreateIndexFilterCategoryInvalidSortation() |
176 | 176 | { |
177 | - $filter = $this->object->createIndexFilterCategory( 0, 'failure' ); |
|
177 | + $filter = $this->object->createIndexFilterCategory(0, 'failure'); |
|
178 | 178 | |
179 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
180 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
179 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
180 | + $this->assertEquals(array(), $filter->getSortations()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testAddIndexFilterCategory() |
185 | 185 | { |
186 | 186 | $filter = $this->object->createIndexFilter(); |
187 | - $filter = $this->object->addIndexFilterCategory( $filter, 0 ); |
|
187 | + $filter = $this->object->addIndexFilterCategory($filter, 0); |
|
188 | 188 | |
189 | 189 | $list = $filter->getConditions()->getExpressions(); |
190 | 190 | |
191 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
192 | - throw new \Exception( 'Wrong expression' ); |
|
191 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
192 | + throw new \Exception('Wrong expression'); |
|
193 | 193 | } |
194 | 194 | |
195 | - $this->assertEquals( 'index.catalog.id', $list[0]->getName() ); |
|
196 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
197 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
195 | + $this->assertEquals('index.catalog.id', $list[0]->getName()); |
|
196 | + $this->assertEquals(0, $list[0]->getValue()); |
|
197 | + $this->assertEquals(array(), $filter->getSortations()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
201 | 201 | public function testCreateIndexFilterText() |
202 | 202 | { |
203 | - $filter = $this->object->createIndexFilterText( 'Espresso' ); |
|
203 | + $filter = $this->object->createIndexFilterText('Espresso'); |
|
204 | 204 | |
205 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
205 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
206 | 206 | |
207 | 207 | $list = $filter->getConditions()->getExpressions(); |
208 | 208 | |
209 | 209 | |
210 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
211 | - throw new \Exception( 'Wrong expression' ); |
|
210 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
211 | + throw new \Exception('Wrong expression'); |
|
212 | 212 | } |
213 | - $this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() ); |
|
214 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
213 | + $this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName()); |
|
214 | + $this->assertEquals(0, $list[0]->getValue()); |
|
215 | 215 | |
216 | 216 | |
217 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
218 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
219 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
217 | + $this->assertEquals(array(), $filter->getSortations()); |
|
218 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
219 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
223 | 223 | public function testCreateIndexFilterTextRelevance() |
224 | 224 | { |
225 | - $filter = $this->object->createIndexFilterText( 'Espresso', 'relevance', '-', 1, 2, 'test' ); |
|
225 | + $filter = $this->object->createIndexFilterText('Espresso', 'relevance', '-', 1, 2, 'test'); |
|
226 | 226 | |
227 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
228 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
229 | - $this->assertEquals( 1, $filter->getSliceStart() ); |
|
230 | - $this->assertEquals( 2, $filter->getSliceSize() ); |
|
227 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
228 | + $this->assertEquals(array(), $filter->getSortations()); |
|
229 | + $this->assertEquals(1, $filter->getSliceStart()); |
|
230 | + $this->assertEquals(2, $filter->getSliceSize()); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
234 | 234 | public function testCreateIndexFilterTextCode() |
235 | 235 | { |
236 | - $filter = $this->object->createIndexFilterText( 'Espresso', 'code' ); |
|
236 | + $filter = $this->object->createIndexFilterText('Espresso', 'code'); |
|
237 | 237 | |
238 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
238 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
239 | 239 | |
240 | 240 | $sort = $filter->getSortations(); |
241 | - if( ( $item = reset( $sort ) ) === false ) { |
|
242 | - throw new \Exception( 'Sortation not set' ); |
|
241 | + if (($item = reset($sort)) === false) { |
|
242 | + throw new \Exception('Sortation not set'); |
|
243 | 243 | } |
244 | 244 | |
245 | - $this->assertEquals( 'product.code', $item->getName() ); |
|
245 | + $this->assertEquals('product.code', $item->getName()); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
249 | 249 | public function testCreateIndexFilterTextName() |
250 | 250 | { |
251 | - $filter = $this->object->createIndexFilterText( 'Espresso', 'name' ); |
|
251 | + $filter = $this->object->createIndexFilterText('Espresso', 'name'); |
|
252 | 252 | |
253 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
253 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
254 | 254 | |
255 | 255 | $sort = $filter->getSortations(); |
256 | - if( ( $item = reset( $sort ) ) === false ) { |
|
257 | - throw new \Exception( 'Sortation not set' ); |
|
256 | + if (($item = reset($sort)) === false) { |
|
257 | + throw new \Exception('Sortation not set'); |
|
258 | 258 | } |
259 | 259 | |
260 | - $this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() ); |
|
260 | + $this->assertEquals('sort:index.text.value("default","de","name")', $item->getName()); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
264 | 264 | public function testCreateIndexFilterTextPrice() |
265 | 265 | { |
266 | - $filter = $this->object->createIndexFilterCategory( 'Espresso', 'price' ); |
|
266 | + $filter = $this->object->createIndexFilterCategory('Espresso', 'price'); |
|
267 | 267 | |
268 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
268 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
269 | 269 | |
270 | 270 | $sort = $filter->getSortations(); |
271 | - if( ( $item = reset( $sort ) ) === false ) { |
|
272 | - throw new \Exception( 'Sortation not set' ); |
|
271 | + if (($item = reset($sort)) === false) { |
|
272 | + throw new \Exception('Sortation not set'); |
|
273 | 273 | } |
274 | 274 | |
275 | - $this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() ); |
|
275 | + $this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName()); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
279 | 279 | public function testCreateIndexFilterTextInvalidSortation() |
280 | 280 | { |
281 | - $filter = $this->object->createIndexFilterText( '', 'failure' ); |
|
281 | + $filter = $this->object->createIndexFilterText('', 'failure'); |
|
282 | 282 | |
283 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
284 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
283 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
284 | + $this->assertEquals(array(), $filter->getSortations()); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
288 | 288 | public function testAddIndexFilterText() |
289 | 289 | { |
290 | - $filter = $this->object->createIndexFilterText( 'Espresso' ); |
|
291 | - $filter = $this->object->addIndexFilterText( $filter, 'Espresso' ); |
|
290 | + $filter = $this->object->createIndexFilterText('Espresso'); |
|
291 | + $filter = $this->object->addIndexFilterText($filter, 'Espresso'); |
|
292 | 292 | |
293 | 293 | $list = $filter->getConditions()->getExpressions(); |
294 | 294 | |
295 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
296 | - throw new \Exception( 'Wrong expression' ); |
|
295 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
296 | + throw new \Exception('Wrong expression'); |
|
297 | 297 | } |
298 | 298 | |
299 | - $this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() ); |
|
300 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
301 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
299 | + $this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName()); |
|
300 | + $this->assertEquals(0, $list[0]->getValue()); |
|
301 | + $this->assertEquals(array(), $filter->getSortations()); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
305 | 305 | public function testGetIndexItemsCategory() |
306 | 306 | { |
307 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
307 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
308 | 308 | $search = $catalogManager->createSearch(); |
309 | 309 | |
310 | - $search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) ); |
|
311 | - $search->setSlice( 0, 1 ); |
|
312 | - $items = $catalogManager->searchItems( $search ); |
|
310 | + $search->setConditions($search->compare('==', 'catalog.code', 'new')); |
|
311 | + $search->setSlice(0, 1); |
|
312 | + $items = $catalogManager->searchItems($search); |
|
313 | 313 | |
314 | - if( ( $item = reset( $items ) ) === false ) { |
|
315 | - throw new \Exception( 'Catalog item not found' ); |
|
314 | + if (($item = reset($items)) === false) { |
|
315 | + throw new \Exception('Catalog item not found'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $total = 0; |
319 | - $filter = $this->object->createIndexFilterCategory( $item->getId(), 'position', '+', 1, 1 ); |
|
320 | - $results = $this->object->getIndexItems( $filter, array(), $total ); |
|
319 | + $filter = $this->object->createIndexFilterCategory($item->getId(), 'position', '+', 1, 1); |
|
320 | + $results = $this->object->getIndexItems($filter, array(), $total); |
|
321 | 321 | |
322 | - $this->assertEquals( 3, $total ); |
|
323 | - $this->assertEquals( 1, count( $results ) ); |
|
322 | + $this->assertEquals(3, $total); |
|
323 | + $this->assertEquals(1, count($results)); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | 327 | public function testGetIndexItemsText() |
328 | 328 | { |
329 | 329 | $total = 0; |
330 | - $filter = $this->object->createIndexFilterText( 'Expresso', 'relevance', '+', 0, 1, 'unittype13' ); |
|
331 | - $results = $this->object->getIndexItems( $filter, array(), $total ); |
|
330 | + $filter = $this->object->createIndexFilterText('Expresso', 'relevance', '+', 0, 1, 'unittype13'); |
|
331 | + $results = $this->object->getIndexItems($filter, array(), $total); |
|
332 | 332 | |
333 | - $this->assertEquals( 2, $total ); |
|
334 | - $this->assertEquals( 1, count( $results ) ); |
|
333 | + $this->assertEquals(2, $total); |
|
334 | + $this->assertEquals(1, count($results)); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | 338 | public function testCreateTextFilter() |
339 | 339 | { |
340 | - $filter = $this->object->createTextFilter( 'Expresso', 'name', '+', 0, 1 ); |
|
340 | + $filter = $this->object->createTextFilter('Expresso', 'name', '+', 0, 1); |
|
341 | 341 | |
342 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
343 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions() ); |
|
344 | - $this->assertEquals( 3, count( $filter->getConditions()->getExpressions() ) ); |
|
342 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
343 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions()); |
|
344 | + $this->assertEquals(3, count($filter->getConditions()->getExpressions())); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | 348 | public function testGetTextListName() |
349 | 349 | { |
350 | - $filter = $this->object->createTextFilter( 'Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name' ); |
|
351 | - $results = $this->object->getTextList( $filter ); |
|
350 | + $filter = $this->object->createTextFilter('Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name'); |
|
351 | + $results = $this->object->getTextList($filter); |
|
352 | 352 | |
353 | - $this->assertEquals( 1, count( $results ) ); |
|
354 | - $this->assertContains( 'Cafe Noire Cappuccino', $results ); |
|
353 | + $this->assertEquals(1, count($results)); |
|
354 | + $this->assertContains('Cafe Noire Cappuccino', $results); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | } |