@@ -215,7 +215,6 @@ discard block |
||
| 215 | 215 | /** |
| 216 | 216 | * Sets the sorting of the product list |
| 217 | 217 | * |
| 218 | - * @param string|null $sort Sortation of the product list like "name", "-name", "price", "-price", "code", "-code", "ctime, "-ctime" and "relevance", null for no sortation |
|
| 219 | 218 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 220 | 219 | * @since 2019.04 |
| 221 | 220 | */ |
@@ -258,7 +257,7 @@ discard block |
||
| 258 | 257 | /** |
| 259 | 258 | * Returns the frontend controller |
| 260 | 259 | * |
| 261 | - * @return \Aimeos\Controller\Frontend\Product\Iface Frontend controller object |
|
| 260 | + * @return \Aimeos\Controller\Frontend\Iface Frontend controller object |
|
| 262 | 261 | */ |
| 263 | 262 | protected function getController() |
| 264 | 263 | { |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 32 | 32 | */ |
| 33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 34 | 34 | { |
| 35 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Frontend\\Product\\Iface', $controller ); |
|
| 35 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Frontend\\Product\\Iface', $controller); |
|
| 36 | 36 | |
| 37 | 37 | $this->controller = $controller; |
| 38 | 38 | |
| 39 | - parent::__construct( $context ); |
|
| 39 | + parent::__construct($context); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @return mixed Returns the value of the called method |
| 49 | 49 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 50 | 50 | */ |
| 51 | - public function __call( $name, array $param ) |
|
| 51 | + public function __call($name, array $param) |
|
| 52 | 52 | { |
| 53 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 53 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | * @return array Associative list of key values as key and the product count for this key as value |
| 62 | 62 | * @since 2019.04 |
| 63 | 63 | */ |
| 64 | - public function aggregate( $key ) |
|
| 64 | + public function aggregate($key) |
|
| 65 | 65 | { |
| 66 | - return $this->controller->aggregate( $key ); |
|
| 66 | + return $this->controller->aggregate($key); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 75 | 75 | * @since 2019.04 |
| 76 | 76 | */ |
| 77 | - public function allOf( $attrIds ) |
|
| 77 | + public function allOf($attrIds) |
|
| 78 | 78 | { |
| 79 | - $this->controller->allOf( $attrIds ); |
|
| 79 | + $this->controller->allOf($attrIds); |
|
| 80 | 80 | return $this; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 91 | 91 | * @since 2019.04 |
| 92 | 92 | */ |
| 93 | - public function category( $catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
| 93 | + public function category($catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
| 94 | 94 | { |
| 95 | - $this->controller->category( $catIds, $listtype, $level ); |
|
| 95 | + $this->controller->category($catIds, $listtype, $level); |
|
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 107 | 107 | * @since 2019.04 |
| 108 | 108 | */ |
| 109 | - public function compare( $operator, $key, $value ) |
|
| 109 | + public function compare($operator, $key, $value) |
|
| 110 | 110 | { |
| 111 | - $this->controller->compare( $operator, $key, $value ); |
|
| 111 | + $this->controller->compare($operator, $key, $value); |
|
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 122 | 122 | * @since 2019.04 |
| 123 | 123 | */ |
| 124 | - public function get( $id, $domains = ['media', 'price', 'text'] ) |
|
| 124 | + public function get($id, $domains = ['media', 'price', 'text']) |
|
| 125 | 125 | { |
| 126 | - return $this->controller->get( $id, $domains ); |
|
| 126 | + return $this->controller->get($id, $domains); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 136 | 136 | * @since 2019.04 |
| 137 | 137 | */ |
| 138 | - public function find( $code, $domains = ['media', 'price', 'text'] ) |
|
| 138 | + public function find($code, $domains = ['media', 'price', 'text']) |
|
| 139 | 139 | { |
| 140 | - return $this->controller->find( $code, $domains ); |
|
| 140 | + return $this->controller->find($code, $domains); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 149 | 149 | * @since 2019.04 |
| 150 | 150 | */ |
| 151 | - public function oneOf( $attrIds ) |
|
| 151 | + public function oneOf($attrIds) |
|
| 152 | 152 | { |
| 153 | - $this->controller->oneOf( $attrIds ); |
|
| 153 | + $this->controller->oneOf($attrIds); |
|
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 163 | 163 | * @since 2019.04 |
| 164 | 164 | */ |
| 165 | - public function parse( array $conditions ) |
|
| 165 | + public function parse(array $conditions) |
|
| 166 | 166 | { |
| 167 | - $this->controller->parse( $conditions ); |
|
| 167 | + $this->controller->parse($conditions); |
|
| 168 | 168 | return $this; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 177 | 177 | * @since 2019.04 |
| 178 | 178 | */ |
| 179 | - public function product( $prodIds ) |
|
| 179 | + public function product($prodIds) |
|
| 180 | 180 | { |
| 181 | - $this->controller->product( $prodIds ); |
|
| 181 | + $this->controller->product($prodIds); |
|
| 182 | 182 | return $this; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 192 | 192 | * @since 2019.04 |
| 193 | 193 | */ |
| 194 | - public function search( $domains = ['media', 'price', 'text'], &$total = null ) |
|
| 194 | + public function search($domains = ['media', 'price', 'text'], &$total = null) |
|
| 195 | 195 | { |
| 196 | - return $this->controller->search( $domains, $total ); |
|
| 196 | + return $this->controller->search($domains, $total); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
@@ -205,9 +205,9 @@ discard block |
||
| 205 | 205 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 206 | 206 | * @since 2019.04 |
| 207 | 207 | */ |
| 208 | - public function slice( $start, $limit ) |
|
| 208 | + public function slice($start, $limit) |
|
| 209 | 209 | { |
| 210 | - $this->controller->slice( $start, $limit ); |
|
| 210 | + $this->controller->slice($start, $limit); |
|
| 211 | 211 | return $this; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 220 | 220 | * @since 2019.04 |
| 221 | 221 | */ |
| 222 | - public function sort( $key = null ) |
|
| 222 | + public function sort($key = null) |
|
| 223 | 223 | { |
| 224 | - $this->controller->sort( $key ); |
|
| 224 | + $this->controller->sort($key); |
|
| 225 | 225 | return $this; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 235 | 235 | * @since 2019.04 |
| 236 | 236 | */ |
| 237 | - public function supplier( $supIds, $listtype = 'default' ) |
|
| 237 | + public function supplier($supIds, $listtype = 'default') |
|
| 238 | 238 | { |
| 239 | - $this->controller->supplier( $supIds, $listtype ); |
|
| 239 | + $this->controller->supplier($supIds, $listtype); |
|
| 240 | 240 | return $this; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 249 | 249 | * @since 2019.04 |
| 250 | 250 | */ |
| 251 | - public function text( $text ) |
|
| 251 | + public function text($text) |
|
| 252 | 252 | { |
| 253 | - $this->controller->text( $text ); |
|
| 253 | + $this->controller->text($text); |
|
| 254 | 254 | return $this; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | /** |
| 130 | 130 | * Sets the sorting of the product list |
| 131 | 131 | * |
| 132 | - * @param string|null $sort Sortation of the product list like "name", "-name", "price", "-price", "code", "-code", "ctime, "-ctime" and "relevance", null for no sortation |
|
| 132 | + * @param string $key |
|
| 133 | 133 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 134 | 134 | * @since 2019.04 |
| 135 | 135 | */ |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @return array Associative list of key values as key and the product count for this key as value |
| 27 | 27 | * @since 2019.04 |
| 28 | 28 | */ |
| 29 | - public function aggregate( $key ); |
|
| 29 | + public function aggregate($key); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Adds attribute IDs for filtering where products must reference all IDs |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 36 | 36 | * @since 2019.04 |
| 37 | 37 | */ |
| 38 | - public function allOf( $attrIds ); |
|
| 38 | + public function allOf($attrIds); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Adds catalog IDs for filtering |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 47 | 47 | * @since 2019.04 |
| 48 | 48 | */ |
| 49 | - public function category( $catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
|
| 49 | + public function category($catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Adds generic condition for filtering products |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 58 | 58 | * @since 2019.04 |
| 59 | 59 | */ |
| 60 | - public function compare( $operator, $key, $value ); |
|
| 60 | + public function compare($operator, $key, $value); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Returns the product for the given product ID |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 68 | 68 | * @since 2019.04 |
| 69 | 69 | */ |
| 70 | - public function get( $id, $domains = ['media', 'price', 'text'] ); |
|
| 70 | + public function get($id, $domains = ['media', 'price', 'text']); |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * Returns the product for the given product code |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 78 | 78 | * @since 2019.04 |
| 79 | 79 | */ |
| 80 | - public function find( $code, $domains = ['media', 'price', 'text'] ); |
|
| 80 | + public function find($code, $domains = ['media', 'price', 'text']); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Adds attribute IDs for filtering where products must reference at least one ID |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 87 | 87 | * @since 2019.04 |
| 88 | 88 | */ |
| 89 | - public function oneOf( $attrIds ); |
|
| 89 | + public function oneOf($attrIds); |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Parses the given array and adds the conditions to the list of conditions |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 96 | 96 | * @since 2019.04 |
| 97 | 97 | */ |
| 98 | - public function parse( array $conditions ); |
|
| 98 | + public function parse(array $conditions); |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Adds product IDs for filtering |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 105 | 105 | * @since 2019.04 |
| 106 | 106 | */ |
| 107 | - public function product( $prodIds ); |
|
| 107 | + public function product($prodIds); |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Returns the products filtered by the previously assigned conditions |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 115 | 115 | * @since 2019.04 |
| 116 | 116 | */ |
| 117 | - public function search( $domains = ['media', 'price', 'text'], &$total = null ); |
|
| 117 | + public function search($domains = ['media', 'price', 'text'], &$total = null); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Sets the start value and the number of returned products for slicing the list of found products |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 125 | 125 | * @since 2019.04 |
| 126 | 126 | */ |
| 127 | - public function slice( $start, $limit ); |
|
| 127 | + public function slice($start, $limit); |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Sets the sorting of the product list |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 134 | 134 | * @since 2019.04 |
| 135 | 135 | */ |
| 136 | - public function sort( $key = null ); |
|
| 136 | + public function sort($key = null); |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * Adds supplier IDs for filtering |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 144 | 144 | * @since 2019.04 |
| 145 | 145 | */ |
| 146 | - public function supplier( $supIds, $listtype = 'default' ); |
|
| 146 | + public function supplier($supIds, $listtype = 'default'); |
|
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Adds input string for full text search |
@@ -152,5 +152,5 @@ discard block |
||
| 152 | 152 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 153 | 153 | * @since 2019.04 |
| 154 | 154 | */ |
| 155 | - public function text( $text ); |
|
| 155 | + public function text($text); |
|
| 156 | 156 | } |
@@ -63,7 +63,6 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * Returns the aggregated count of products for the given key. |
| 65 | 65 | * |
| 66 | - * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
|
| 67 | 66 | * @param string $key Search key to aggregate for, e.g. "index.attribute.id" |
| 68 | 67 | * @return array Associative list of key values as key and the product count for this key as value |
| 69 | 68 | * @since 2019.04 |
@@ -139,7 +138,7 @@ discard block |
||
| 139 | 138 | * |
| 140 | 139 | * @param string $operator Comparison operator, e.g. "==", "!=", "<", "<=", ">=", ">", "=~", "~=" |
| 141 | 140 | * @param string $key Search key defined by the product manager, e.g. "product.status" |
| 142 | - * @param array|string $value Value or list of values to compare to |
|
| 141 | + * @param string $value Value or list of values to compare to |
|
| 143 | 142 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 144 | 143 | * @since 2019.04 |
| 145 | 144 | */ |
@@ -259,7 +258,7 @@ discard block |
||
| 259 | 258 | /** |
| 260 | 259 | * Sets the sorting of the product list |
| 261 | 260 | * |
| 262 | - * @param string|null $sort Sortation of the product list like "name", "-name", "price", "-price", "code", "-code", "ctime, "-ctime" and "relevance", null for no sortation |
|
| 261 | + * @param string $key |
|
| 263 | 262 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 264 | 263 | * @since 2019.04 |
| 265 | 264 | */ |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 36 | 36 | { |
| 37 | - parent::__construct( $context ); |
|
| 37 | + parent::__construct($context); |
|
| 38 | 38 | |
| 39 | - $this->manager = \Aimeos\MShop::create( $context, 'index' ); |
|
| 40 | - $this->filter = $this->manager->createSearch( true ); |
|
| 41 | - $this->conditions[] = $this->filter->compare( '!=', 'index.catalog.id', null ); |
|
| 39 | + $this->manager = \Aimeos\MShop::create($context, 'index'); |
|
| 40 | + $this->filter = $this->manager->createSearch(true); |
|
| 41 | + $this->conditions[] = $this->filter->compare('!=', 'index.catalog.id', null); |
|
| 42 | 42 | |
| 43 | 43 | /** controller/frontend/order/ignore-dates |
| 44 | 44 | * Ignore start and end dates of products |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @since 2017.08 |
| 53 | 53 | * @category Developer |
| 54 | 54 | */ |
| 55 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) { |
|
| 56 | - $this->conditions[] = $this->filter->compare( '>', 'product.status', 0 ); |
|
| 55 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) { |
|
| 56 | + $this->conditions[] = $this->filter->compare('>', 'product.status', 0); |
|
| 57 | 57 | } else { |
| 58 | 58 | $this->conditions[] = $this->filter->getConditions(); |
| 59 | 59 | } |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * @return array Associative list of key values as key and the product count for this key as value |
| 69 | 69 | * @since 2019.04 |
| 70 | 70 | */ |
| 71 | - public function aggregate( $key ) |
|
| 71 | + public function aggregate($key) |
|
| 72 | 72 | { |
| 73 | - $this->filter->setConditions( $this->filter->combine( '&&', $this->conditions ) ); |
|
| 74 | - return $this->manager->aggregate( $this->filter, $key ); |
|
| 73 | + $this->filter->setConditions($this->filter->combine('&&', $this->conditions)); |
|
| 74 | + return $this->manager->aggregate($this->filter, $key); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 83 | 83 | * @since 2019.04 |
| 84 | 84 | */ |
| 85 | - public function allOf( $attrIds ) |
|
| 85 | + public function allOf($attrIds) |
|
| 86 | 86 | { |
| 87 | - if( ( $ids = array_unique( $this->validateIds( (array) $attrIds ) ) ) !== [] ) |
|
| 87 | + if (($ids = array_unique($this->validateIds((array) $attrIds))) !== []) |
|
| 88 | 88 | { |
| 89 | - $func = $this->filter->createFunction( 'index.attribute:all', [$ids] ); |
|
| 90 | - $this->conditions[] = $this->filter->compare( '!=', $func, null ); |
|
| 89 | + $func = $this->filter->createFunction('index.attribute:all', [$ids]); |
|
| 90 | + $this->conditions[] = $this->filter->compare('!=', $func, null); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $this; |
@@ -103,31 +103,31 @@ discard block |
||
| 103 | 103 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 104 | 104 | * @since 2019.04 |
| 105 | 105 | */ |
| 106 | - public function category( $catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
| 106 | + public function category($catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
| 107 | 107 | { |
| 108 | - if( ( $ids = $this->validateIds( (array) $catIds ) ) !== [] ) |
|
| 108 | + if (($ids = $this->validateIds((array) $catIds)) !== []) |
|
| 109 | 109 | { |
| 110 | - if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
| 110 | + if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
| 111 | 111 | { |
| 112 | 112 | $list = []; |
| 113 | - $cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'catalog' ); |
|
| 113 | + $cntl = \Aimeos\Controller\Frontend::create($this->getContext(), 'catalog'); |
|
| 114 | 114 | |
| 115 | - foreach( $ids as $catId ) |
|
| 115 | + foreach ($ids as $catId) |
|
| 116 | 116 | { |
| 117 | - $tree = $cntl->getTree( $catId, [], $level ); |
|
| 118 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) ); |
|
| 117 | + $tree = $cntl->getTree($catId, [], $level); |
|
| 118 | + $list = array_merge($list, $this->getCatalogIdsFromTree($tree)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $ids = array_unique( $list ); |
|
| 121 | + $ids = array_unique($list); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $func = $this->filter->createFunction( 'index.catalog:position', [$listtype, $ids] ); |
|
| 124 | + $func = $this->filter->createFunction('index.catalog:position', [$listtype, $ids]); |
|
| 125 | 125 | |
| 126 | - $this->conditions[] = $this->filter->compare( '==', 'index.catalog.id', $ids ); |
|
| 127 | - $this->conditions[] = $this->filter->compare( '>=', $func, 0 ); |
|
| 126 | + $this->conditions[] = $this->filter->compare('==', 'index.catalog.id', $ids); |
|
| 127 | + $this->conditions[] = $this->filter->compare('>=', $func, 0); |
|
| 128 | 128 | |
| 129 | - $func = $this->filter->createFunction( 'sort:index.catalog:position', [$listtype, $ids] ); |
|
| 130 | - $this->sort = $this->filter->sort( '+', $func ); |
|
| 129 | + $func = $this->filter->createFunction('sort:index.catalog:position', [$listtype, $ids]); |
|
| 130 | + $this->sort = $this->filter->sort('+', $func); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return $this; |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 144 | 144 | * @since 2019.04 |
| 145 | 145 | */ |
| 146 | - public function compare( $operator, $key, $value ) |
|
| 146 | + public function compare($operator, $key, $value) |
|
| 147 | 147 | { |
| 148 | - $this->conditions[] = $this->filter->compare( $operator, $key, $value ); |
|
| 148 | + $this->conditions[] = $this->filter->compare($operator, $key, $value); |
|
| 149 | 149 | return $this; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 159 | 159 | * @since 2019.04 |
| 160 | 160 | */ |
| 161 | - public function get( $id, $domains = ['media', 'price', 'text'] ) |
|
| 161 | + public function get($id, $domains = ['media', 'price', 'text']) |
|
| 162 | 162 | { |
| 163 | - return $this->manager->getItem( $id, $domains ); |
|
| 163 | + return $this->manager->getItem($id, $domains); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 173 | 173 | * @since 2019.04 |
| 174 | 174 | */ |
| 175 | - public function find( $code, $domains = ['media', 'price', 'text'] ) |
|
| 175 | + public function find($code, $domains = ['media', 'price', 'text']) |
|
| 176 | 176 | { |
| 177 | - return $this->manager->findItem( $code, $domains ); |
|
| 177 | + return $this->manager->findItem($code, $domains); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 186 | 186 | * @since 2019.04 |
| 187 | 187 | */ |
| 188 | - public function oneOf( $attrIds ) |
|
| 188 | + public function oneOf($attrIds) |
|
| 189 | 189 | { |
| 190 | - if( ( $ids = array_unique( $this->validateIds( (array) $attrIds ) ) ) !== [] ) { |
|
| 191 | - $this->conditions[] = $this->filter->compare( '==', 'index.attribute.id', $ids ); |
|
| 190 | + if (($ids = array_unique($this->validateIds((array) $attrIds))) !== []) { |
|
| 191 | + $this->conditions[] = $this->filter->compare('==', 'index.attribute.id', $ids); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | return $this; |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 203 | 203 | * @since 2019.04 |
| 204 | 204 | */ |
| 205 | - public function parse( array $conditions ) |
|
| 205 | + public function parse(array $conditions) |
|
| 206 | 206 | { |
| 207 | - $this->conditions[] = $this->filter->toConditions( $conditions ); |
|
| 207 | + $this->conditions[] = $this->filter->toConditions($conditions); |
|
| 208 | 208 | return $this; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 217 | 217 | * @since 2019.04 |
| 218 | 218 | */ |
| 219 | - public function product( $prodIds ) |
|
| 219 | + public function product($prodIds) |
|
| 220 | 220 | { |
| 221 | - if( ( $ids = array_unique( $this->validateIds( (array) $prodIds ) ) ) !== [] ) { |
|
| 222 | - $this->conditions[] = $this->filter->compare( '==', 'product.id', $ids ); |
|
| 221 | + if (($ids = array_unique($this->validateIds((array) $prodIds))) !== []) { |
|
| 222 | + $this->conditions[] = $this->filter->compare('==', 'product.id', $ids); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return $this; |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 235 | 235 | * @since 2019.04 |
| 236 | 236 | */ |
| 237 | - public function search( $domains = ['media', 'price', 'text'], &$total = null ) |
|
| 237 | + public function search($domains = ['media', 'price', 'text'], &$total = null) |
|
| 238 | 238 | { |
| 239 | - $this->filter->setConditions( $this->filter->combine( '&&', $this->conditions ) ); |
|
| 240 | - return $this->manager->searchItems( $this->filter, $domains, $total ); |
|
| 239 | + $this->filter->setConditions($this->filter->combine('&&', $this->conditions)); |
|
| 240 | + return $this->manager->searchItems($this->filter, $domains, $total); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 250 | 250 | * @since 2019.04 |
| 251 | 251 | */ |
| 252 | - public function slice( $start, $limit ) |
|
| 252 | + public function slice($start, $limit) |
|
| 253 | 253 | { |
| 254 | - $this->filter->setSlice( $start, $limit ); |
|
| 254 | + $this->filter->setSlice($start, $limit); |
|
| 255 | 255 | return $this; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -263,44 +263,44 @@ discard block |
||
| 263 | 263 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 264 | 264 | * @since 2019.04 |
| 265 | 265 | */ |
| 266 | - public function sort( $key = null ) |
|
| 266 | + public function sort($key = null) |
|
| 267 | 267 | { |
| 268 | 268 | $direction = '+'; |
| 269 | 269 | |
| 270 | - if( $key != null && $key[0] === '-' ) |
|
| 270 | + if ($key != null && $key[0] === '-') |
|
| 271 | 271 | { |
| 272 | - $key = substr( $key, 1 ); |
|
| 272 | + $key = substr($key, 1); |
|
| 273 | 273 | $direction = '-'; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - switch( $key ) |
|
| 276 | + switch ($key) |
|
| 277 | 277 | { |
| 278 | 278 | case 'code': |
| 279 | - $this->sort = $this->filter->sort( $direction, 'product.code' ); |
|
| 279 | + $this->sort = $this->filter->sort($direction, 'product.code'); |
|
| 280 | 280 | break; |
| 281 | 281 | |
| 282 | 282 | case 'ctime': |
| 283 | - $this->sort = $this->filter->sort( $direction, 'product.ctime' ); |
|
| 283 | + $this->sort = $this->filter->sort($direction, 'product.ctime'); |
|
| 284 | 284 | break; |
| 285 | 285 | |
| 286 | 286 | case 'name': |
| 287 | 287 | $langid = $this->getContext()->getLocale()->getLanguageId(); |
| 288 | 288 | |
| 289 | - $cmpfunc = $this->filter->createFunction( 'index.text:name', [$langid] ); |
|
| 290 | - $this->conditions[] = $this->filter->compare( '!=', $cmpfunc, null ); |
|
| 289 | + $cmpfunc = $this->filter->createFunction('index.text:name', [$langid]); |
|
| 290 | + $this->conditions[] = $this->filter->compare('!=', $cmpfunc, null); |
|
| 291 | 291 | |
| 292 | - $sortfunc = $this->filter->createFunction( 'sort:index.text:name', [$langid] ); |
|
| 293 | - $this->sort = $this->filter->sort( $direction, $sortfunc ); |
|
| 292 | + $sortfunc = $this->filter->createFunction('sort:index.text:name', [$langid]); |
|
| 293 | + $this->sort = $this->filter->sort($direction, $sortfunc); |
|
| 294 | 294 | break; |
| 295 | 295 | |
| 296 | 296 | case 'price': |
| 297 | 297 | $currencyid = $this->getContext()->getLocale()->getCurrencyId(); |
| 298 | 298 | |
| 299 | - $cmpfunc = $this->filter->createFunction( 'index.price:value', [$currencyid] ); |
|
| 300 | - $this->conditions[] = $this->filter->compare( '!=', $cmpfunc, null ); |
|
| 299 | + $cmpfunc = $this->filter->createFunction('index.price:value', [$currencyid]); |
|
| 300 | + $this->conditions[] = $this->filter->compare('!=', $cmpfunc, null); |
|
| 301 | 301 | |
| 302 | - $sortfunc = $this->filter->createFunction( 'sort:index.price:value', [$currencyid] ); |
|
| 303 | - $this->sort = $this->filter->sort( $direction, $sortfunc ); |
|
| 302 | + $sortfunc = $this->filter->createFunction('sort:index.price:value', [$currencyid]); |
|
| 303 | + $this->sort = $this->filter->sort($direction, $sortfunc); |
|
| 304 | 304 | break; |
| 305 | 305 | |
| 306 | 306 | case null: |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | break; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if( $this->sort ) { |
|
| 312 | - $this->filter->setSortations( [$this->sort] ); |
|
| 311 | + if ($this->sort) { |
|
| 312 | + $this->filter->setSortations([$this->sort]); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | return $this; |
@@ -324,17 +324,17 @@ discard block |
||
| 324 | 324 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 325 | 325 | * @since 2019.04 |
| 326 | 326 | */ |
| 327 | - public function supplier( $supIds, $listtype = 'default' ) |
|
| 327 | + public function supplier($supIds, $listtype = 'default') |
|
| 328 | 328 | { |
| 329 | - if( ( $ids = array_unique( $this->validateIds( (array) $supIds ) ) ) !== [] ) |
|
| 329 | + if (($ids = array_unique($this->validateIds((array) $supIds))) !== []) |
|
| 330 | 330 | { |
| 331 | - $func = $this->filter->createFunction( 'index.supplier:position', [$listtype, $ids] ); |
|
| 331 | + $func = $this->filter->createFunction('index.supplier:position', [$listtype, $ids]); |
|
| 332 | 332 | |
| 333 | - $this->conditions[] = $this->filter->compare( '==', 'index.supplier.id', $ids ); |
|
| 334 | - $this->conditions[] = $this->filter->compare( '>=', $func, 0 ); |
|
| 333 | + $this->conditions[] = $this->filter->compare('==', 'index.supplier.id', $ids); |
|
| 334 | + $this->conditions[] = $this->filter->compare('>=', $func, 0); |
|
| 335 | 335 | |
| 336 | - $func = $this->filter->createFunction( 'sort:index.supplier:position', [$listtype, $ids] ); |
|
| 337 | - $this->sort = $this->filter->sort( '+', $func ); |
|
| 336 | + $func = $this->filter->createFunction('sort:index.supplier:position', [$listtype, $ids]); |
|
| 337 | + $this->sort = $this->filter->sort('+', $func); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | return $this; |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface |
| 349 | 349 | * @since 2019.04 |
| 350 | 350 | */ |
| 351 | - public function text( $text ) |
|
| 351 | + public function text($text) |
|
| 352 | 352 | { |
| 353 | - if( $text ) |
|
| 353 | + if ($text) |
|
| 354 | 354 | { |
| 355 | 355 | $langid = $this->getContext()->getLocale()->getLanguageId(); |
| 356 | - $func = $this->filter->createFunction( 'index.text:relevance', [$langid, $text] ); |
|
| 356 | + $func = $this->filter->createFunction('index.text:relevance', [$langid, $text]); |
|
| 357 | 357 | |
| 358 | - $this->conditions[] = $this->filter->compare( '>', $func, 0 ); |
|
| 358 | + $this->conditions[] = $this->filter->compare('>', $func, 0); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | return $this; |
@@ -368,16 +368,16 @@ discard block |
||
| 368 | 368 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children |
| 369 | 369 | * @return array List of catalog IDs |
| 370 | 370 | */ |
| 371 | - protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item ) |
|
| 371 | + protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item) |
|
| 372 | 372 | { |
| 373 | - if( $item->getStatus() < 1 ) { |
|
| 373 | + if ($item->getStatus() < 1) { |
|
| 374 | 374 | return []; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - $list = [ $item->getId() ]; |
|
| 377 | + $list = [$item->getId()]; |
|
| 378 | 378 | |
| 379 | - foreach( $item->getChildren() as $child ) { |
|
| 380 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) ); |
|
| 379 | + foreach ($item->getChildren() as $child) { |
|
| 380 | + $list = array_merge($list, $this->getCatalogIdsFromTree($child)); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | return $list; |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | * @param array $ids List of IDs to validate |
| 391 | 391 | * @return array List of validated IDs |
| 392 | 392 | */ |
| 393 | - protected function validateIds( array $ids ) |
|
| 393 | + protected function validateIds(array $ids) |
|
| 394 | 394 | { |
| 395 | 395 | $list = []; |
| 396 | 396 | |
| 397 | - foreach( $ids as $id ) |
|
| 397 | + foreach ($ids as $id) |
|
| 398 | 398 | { |
| 399 | - if( $id != '' && preg_match( '/^[A-Za-z0-9\-\_]+$/', $id ) === 1 ) { |
|
| 399 | + if ($id != '' && preg_match('/^[A-Za-z0-9\-\_]+$/', $id) === 1) { |
|
| 400 | 400 | $list[] = (string) $id; |
| 401 | 401 | } |
| 402 | 402 | } |
@@ -229,6 +229,9 @@ |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| 232 | + /** |
|
| 233 | + * @param string $name |
|
| 234 | + */ |
|
| 232 | 235 | protected function access( $name ) |
| 233 | 236 | { |
| 234 | 237 | $class = new \ReflectionClass( \Aimeos\Controller\Frontend\Product\Decorator\Base::class ); |
@@ -20,57 +20,57 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Product\Standard::class ) |
|
| 23 | + $this->stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Product\Standard::class) |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Product\Decorator\Base::class ) |
|
| 28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
| 27 | + $this->object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Product\Decorator\Base::class) |
|
| 28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
| 29 | 29 | ->getMockForAbstractClass(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - unset( $this->context, $this->object, $this->stub ); |
|
| 35 | + unset($this->context, $this->object, $this->stub); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testConstructException() |
| 40 | 40 | { |
| 41 | - $stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Iface::class )->getMock(); |
|
| 41 | + $stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Iface::class)->getMock(); |
|
| 42 | 42 | |
| 43 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
| 43 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
| 44 | 44 | |
| 45 | - $this->getMockBuilder( \Aimeos\Controller\Frontend\Product\Decorator\Base::class ) |
|
| 46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 45 | + $this->getMockBuilder(\Aimeos\Controller\Frontend\Product\Decorator\Base::class) |
|
| 46 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 47 | 47 | ->getMockForAbstractClass(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testCall() |
| 52 | 52 | { |
| 53 | - $stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Product\Standard::class ) |
|
| 53 | + $stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Product\Standard::class) |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | - ->setMethods( ['invalid'] ) |
|
| 55 | + ->setMethods(['invalid']) |
|
| 56 | 56 | ->getMock(); |
| 57 | 57 | |
| 58 | - $object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Product\Decorator\Base::class ) |
|
| 59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 58 | + $object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Product\Decorator\Base::class) |
|
| 59 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 60 | 60 | ->getMockForAbstractClass(); |
| 61 | 61 | |
| 62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
| 62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
| 63 | 63 | |
| 64 | - $this->assertTrue( $object->invalid() ); |
|
| 64 | + $this->assertTrue($object->invalid()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testAggregate() |
| 69 | 69 | { |
| 70 | - $this->stub->expects( $this->once() )->method( 'aggregate' ) |
|
| 71 | - ->will( $this->returnValue( [] ) ); |
|
| 70 | + $this->stub->expects($this->once())->method('aggregate') |
|
| 71 | + ->will($this->returnValue([])); |
|
| 72 | 72 | |
| 73 | - $this->assertEquals( [], $this->object->aggregate( 'test' ) ); |
|
| 73 | + $this->assertEquals([], $this->object->aggregate('test')); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 80 | 80 | |
| 81 | - $this->stub->expects( $this->once() )->method( 'allOf' ) |
|
| 82 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 81 | + $this->stub->expects($this->once())->method('allOf') |
|
| 82 | + ->will($this->returnValue($this->stub)); |
|
| 83 | 83 | |
| 84 | - $this->assertInstanceOf( $expected, $this->object->allOf( [1, 2] ) ); |
|
| 84 | + $this->assertInstanceOf($expected, $this->object->allOf([1, 2])); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 91 | 91 | |
| 92 | - $this->stub->expects( $this->once() )->method( 'category' ) |
|
| 93 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 92 | + $this->stub->expects($this->once())->method('category') |
|
| 93 | + ->will($this->returnValue($this->stub)); |
|
| 94 | 94 | |
| 95 | - $this->assertInstanceOf( $expected, $this->object->category( 1, 'default', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ) ); |
|
| 95 | + $this->assertInstanceOf($expected, $this->object->category(1, 'default', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -100,34 +100,34 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 102 | 102 | |
| 103 | - $this->stub->expects( $this->once() )->method( 'compare' ) |
|
| 104 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 103 | + $this->stub->expects($this->once())->method('compare') |
|
| 104 | + ->will($this->returnValue($this->stub)); |
|
| 105 | 105 | |
| 106 | - $this->assertInstanceOf( $expected, $this->object->compare( '==', 'product.code', 'test' ) ); |
|
| 106 | + $this->assertInstanceOf($expected, $this->object->compare('==', 'product.code', 'test')); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | public function testGet() |
| 111 | 111 | { |
| 112 | - $item = \Aimeos\MShop::create( $this->context, 'product' )->createItem(); |
|
| 112 | + $item = \Aimeos\MShop::create($this->context, 'product')->createItem(); |
|
| 113 | 113 | $expected = \Aimeos\MShop\Product\Item\Iface::class; |
| 114 | 114 | |
| 115 | - $this->stub->expects( $this->once() )->method( 'get' ) |
|
| 116 | - ->will( $this->returnValue( $item ) ); |
|
| 115 | + $this->stub->expects($this->once())->method('get') |
|
| 116 | + ->will($this->returnValue($item)); |
|
| 117 | 117 | |
| 118 | - $this->assertInstanceOf( $expected, $this->object->get( 1, ['text'] ) ); |
|
| 118 | + $this->assertInstanceOf($expected, $this->object->get(1, ['text'])); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testFind() |
| 123 | 123 | { |
| 124 | - $item = \Aimeos\MShop::create( $this->context, 'product' )->createItem(); |
|
| 124 | + $item = \Aimeos\MShop::create($this->context, 'product')->createItem(); |
|
| 125 | 125 | $expected = \Aimeos\MShop\Product\Item\Iface::class; |
| 126 | 126 | |
| 127 | - $this->stub->expects( $this->once() )->method( 'find' ) |
|
| 128 | - ->will( $this->returnValue( $item ) ); |
|
| 127 | + $this->stub->expects($this->once())->method('find') |
|
| 128 | + ->will($this->returnValue($item)); |
|
| 129 | 129 | |
| 130 | - $this->assertInstanceOf( $expected, $this->object->find( 'test', ['text'] ) ); |
|
| 130 | + $this->assertInstanceOf($expected, $this->object->find('test', ['text'])); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 137 | 137 | |
| 138 | - $this->stub->expects( $this->once() )->method( 'oneOf' ) |
|
| 139 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 138 | + $this->stub->expects($this->once())->method('oneOf') |
|
| 139 | + ->will($this->returnValue($this->stub)); |
|
| 140 | 140 | |
| 141 | - $this->assertInstanceOf( $expected, $this->object->oneOf( [1, 2] ) ); |
|
| 141 | + $this->assertInstanceOf($expected, $this->object->oneOf([1, 2])); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 148 | 148 | |
| 149 | - $this->stub->expects( $this->once() )->method( 'parse' ) |
|
| 150 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 149 | + $this->stub->expects($this->once())->method('parse') |
|
| 150 | + ->will($this->returnValue($this->stub)); |
|
| 151 | 151 | |
| 152 | - $this->assertInstanceOf( $expected, $this->object->parse( [] ) ); |
|
| 152 | + $this->assertInstanceOf($expected, $this->object->parse([])); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -157,23 +157,23 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 159 | 159 | |
| 160 | - $this->stub->expects( $this->once() )->method( 'product' ) |
|
| 161 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 160 | + $this->stub->expects($this->once())->method('product') |
|
| 161 | + ->will($this->returnValue($this->stub)); |
|
| 162 | 162 | |
| 163 | - $this->assertInstanceOf( $expected, $this->object->product( [1, 3] ) ); |
|
| 163 | + $this->assertInstanceOf($expected, $this->object->product([1, 3])); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | public function testSearch() |
| 168 | 168 | { |
| 169 | - $item = \Aimeos\MShop::create( $this->context, 'product' )->createItem(); |
|
| 169 | + $item = \Aimeos\MShop::create($this->context, 'product')->createItem(); |
|
| 170 | 170 | $expected = \Aimeos\MShop\Product\Item\Iface::class; |
| 171 | 171 | $total = 0; |
| 172 | 172 | |
| 173 | - $this->stub->expects( $this->once() )->method( 'search' ) |
|
| 174 | - ->will( $this->returnValue( [$item] ) ); |
|
| 173 | + $this->stub->expects($this->once())->method('search') |
|
| 174 | + ->will($this->returnValue([$item])); |
|
| 175 | 175 | |
| 176 | - $this->assertEquals( [$item], $this->object->search( ['text'], $total ) ); |
|
| 176 | + $this->assertEquals([$item], $this->object->search(['text'], $total)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 183 | 183 | |
| 184 | - $this->stub->expects( $this->once() )->method( 'slice' ) |
|
| 185 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 184 | + $this->stub->expects($this->once())->method('slice') |
|
| 185 | + ->will($this->returnValue($this->stub)); |
|
| 186 | 186 | |
| 187 | - $this->assertInstanceOf( $expected, $this->object->slice( 0, 100 ) ); |
|
| 187 | + $this->assertInstanceOf($expected, $this->object->slice(0, 100)); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 194 | 194 | |
| 195 | - $this->stub->expects( $this->once() )->method( 'sort' ) |
|
| 196 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 195 | + $this->stub->expects($this->once())->method('sort') |
|
| 196 | + ->will($this->returnValue($this->stub)); |
|
| 197 | 197 | |
| 198 | - $this->assertInstanceOf( $expected, $this->object->sort( 'code' ) ); |
|
| 198 | + $this->assertInstanceOf($expected, $this->object->sort('code')); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 205 | 205 | |
| 206 | - $this->stub->expects( $this->once() )->method( 'supplier' ) |
|
| 207 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 206 | + $this->stub->expects($this->once())->method('supplier') |
|
| 207 | + ->will($this->returnValue($this->stub)); |
|
| 208 | 208 | |
| 209 | - $this->assertInstanceOf( $expected, $this->object->supplier( [1], 'default' ) ); |
|
| 209 | + $this->assertInstanceOf($expected, $this->object->supplier([1], 'default')); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -214,26 +214,26 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | $expected = \Aimeos\Controller\Frontend\Product\Iface::class; |
| 216 | 216 | |
| 217 | - $this->stub->expects( $this->once() )->method( 'text' ) |
|
| 218 | - ->will( $this->returnValue( $this->stub ) ); |
|
| 217 | + $this->stub->expects($this->once())->method('text') |
|
| 218 | + ->will($this->returnValue($this->stub)); |
|
| 219 | 219 | |
| 220 | - $this->assertInstanceOf( $expected, $this->object->text( 'test' ) ); |
|
| 220 | + $this->assertInstanceOf($expected, $this->object->text('test')); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | public function testGetController() |
| 225 | 225 | { |
| 226 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 226 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 227 | 227 | |
| 228 | - $this->assertSame( $this->stub, $result ); |
|
| 228 | + $this->assertSame($this->stub, $result); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| 232 | - protected function access( $name ) |
|
| 232 | + protected function access($name) |
|
| 233 | 233 | { |
| 234 | - $class = new \ReflectionClass( \Aimeos\Controller\Frontend\Product\Decorator\Base::class ); |
|
| 235 | - $method = $class->getMethod( $name ); |
|
| 236 | - $method->setAccessible( true ); |
|
| 234 | + $class = new \ReflectionClass(\Aimeos\Controller\Frontend\Product\Decorator\Base::class); |
|
| 235 | + $method = $class->getMethod($name); |
|
| 236 | + $method->setAccessible(true); |
|
| 237 | 237 | |
| 238 | 238 | return $method; |
| 239 | 239 | } |
@@ -17,214 +17,214 @@ |
||
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | 19 | $this->context = \TestHelperFrontend::getContext(); |
| 20 | - $this->object = new \Aimeos\Controller\Frontend\Product\Standard( $this->context ); |
|
| 20 | + $this->object = new \Aimeos\Controller\Frontend\Product\Standard($this->context); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | protected function tearDown() |
| 25 | 25 | { |
| 26 | - unset( $this->object ); |
|
| 26 | + unset($this->object); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | public function testAggregate() |
| 31 | 31 | { |
| 32 | - $list = $this->object->aggregate( 'index.attribute.id' ); |
|
| 32 | + $list = $this->object->aggregate('index.attribute.id'); |
|
| 33 | 33 | |
| 34 | - $this->assertGreaterThan( 0, count( $list ) ); |
|
| 34 | + $this->assertGreaterThan(0, count($list)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testAllOf() |
| 39 | 39 | { |
| 40 | - $manager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
|
| 40 | + $manager = \Aimeos\MShop::create($this->context, 'attribute'); |
|
| 41 | 41 | |
| 42 | - $length = $manager->findItem( '30', [], 'product', 'length' )->getId(); |
|
| 43 | - $width = $manager->findItem( '29', [], 'product', 'width' )->getId(); |
|
| 42 | + $length = $manager->findItem('30', [], 'product', 'length')->getId(); |
|
| 43 | + $width = $manager->findItem('29', [], 'product', 'width')->getId(); |
|
| 44 | 44 | |
| 45 | - $this->assertEquals( 2, count( $this->object->allOf( [$length, $width] )->search() ) ); |
|
| 45 | + $this->assertEquals(2, count($this->object->allOf([$length, $width])->search())); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | public function testCategory() |
| 50 | 50 | { |
| 51 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
| 52 | - $catId = $manager->findItem( 'cafe' )->getId(); |
|
| 51 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
| 52 | + $catId = $manager->findItem('cafe')->getId(); |
|
| 53 | 53 | |
| 54 | - $this->assertEquals( 2, count( $this->object->category( $catId, 'promotion' )->search() ) ); |
|
| 54 | + $this->assertEquals(2, count($this->object->category($catId, 'promotion')->search())); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testCategoryTree() |
| 59 | 59 | { |
| 60 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
| 60 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
| 61 | 61 | |
| 62 | - $catId = $manager->findItem( 'categories' )->getId(); |
|
| 63 | - $grpId = $manager->findItem( 'group' )->getId(); |
|
| 62 | + $catId = $manager->findItem('categories')->getId(); |
|
| 63 | + $grpId = $manager->findItem('group')->getId(); |
|
| 64 | 64 | |
| 65 | - $this->object->category( [$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ); |
|
| 66 | - $this->assertEquals( 3, count( $this->object->search() ) ); |
|
| 65 | + $this->object->category([$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); |
|
| 66 | + $this->assertEquals(3, count($this->object->search())); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | public function testCompare() |
| 71 | 71 | { |
| 72 | - $this->assertEquals( 1, count( $this->object->compare( '==', 'product.type', 'bundle' )->search() ) ); |
|
| 72 | + $this->assertEquals(1, count($this->object->compare('==', 'product.type', 'bundle')->search())); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | public function testGet() |
| 77 | 77 | { |
| 78 | - $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' ); |
|
| 78 | + $item = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC'); |
|
| 79 | 79 | |
| 80 | - $this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->get( $item->getId() ) ); |
|
| 80 | + $this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->get($item->getId())); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testFind() |
| 85 | 85 | { |
| 86 | - $this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->find( 'CNC' ) ); |
|
| 86 | + $this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->find('CNC')); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | public function testOneOf() |
| 91 | 91 | { |
| 92 | - $manager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
|
| 92 | + $manager = \Aimeos\MShop::create($this->context, 'attribute'); |
|
| 93 | 93 | |
| 94 | - $length = $manager->findItem( '30', [], 'product', 'length' )->getId(); |
|
| 95 | - $width = $manager->findItem( '29', [], 'product', 'width' )->getId(); |
|
| 94 | + $length = $manager->findItem('30', [], 'product', 'length')->getId(); |
|
| 95 | + $width = $manager->findItem('29', [], 'product', 'width')->getId(); |
|
| 96 | 96 | |
| 97 | - $this->assertEquals( 4, count( $this->object->oneOf( [$length, $width] )->search() ) ); |
|
| 97 | + $this->assertEquals(4, count($this->object->oneOf([$length, $width])->search())); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | public function testParse() |
| 102 | 102 | { |
| 103 | 103 | $cond = ['&&' => [['>' => ['product.status' => 0]], ['==' => ['product.type' => 'default']]]]; |
| 104 | - $this->assertEquals( 4, count( $this->object->parse( $cond )->search() ) ); |
|
| 104 | + $this->assertEquals(4, count($this->object->parse($cond)->search())); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testProduct() |
| 109 | 109 | { |
| 110 | - $manager = \Aimeos\MShop::create( $this->context, 'product' ); |
|
| 110 | + $manager = \Aimeos\MShop::create($this->context, 'product'); |
|
| 111 | 111 | |
| 112 | - $cncId = $manager->findItem( 'CNC' )->getId(); |
|
| 113 | - $cneId = $manager->findItem( 'CNE' )->getId(); |
|
| 112 | + $cncId = $manager->findItem('CNC')->getId(); |
|
| 113 | + $cneId = $manager->findItem('CNE')->getId(); |
|
| 114 | 114 | |
| 115 | - $this->assertEquals( 2, count( $this->object->product( [$cncId, $cneId] )->search() ) ); |
|
| 115 | + $this->assertEquals(2, count($this->object->product([$cncId, $cneId])->search())); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | public function testSearch() |
| 120 | 120 | { |
| 121 | - $this->assertEquals( 8, count( $this->object->search() ) ); |
|
| 121 | + $this->assertEquals(8, count($this->object->search())); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | public function testSlice() |
| 126 | 126 | { |
| 127 | - $this->assertEquals( 2, count( $this->object->slice( 0, 2 )->search() ) ); |
|
| 127 | + $this->assertEquals(2, count($this->object->slice(0, 2)->search())); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | public function testSort() |
| 132 | 132 | { |
| 133 | - $this->assertEquals( 8, count( $this->object->sort( 'relevance' )->search() ) ); |
|
| 133 | + $this->assertEquals(8, count($this->object->sort('relevance')->search())); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | public function testSortCode() |
| 138 | 138 | { |
| 139 | - $result = $this->object->sort( 'code' )->search( [] ); |
|
| 140 | - $this->assertEquals( 'CNC', reset( $result )->getCode() ); |
|
| 139 | + $result = $this->object->sort('code')->search([]); |
|
| 140 | + $this->assertEquals('CNC', reset($result)->getCode()); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | public function testSortCodeDesc() |
| 145 | 145 | { |
| 146 | - $result = $this->object->sort( '-code' )->search( [] ); |
|
| 147 | - $this->assertEquals( 'U:noSel', reset( $result )->getCode() ); |
|
| 146 | + $result = $this->object->sort('-code')->search([]); |
|
| 147 | + $this->assertEquals('U:noSel', reset($result)->getCode()); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | public function testSortCtime() |
| 152 | 152 | { |
| 153 | - $this->assertEquals( 8, count( $this->object->sort( 'ctime' )->search( [] ) ) ); |
|
| 153 | + $this->assertEquals(8, count($this->object->sort('ctime')->search([]))); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | public function testSortCtimeDesc() |
| 158 | 158 | { |
| 159 | - $this->assertEquals( 8, count( $this->object->sort( '-ctime' )->search( [] ) ) ); |
|
| 159 | + $this->assertEquals(8, count($this->object->sort('-ctime')->search([]))); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | public function testSortName() |
| 164 | 164 | { |
| 165 | - $result = $this->object->sort( 'name' )->search( ['text'] ); |
|
| 166 | - $this->assertEquals( 'Cafe Noire Cappuccino', reset( $result )->getName() ); |
|
| 165 | + $result = $this->object->sort('name')->search(['text']); |
|
| 166 | + $this->assertEquals('Cafe Noire Cappuccino', reset($result)->getName()); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
| 170 | 170 | public function testSortNameDesc() |
| 171 | 171 | { |
| 172 | - $result = $this->object->sort( '-name' )->search( ['text'] ); |
|
| 173 | - $this->assertEquals( 'Unterproduct 3', reset( $result )->getName() ); |
|
| 172 | + $result = $this->object->sort('-name')->search(['text']); |
|
| 173 | + $this->assertEquals('Unterproduct 3', reset($result)->getName()); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | public function testSortPrice() |
| 178 | 178 | { |
| 179 | - $result = $this->object->sort( 'price' )->search( [] ); |
|
| 180 | - $this->assertEquals( 'IJKL', reset( $result )->getCode() ); |
|
| 179 | + $result = $this->object->sort('price')->search([]); |
|
| 180 | + $this->assertEquals('IJKL', reset($result)->getCode()); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | public function testSortPriceDesc() |
| 185 | 185 | { |
| 186 | - $result = $this->object->sort( '-price' )->search( [] ); |
|
| 187 | - $this->assertTrue( in_array( reset( $result )->getCode(), ['CNC', 'U:BUNDLE'] ) ); |
|
| 186 | + $result = $this->object->sort('-price')->search([]); |
|
| 187 | + $this->assertTrue(in_array(reset($result)->getCode(), ['CNC', 'U:BUNDLE'])); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | public function testSortRelevanceCategory() |
| 192 | 192 | { |
| 193 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
| 194 | - $catId = $manager->findItem( 'new' )->getId(); |
|
| 193 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
| 194 | + $catId = $manager->findItem('new')->getId(); |
|
| 195 | 195 | |
| 196 | - $result = $this->object->category( $catId )->sort( 'relevance' )->search( [] ); |
|
| 196 | + $result = $this->object->category($catId)->sort('relevance')->search([]); |
|
| 197 | 197 | |
| 198 | - $this->assertEquals( 3, count( $result ) ); |
|
| 199 | - $this->assertEquals( 'CNE', reset( $result )->getCode() ); |
|
| 200 | - $this->assertEquals( 'U:BUNDLE', end( $result )->getCode() ); |
|
| 198 | + $this->assertEquals(3, count($result)); |
|
| 199 | + $this->assertEquals('CNE', reset($result)->getCode()); |
|
| 200 | + $this->assertEquals('U:BUNDLE', end($result)->getCode()); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | public function testSortRelevanceSupplier() |
| 205 | 205 | { |
| 206 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
| 207 | - $supId = $manager->findItem( 'unitCode001' )->getId(); |
|
| 206 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
| 207 | + $supId = $manager->findItem('unitCode001')->getId(); |
|
| 208 | 208 | |
| 209 | - $result = $this->object->supplier( $supId )->sort( 'relevance' )->search( [] ); |
|
| 209 | + $result = $this->object->supplier($supId)->sort('relevance')->search([]); |
|
| 210 | 210 | |
| 211 | - $this->assertEquals( 2, count( $result ) ); |
|
| 212 | - $this->assertEquals( 'CNC', reset( $result )->getCode() ); |
|
| 213 | - $this->assertEquals( 'CNE', end( $result )->getCode() ); |
|
| 211 | + $this->assertEquals(2, count($result)); |
|
| 212 | + $this->assertEquals('CNC', reset($result)->getCode()); |
|
| 213 | + $this->assertEquals('CNE', end($result)->getCode()); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | public function testSupplier() |
| 218 | 218 | { |
| 219 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
| 220 | - $supId = $manager->findItem( 'unitCode001' )->getId(); |
|
| 219 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
| 220 | + $supId = $manager->findItem('unitCode001')->getId(); |
|
| 221 | 221 | |
| 222 | - $this->assertEquals( 2, count( $this->object->supplier( $supId )->search( [] ) ) ); |
|
| 222 | + $this->assertEquals(2, count($this->object->supplier($supId)->search([]))); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | public function testText() |
| 227 | 227 | { |
| 228 | - $this->assertEquals( 3, count( $this->object->text( 'Cafe' )->search( [] ) ) ); |
|
| 228 | + $this->assertEquals(3, count($this->object->text('Cafe')->search([]))); |
|
| 229 | 229 | } |
| 230 | 230 | } |