@@ -30,18 +30,18 @@ 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 | 35 | $iface = '\Aimeos\Controller\Frontend\Locale\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items |
81 | 81 | * @since 2017.03 |
82 | 82 | */ |
83 | - public function getItem( $id, array $domains = [] ) |
|
83 | + public function getItem($id, array $domains = []) |
|
84 | 84 | { |
85 | - return $this->controller->getItem( $id, $domains ); |
|
85 | + return $this->controller->getItem($id, $domains); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface |
96 | 96 | * @since 2017.03 |
97 | 97 | */ |
98 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null ) |
|
98 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null) |
|
99 | 99 | { |
100 | - return $this->controller->searchItems( $filter, $domains, $total ); |
|
100 | + return $this->controller->searchItems($filter, $domains, $total); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | public function createFilter() |
32 | 32 | { |
33 | 33 | $context = $this->getContext(); |
34 | - $filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true ); |
|
34 | + $filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true); |
|
35 | 35 | |
36 | 36 | $expr = array( |
37 | - $filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ), |
|
37 | + $filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()), |
|
38 | 38 | $filter->getConditions(), |
39 | 39 | ); |
40 | 40 | |
41 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
42 | - $filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) ); |
|
41 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
42 | + $filter->setSortations(array($filter->sort('+', 'locale.position'))); |
|
43 | 43 | |
44 | 44 | return $filter; |
45 | 45 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items |
54 | 54 | * @since 2017.03 |
55 | 55 | */ |
56 | - public function getItem( $id, array $domains = [] ) |
|
56 | + public function getItem($id, array $domains = []) |
|
57 | 57 | { |
58 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id, $domains, true ); |
|
58 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id, $domains, true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface |
69 | 69 | * @since 2017.03 |
70 | 70 | */ |
71 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null ) |
|
71 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null) |
|
72 | 72 | { |
73 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, $domains, $total ); |
|
73 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, $domains, $total); |
|
74 | 74 | } |
75 | 75 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface) |
31 | 31 | * @param string $path Path describing the controller to clear, e.g. "basket" |
32 | 32 | */ |
33 | - static public function clear( $id = null, $path = null ) |
|
33 | + static public function clear($id = null, $path = null) |
|
34 | 34 | { |
35 | - if( $id !== null ) |
|
35 | + if ($id !== null) |
|
36 | 36 | { |
37 | - if( $path !== null ) { |
|
37 | + if ($path !== null) { |
|
38 | 38 | self::$controllers[$id][$path] = null; |
39 | 39 | } else { |
40 | 40 | self::$controllers[$id] = []; |
@@ -62,37 +62,37 @@ discard block |
||
62 | 62 | * @return \Aimeos\Controller\Frontend\Iface New frontend controller |
63 | 63 | * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found |
64 | 64 | */ |
65 | - static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path ) |
|
65 | + static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path) |
|
66 | 66 | { |
67 | - if( empty( $path ) ) { |
|
68 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) ); |
|
67 | + if (empty($path)) { |
|
68 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty')); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $id = (string) $context; |
72 | 72 | |
73 | - if( self::$cache === false || !isset( self::$controllers[$id][$path] ) ) |
|
73 | + if (self::$cache === false || !isset(self::$controllers[$id][$path])) |
|
74 | 74 | { |
75 | - $parts = explode( '/', $path ); |
|
75 | + $parts = explode('/', $path); |
|
76 | 76 | |
77 | - foreach( $parts as $key => $part ) |
|
77 | + foreach ($parts as $key => $part) |
|
78 | 78 | { |
79 | - if( ctype_alnum( $part ) === false ) { |
|
80 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) ); |
|
79 | + if (ctype_alnum($part) === false) { |
|
80 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path)); |
|
81 | 81 | } |
82 | 82 | |
83 | - $parts[$key] = ucwords( $part ); |
|
83 | + $parts[$key] = ucwords($part); |
|
84 | 84 | } |
85 | 85 | |
86 | - $factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory'; |
|
86 | + $factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory'; |
|
87 | 87 | |
88 | - if( class_exists( $factory ) === false ) { |
|
89 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
88 | + if (class_exists($factory) === false) { |
|
89 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory)); |
|
90 | 90 | } |
91 | 91 | |
92 | - $manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) ); |
|
92 | + $manager = call_user_func_array(array($factory, 'createController'), array($context)); |
|
93 | 93 | |
94 | - if( $manager === false ) { |
|
95 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
94 | + if ($manager === false) { |
|
95 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | self::$controllers[$id][$path] = $manager; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param boolean $value True to enable caching, false to disable it. |
109 | 109 | * @return boolean Previous cache setting |
110 | 110 | */ |
111 | - static public function setCache( $value ) |
|
111 | + static public function setCache($value) |
|
112 | 112 | { |
113 | 113 | $old = self::$cache; |
114 | 114 | self::$cache = (boolean) $value; |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
30 | 30 | * @since 2017.03 |
31 | 31 | */ |
32 | - public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes ) |
|
32 | + public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes) |
|
33 | 33 | { |
34 | - if( !empty( $codes ) ) |
|
34 | + if (!empty($codes)) |
|
35 | 35 | { |
36 | 36 | $expr = [ |
37 | - $filter->compare( '==', 'attribute.type.code', $codes ), |
|
37 | + $filter->compare('==', 'attribute.type.code', $codes), |
|
38 | 38 | $filter->getConditions(), |
39 | 39 | ]; |
40 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
40 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $filter; |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function createFilter() |
55 | 55 | { |
56 | - $filter = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->createSearch( true ); |
|
56 | + $filter = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->createSearch(true); |
|
57 | 57 | |
58 | 58 | $expr = array( |
59 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
59 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
60 | 60 | $filter->getConditions(), |
61 | 61 | ); |
62 | 62 | |
63 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
64 | - $filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) ); |
|
63 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
64 | + $filter->setSortations(array($filter->sort('+', 'attribute.position'))); |
|
65 | 65 | |
66 | 66 | return $filter; |
67 | 67 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items |
76 | 76 | * @since 2017.03 |
77 | 77 | */ |
78 | - public function getItem( $id, array $domains = array( 'media', 'price', 'text' ) ) |
|
78 | + public function getItem($id, array $domains = array('media', 'price', 'text')) |
|
79 | 79 | { |
80 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->getItem( $id, $domains, true ); |
|
80 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->getItem($id, $domains, true); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute item including the referenced domains items |
90 | 90 | * @since 2017.03 |
91 | 91 | */ |
92 | - public function getItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
92 | + public function getItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
93 | 93 | { |
94 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
94 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
95 | 95 | |
96 | - $filter = $manager->createSearch( true ); |
|
96 | + $filter = $manager->createSearch(true); |
|
97 | 97 | $expr = [ |
98 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
99 | - $filter->compare( '==', 'attribute.id', $ids ), |
|
98 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
99 | + $filter->compare('==', 'attribute.id', $ids), |
|
100 | 100 | $filter->getConditions(), |
101 | 101 | ]; |
102 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
103 | - $filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) ); |
|
102 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
103 | + $filter->setSortations(array($filter->sort('+', 'attribute.position'))); |
|
104 | 104 | |
105 | - return $manager->searchItems( $filter, $domains ); |
|
105 | + return $manager->searchItems($filter, $domains); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @return array Ordered list of attribute items implementing \Aimeos\MShop\Attribute\Item\Iface |
116 | 116 | * @since 2017.03 |
117 | 117 | */ |
118 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
118 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
119 | 119 | { |
120 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->searchItems( $filter, $domains, $total ); |
|
120 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->searchItems($filter, $domains, $total); |
|
121 | 121 | } |
122 | 122 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
27 | 27 | * @since 2017.04 |
28 | 28 | */ |
29 | - public function addItem( array $values ); |
|
29 | + public function addItem(array $values); |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
36 | 36 | * @since 2017.04 |
37 | 37 | */ |
38 | - public function createItem( array $values = [] ); |
|
38 | + public function createItem(array $values = []); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $id Unique customer ID |
45 | 45 | * @since 2017.04 |
46 | 46 | */ |
47 | - public function deleteItem( $id ); |
|
47 | + public function deleteItem($id); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
56 | 56 | * @since 2017.04 |
57 | 57 | */ |
58 | - public function editItem( $id, array $values ); |
|
58 | + public function editItem($id, array $values); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
67 | 67 | * @since 2017.04 |
68 | 68 | */ |
69 | - public function getItem( $id = null, array $domains = [] ); |
|
69 | + public function getItem($id = null, array $domains = []); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
80 | 80 | * @since 2017.04 |
81 | 81 | */ |
82 | - public function findItem( $code, array $domains = [] ); |
|
82 | + public function findItem($code, array $domains = []); |
|
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
90 | 90 | * @since 2017.04 |
91 | 91 | */ |
92 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ); |
|
92 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
100 | 100 | * @since 2017.04 |
101 | 101 | */ |
102 | - public function addAddressItem( array $values ); |
|
102 | + public function addAddressItem(array $values); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
109 | 109 | * @since 2017.04 |
110 | 110 | */ |
111 | - public function createAddressItem( array $values = [] ); |
|
111 | + public function createAddressItem(array $values = []); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $id Unique customer address ID |
118 | 118 | * @since 2017.04 |
119 | 119 | */ |
120 | - public function deleteAddressItem( $id ); |
|
120 | + public function deleteAddressItem($id); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
129 | 129 | * @since 2017.04 |
130 | 130 | */ |
131 | - public function editAddressItem( $id, array $values ); |
|
131 | + public function editAddressItem($id, array $values); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
139 | 139 | * @since 2017.04 |
140 | 140 | */ |
141 | - public function getAddressItem( $id ); |
|
141 | + public function getAddressItem($id); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
149 | 149 | * @since 2017.04 |
150 | 150 | */ |
151 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ); |
|
151 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item); |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Creates and returns a new list item object |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
158 | 158 | * @since 2017.06 |
159 | 159 | */ |
160 | - public function addListItem( array $values ); |
|
160 | + public function addListItem(array $values); |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Returns a new customer lists filter criteria object |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param string $id Unique customer address ID |
174 | 174 | * @since 2017.06 |
175 | 175 | */ |
176 | - public function deleteListItem( $id ); |
|
176 | + public function deleteListItem($id); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Saves a modified customer lists item object |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
184 | 184 | * @since 2017.06 |
185 | 185 | */ |
186 | - public function editListItem( $id, array $values ); |
|
186 | + public function editListItem($id, array $values); |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * Returns the customer item for the given customer ID |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
193 | 193 | * @since 2017.06 |
194 | 194 | */ |
195 | - public function getListItem( $id ); |
|
195 | + public function getListItem($id); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Returns the customer lists items filtered by the given criteria |
@@ -202,5 +202,5 @@ discard block |
||
202 | 202 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
203 | 203 | * @since 2017.06 |
204 | 204 | */ |
205 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
205 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
206 | 206 | } |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public static function getContext( $site = 'unittest' ) |
|
23 | + public static function getContext($site = 'unittest') |
|
24 | 24 | { |
25 | - if( !isset( self::$context[$site] ) ) { |
|
26 | - self::$context[$site] = self::createContext( $site ); |
|
25 | + if (!isset(self::$context[$site])) { |
|
26 | + self::$context[$site] = self::createContext($site); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | |
33 | 33 | private static function getAimeos() |
34 | 34 | { |
35 | - if( !isset( self::$aimeos ) ) |
|
35 | + if (!isset(self::$aimeos)) |
|
36 | 36 | { |
37 | 37 | require_once 'Bootstrap.php'; |
38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
39 | 39 | |
40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @param string $site |
50 | 50 | */ |
51 | - private static function createContext( $site ) |
|
51 | + private static function createContext($site) |
|
52 | 52 | { |
53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,38 +58,38 @@ discard block |
||
58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
60 | 60 | |
61 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
64 | - $ctx->setConfig( $conf ); |
|
61 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
64 | + $ctx->setConfig($conf); |
|
65 | 65 | |
66 | 66 | |
67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
68 | - $ctx->setDatabaseManager( $dbm ); |
|
67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
68 | + $ctx->setDatabaseManager($dbm); |
|
69 | 69 | |
70 | 70 | |
71 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
72 | - $ctx->setMessageQueueManager( $mq ); |
|
71 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
72 | + $ctx->setMessageQueueManager($mq); |
|
73 | 73 | |
74 | 74 | |
75 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
76 | - $ctx->setLogger( $logger ); |
|
75 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
76 | + $ctx->setLogger($logger); |
|
77 | 77 | |
78 | 78 | |
79 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
80 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
79 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
80 | + $ctx->setI18n(array('de' => $i18n)); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | $session = new \Aimeos\MW\Session\None(); |
84 | - $ctx->setSession( $session ); |
|
84 | + $ctx->setSession($session); |
|
85 | 85 | |
86 | 86 | |
87 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
88 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
89 | - $ctx->setLocale( $locale ); |
|
87 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
88 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
89 | + $ctx->setLocale($locale); |
|
90 | 90 | |
91 | 91 | |
92 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
92 | + $ctx->setEditor('core:controller/frontend'); |
|
93 | 93 | |
94 | 94 | return $ctx; |
95 | 95 | } |
@@ -18,121 +18,121 @@ discard block |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | protected function tearDown() |
26 | 26 | { |
27 | - unset( $this->context, $this->object ); |
|
27 | + unset($this->context, $this->object); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testAddEditSaveDeleteItem() |
32 | 32 | { |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
34 | + $id = $manager->findItem('UTC001')->getId(); |
|
35 | 35 | |
36 | - $this->context->setUserId( $id ); |
|
37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
36 | + $this->context->setUserId($id); |
|
37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
39 | 39 | |
40 | - $this->context->setUserId( $item->getId() ); |
|
41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
40 | + $this->context->setUserId($item->getId()); |
|
41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
43 | 43 | |
44 | - $item->setStatus( 0 ); |
|
45 | - $item = $this->object->saveItem( $item ); |
|
46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
44 | + $item->setStatus(0); |
|
45 | + $item = $this->object->saveItem($item); |
|
46 | + $this->assertEquals(0, $item->getStatus()); |
|
47 | 47 | |
48 | - $this->object->deleteItem( $item->getId() ); |
|
48 | + $this->object->deleteItem($item->getId()); |
|
49 | 49 | |
50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
51 | - $manager->findItem( 'unittest-ctnl' ); |
|
50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
51 | + $manager->findItem('unittest-ctnl'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testAddExistingItem() |
56 | 56 | { |
57 | - $item = $this->object->addItem( ['customer.code' => 'UTC001'] ); |
|
58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
57 | + $item = $this->object->addItem(['customer.code' => 'UTC001']); |
|
58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testCreateItem() |
63 | 63 | { |
64 | 64 | $result = $this->object->createItem(); |
65 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
65 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGetItem() |
70 | 70 | { |
71 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
72 | - $this->context->setUserId( $id ); |
|
71 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
72 | + $this->context->setUserId($id); |
|
73 | 73 | |
74 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
74 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
75 | 75 | |
76 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
77 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
78 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
76 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
77 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
78 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testFindItem() |
83 | 83 | { |
84 | - $result = $this->object->findItem( 'UTC001' ); |
|
85 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
84 | + $result = $this->object->findItem('UTC001'); |
|
85 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testAddEditSaveDeleteAddressItem() |
90 | 90 | { |
91 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
92 | - $this->context->setUserId( $customer->getId() ); |
|
91 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
92 | + $this->context->setUserId($customer->getId()); |
|
93 | 93 | |
94 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
95 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
94 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
95 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
96 | 96 | |
97 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
98 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
97 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
98 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
99 | 99 | |
100 | - $item->setLastName( 'test' ); |
|
101 | - $this->object->saveAddressItem( $item ); |
|
102 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
100 | + $item->setLastName('test'); |
|
101 | + $this->object->saveAddressItem($item); |
|
102 | + $this->assertEquals('test', $item->getLastName()); |
|
103 | 103 | |
104 | - $this->object->deleteAddressItem( $item->getId() ); |
|
104 | + $this->object->deleteAddressItem($item->getId()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testCreateAddressItem() |
109 | 109 | { |
110 | 110 | $result = $this->object->createAddressItem(); |
111 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
111 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
115 | 115 | public function testGetAddressItem() |
116 | 116 | { |
117 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
117 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
118 | 118 | $search = $manager->createSearch(); |
119 | - $search->setSlice( 0, 1 ); |
|
120 | - $result = $manager->searchItems( $search ); |
|
119 | + $search->setSlice(0, 1); |
|
120 | + $result = $manager->searchItems($search); |
|
121 | 121 | |
122 | - if( ( $item = reset( $result ) ) === false ) { |
|
123 | - throw new \RuntimeException( 'No customer address available' ); |
|
122 | + if (($item = reset($result)) === false) { |
|
123 | + throw new \RuntimeException('No customer address available'); |
|
124 | 124 | } |
125 | 125 | |
126 | - $this->context->setUserId( $item->getParentId() ); |
|
127 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
128 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
126 | + $this->context->setUserId($item->getParentId()); |
|
127 | + $result = $this->object->getAddressItem($item->getId()); |
|
128 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testAddEditDeleteListItem() |
133 | 133 | { |
134 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
135 | - $this->context->setUserId( $customer->getId() ); |
|
134 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
135 | + $this->context->setUserId($customer->getId()); |
|
136 | 136 | |
137 | 137 | $values = [ |
138 | 138 | 'customer.lists.type' => 'favorite', |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | 'customer.lists.refid' => '-1' |
141 | 141 | ]; |
142 | 142 | |
143 | - $item = $this->object->addListItem( $values ); |
|
144 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
143 | + $item = $this->object->addListItem($values); |
|
144 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
145 | 145 | |
146 | 146 | $values = [ |
147 | 147 | 'customer.lists.type' => 'favorite', |
@@ -149,46 +149,46 @@ discard block |
||
149 | 149 | 'customer.lists.refid' => '-2' |
150 | 150 | ]; |
151 | 151 | |
152 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
153 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
152 | + $item = $this->object->editListItem($item->getId(), $values); |
|
153 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
154 | 154 | |
155 | - $this->object->deleteListItem( $item->getId() ); |
|
155 | + $this->object->deleteListItem($item->getId()); |
|
156 | 156 | |
157 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
158 | - $this->object->getListItem( $item->getId() ); |
|
157 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
158 | + $this->object->getListItem($item->getId()); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testGetListItem() |
163 | 163 | { |
164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
164 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
165 | 165 | $search = $manager->createSearch(); |
166 | - $search->setSlice( 0, 1 ); |
|
167 | - $result = $manager->searchItems( $search ); |
|
166 | + $search->setSlice(0, 1); |
|
167 | + $result = $manager->searchItems($search); |
|
168 | 168 | |
169 | - if( ( $item = reset( $result ) ) === false ) { |
|
170 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
169 | + if (($item = reset($result)) === false) { |
|
170 | + throw new \RuntimeException('No customer lists item available'); |
|
171 | 171 | } |
172 | 172 | |
173 | - $this->context->setUserId( $item->getParentId() ); |
|
174 | - $result = $this->object->getListItem( $item->getId() ); |
|
175 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
173 | + $this->context->setUserId($item->getParentId()); |
|
174 | + $result = $this->object->getListItem($item->getId()); |
|
175 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
179 | 179 | public function testSearchListItem() |
180 | 180 | { |
181 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
182 | - $customer = $manager->findItem( 'UTC001' ); |
|
183 | - $this->context->setUserId( $customer->getId() ); |
|
181 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
182 | + $customer = $manager->findItem('UTC001'); |
|
183 | + $this->context->setUserId($customer->getId()); |
|
184 | 184 | |
185 | 185 | $filter = $this->object->createListsFilter(); |
186 | - $result = $this->object->searchListItems( $filter ); |
|
186 | + $result = $this->object->searchListItems($filter); |
|
187 | 187 | |
188 | - foreach( $result as $item ) |
|
188 | + foreach ($result as $item) |
|
189 | 189 | { |
190 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
191 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
190 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
191 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -17,22 +17,22 @@ discard block |
||
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 | 32 | $filter = $this->object->createFilter(); |
33 | - $list = $this->object->aggregate( $filter, 'index.attribute.id' ); |
|
33 | + $list = $this->object->aggregate($filter, 'index.attribute.id'); |
|
34 | 34 | |
35 | - $this->assertGreaterThan( 0, count( $list ) ); |
|
35 | + $this->assertGreaterThan(0, count($list)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -40,113 +40,113 @@ discard block |
||
40 | 40 | { |
41 | 41 | $filter = $this->object->createFilter(); |
42 | 42 | |
43 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
44 | - $this->assertEquals( [], $filter->getSortations() ); |
|
45 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
46 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
43 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
44 | + $this->assertEquals([], $filter->getSortations()); |
|
45 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
46 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testCreateFilterIgnoreDates() |
51 | 51 | { |
52 | - $this->context->getConfig()->set( 'controller/frontend/product/ignore-dates', true ); |
|
52 | + $this->context->getConfig()->set('controller/frontend/product/ignore-dates', true); |
|
53 | 53 | |
54 | 54 | $filter = $this->object->createFilter(); |
55 | 55 | |
56 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
56 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testAddFilterAttribute() |
61 | 61 | { |
62 | 62 | $filter = $this->object->createFilter(); |
63 | - $filter = $this->object->addFilterAttribute( $filter, array( 0, 1 ), [], [] ); |
|
63 | + $filter = $this->object->addFilterAttribute($filter, array(0, 1), [], []); |
|
64 | 64 | |
65 | 65 | $list = $filter->getConditions()->getExpressions(); |
66 | 66 | |
67 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
68 | - throw new \RuntimeException( 'Wrong expression' ); |
|
67 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
68 | + throw new \RuntimeException('Wrong expression'); |
|
69 | 69 | } |
70 | 70 | |
71 | - $this->assertEquals( 'index.attributeaggregate([0,1])', $list[0]->getName() ); |
|
72 | - $this->assertEquals( 2, $list[0]->getValue() ); |
|
71 | + $this->assertEquals('index.attributeaggregate([0,1])', $list[0]->getName()); |
|
72 | + $this->assertEquals(2, $list[0]->getValue()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function testAddFilterAttributeOptions() |
77 | 77 | { |
78 | 78 | $filter = $this->object->createFilter(); |
79 | - $filter = $this->object->addFilterAttribute( $filter, [], array( 1 ), [] ); |
|
79 | + $filter = $this->object->addFilterAttribute($filter, [], array(1), []); |
|
80 | 80 | |
81 | 81 | $list = $filter->getConditions()->getExpressions(); |
82 | 82 | |
83 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
84 | - throw new \RuntimeException( 'Wrong expression' ); |
|
83 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
84 | + throw new \RuntimeException('Wrong expression'); |
|
85 | 85 | } |
86 | 86 | |
87 | - $this->assertEquals( 'index.attributeaggregate([1])', $list[0]->getName() ); |
|
88 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
87 | + $this->assertEquals('index.attributeaggregate([1])', $list[0]->getName()); |
|
88 | + $this->assertEquals(0, $list[0]->getValue()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | 92 | public function testAddFilterAttributeOne() |
93 | 93 | { |
94 | 94 | $filter = $this->object->createFilter(); |
95 | - $filter = $this->object->addFilterAttribute( $filter, [], [], array( 'test' => array( 2 ) ) ); |
|
95 | + $filter = $this->object->addFilterAttribute($filter, [], [], array('test' => array(2))); |
|
96 | 96 | |
97 | 97 | $list = $filter->getConditions()->getExpressions(); |
98 | 98 | |
99 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
100 | - throw new \RuntimeException( 'Wrong expression' ); |
|
99 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
100 | + throw new \RuntimeException('Wrong expression'); |
|
101 | 101 | } |
102 | 102 | |
103 | - $this->assertEquals( 'index.attributeaggregate([2])', $list[0]->getName() ); |
|
104 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
103 | + $this->assertEquals('index.attributeaggregate([2])', $list[0]->getName()); |
|
104 | + $this->assertEquals(0, $list[0]->getValue()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testAddFilterCategory() |
109 | 109 | { |
110 | 110 | $context = \TestHelperFrontend::getContext(); |
111 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' ); |
|
111 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'catalog'); |
|
112 | 112 | |
113 | - $catId = $manager->findItem( 'root' )->getId(); |
|
113 | + $catId = $manager->findItem('root')->getId(); |
|
114 | 114 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST; |
115 | 115 | |
116 | 116 | $filter = $this->object->createFilter(); |
117 | - $filter = $this->object->addFilterCategory( $filter, $catId, $level ); |
|
117 | + $filter = $this->object->addFilterCategory($filter, $catId, $level); |
|
118 | 118 | |
119 | 119 | $list = $filter->getConditions()->getExpressions(); |
120 | 120 | |
121 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
122 | - throw new \RuntimeException( 'Wrong expression' ); |
|
121 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
122 | + throw new \RuntimeException('Wrong expression'); |
|
123 | 123 | } |
124 | 124 | |
125 | - $this->assertEquals( 'index.catalog.id', $list[0]->getName() ); |
|
126 | - $this->assertEquals( 3, count( $list[0]->getValue() ) ); |
|
127 | - $this->assertEquals( [], $filter->getSortations() ); |
|
125 | + $this->assertEquals('index.catalog.id', $list[0]->getName()); |
|
126 | + $this->assertEquals(3, count($list[0]->getValue())); |
|
127 | + $this->assertEquals([], $filter->getSortations()); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | 131 | public function testAddFilterText() |
132 | 132 | { |
133 | 133 | $filter = $this->object->createFilter(); |
134 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
134 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
135 | 135 | |
136 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
136 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
137 | 137 | |
138 | 138 | $list = $filter->getConditions()->getExpressions(); |
139 | 139 | |
140 | 140 | |
141 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
142 | - throw new \RuntimeException( 'Wrong expression' ); |
|
141 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
142 | + throw new \RuntimeException('Wrong expression'); |
|
143 | 143 | } |
144 | - $this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() ); |
|
145 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
144 | + $this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName()); |
|
145 | + $this->assertEquals(0, $list[0]->getValue()); |
|
146 | 146 | |
147 | - $this->assertEquals( [], $filter->getSortations() ); |
|
148 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
149 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
147 | + $this->assertEquals([], $filter->getSortations()); |
|
148 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
149 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -155,177 +155,177 @@ discard block |
||
155 | 155 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE; |
156 | 156 | |
157 | 157 | $filter = $this->object->createFilter(); |
158 | - $filter = $this->object->addFilterCategory( $filter, 0, $level, 'relevance', '-', 'test' ); |
|
158 | + $filter = $this->object->addFilterCategory($filter, 0, $level, 'relevance', '-', 'test'); |
|
159 | 159 | |
160 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
160 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
161 | 161 | |
162 | 162 | $sort = $filter->getSortations(); |
163 | - if( ( $item = reset( $sort ) ) === false ) { |
|
164 | - throw new \RuntimeException( 'Sortation not set' ); |
|
163 | + if (($item = reset($sort)) === false) { |
|
164 | + throw new \RuntimeException('Sortation not set'); |
|
165 | 165 | } |
166 | 166 | |
167 | - $this->assertEquals( 'sort:index.catalog.position("test",["0"])', $item->getName() ); |
|
168 | - $this->assertEquals( '-', $item->getOperator() ); |
|
167 | + $this->assertEquals('sort:index.catalog.position("test",["0"])', $item->getName()); |
|
168 | + $this->assertEquals('-', $item->getOperator()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | 172 | public function testCreateFilterSortRelevanceText() |
173 | 173 | { |
174 | - $filter = $this->object->createFilter( 'relevance', '-', 1, 2, 'test' ); |
|
175 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
174 | + $filter = $this->object->createFilter('relevance', '-', 1, 2, 'test'); |
|
175 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
176 | 176 | |
177 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
178 | - $this->assertEquals( [], $filter->getSortations() ); |
|
179 | - $this->assertEquals( 1, $filter->getSliceStart() ); |
|
180 | - $this->assertEquals( 2, $filter->getSliceSize() ); |
|
177 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
178 | + $this->assertEquals([], $filter->getSortations()); |
|
179 | + $this->assertEquals(1, $filter->getSliceStart()); |
|
180 | + $this->assertEquals(2, $filter->getSliceSize()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testCreateFilterSortCode() |
185 | 185 | { |
186 | - $filter = $this->object->createFilter( 'code' ); |
|
186 | + $filter = $this->object->createFilter('code'); |
|
187 | 187 | |
188 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
188 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
189 | 189 | |
190 | 190 | $sort = $filter->getSortations(); |
191 | - if( ( $item = reset( $sort ) ) === false ) { |
|
192 | - throw new \RuntimeException( 'Sortation not set' ); |
|
191 | + if (($item = reset($sort)) === false) { |
|
192 | + throw new \RuntimeException('Sortation not set'); |
|
193 | 193 | } |
194 | 194 | |
195 | - $this->assertEquals( 'product.code', $item->getName() ); |
|
195 | + $this->assertEquals('product.code', $item->getName()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
199 | 199 | public function testCreateFilterSortCtime() |
200 | 200 | { |
201 | - $filter = $this->object->createFilter( 'ctime' ); |
|
201 | + $filter = $this->object->createFilter('ctime'); |
|
202 | 202 | |
203 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
203 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
204 | 204 | |
205 | 205 | $sort = $filter->getSortations(); |
206 | - if( ( $item = reset( $sort ) ) === false ) { |
|
207 | - throw new \RuntimeException( 'Sortation not set' ); |
|
206 | + if (($item = reset($sort)) === false) { |
|
207 | + throw new \RuntimeException('Sortation not set'); |
|
208 | 208 | } |
209 | 209 | |
210 | - $this->assertEquals( 'product.ctime', $item->getName() ); |
|
210 | + $this->assertEquals('product.ctime', $item->getName()); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
214 | 214 | public function testCreateFilterSortName() |
215 | 215 | { |
216 | - $filter = $this->object->createFilter( 'name' ); |
|
216 | + $filter = $this->object->createFilter('name'); |
|
217 | 217 | |
218 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
218 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
219 | 219 | |
220 | 220 | $sort = $filter->getSortations(); |
221 | - if( ( $item = reset( $sort ) ) === false ) { |
|
222 | - throw new \RuntimeException( 'Sortation not set' ); |
|
221 | + if (($item = reset($sort)) === false) { |
|
222 | + throw new \RuntimeException('Sortation not set'); |
|
223 | 223 | } |
224 | 224 | |
225 | - $this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() ); |
|
225 | + $this->assertEquals('sort:index.text.value("default","de","name")', $item->getName()); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
229 | 229 | public function testCreateFilterSortPrice() |
230 | 230 | { |
231 | - $filter = $this->object->createFilter( 'price' ); |
|
231 | + $filter = $this->object->createFilter('price'); |
|
232 | 232 | |
233 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
233 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
234 | 234 | |
235 | 235 | $sort = $filter->getSortations(); |
236 | - if( ( $item = reset( $sort ) ) === false ) { |
|
237 | - throw new \RuntimeException( 'Sortation not set' ); |
|
236 | + if (($item = reset($sort)) === false) { |
|
237 | + throw new \RuntimeException('Sortation not set'); |
|
238 | 238 | } |
239 | 239 | |
240 | - $this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() ); |
|
240 | + $this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName()); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | public function testCreateFilterSortInvalid() |
245 | 245 | { |
246 | - $filter = $this->object->createFilter( '', 'failure' ); |
|
246 | + $filter = $this->object->createFilter('', 'failure'); |
|
247 | 247 | |
248 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
249 | - $this->assertEquals( [], $filter->getSortations() ); |
|
248 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
249 | + $this->assertEquals([], $filter->getSortations()); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
253 | 253 | public function testGetItem() |
254 | 254 | { |
255 | 255 | $context = \TestHelperFrontend::getContext(); |
256 | - $id = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'CNC' )->getId(); |
|
256 | + $id = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('CNC')->getId(); |
|
257 | 257 | |
258 | - $result = $this->object->getItem( $id ); |
|
258 | + $result = $this->object->getItem($id); |
|
259 | 259 | |
260 | - $this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $result ); |
|
261 | - $this->assertGreaterThan( 0, $result->getPropertyItems() ); |
|
262 | - $this->assertGreaterThan( 0, $result->getRefItems( 'attribute' ) ); |
|
263 | - $this->assertGreaterThan( 0, $result->getRefItems( 'media' ) ); |
|
264 | - $this->assertGreaterThan( 0, $result->getRefItems( 'price' ) ); |
|
265 | - $this->assertGreaterThan( 0, $result->getRefItems( 'product' ) ); |
|
266 | - $this->assertGreaterThan( 0, $result->getRefItems( 'text' ) ); |
|
260 | + $this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $result); |
|
261 | + $this->assertGreaterThan(0, $result->getPropertyItems()); |
|
262 | + $this->assertGreaterThan(0, $result->getRefItems('attribute')); |
|
263 | + $this->assertGreaterThan(0, $result->getRefItems('media')); |
|
264 | + $this->assertGreaterThan(0, $result->getRefItems('price')); |
|
265 | + $this->assertGreaterThan(0, $result->getRefItems('product')); |
|
266 | + $this->assertGreaterThan(0, $result->getRefItems('text')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
270 | 270 | public function testGetItems() |
271 | 271 | { |
272 | 272 | $context = \TestHelperFrontend::getContext(); |
273 | - $context->getConfig()->set( 'controller/frontend/product/ignore-dates', true ); |
|
273 | + $context->getConfig()->set('controller/frontend/product/ignore-dates', true); |
|
274 | 274 | |
275 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
275 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
276 | 276 | |
277 | 277 | $search = $manager->createSearch(); |
278 | - $search->setConditions( $search->compare( '==', 'product.code', array( 'CNC', 'CNE' ) ) ); |
|
278 | + $search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE'))); |
|
279 | 279 | |
280 | 280 | $ids = []; |
281 | - foreach( $manager->searchItems( $search ) as $productItem ) { |
|
281 | + foreach ($manager->searchItems($search) as $productItem) { |
|
282 | 282 | $ids[] = $productItem->getId(); |
283 | 283 | } |
284 | 284 | |
285 | 285 | |
286 | - $result = $this->object->getItems( $ids ); |
|
286 | + $result = $this->object->getItems($ids); |
|
287 | 287 | |
288 | - $this->assertEquals( 2, count( $result ) ); |
|
288 | + $this->assertEquals(2, count($result)); |
|
289 | 289 | |
290 | - foreach( $result as $productItem ) { |
|
291 | - $this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $productItem ); |
|
290 | + foreach ($result as $productItem) { |
|
291 | + $this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $productItem); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | 295 | |
296 | 296 | public function testSearchItemsCategory() |
297 | 297 | { |
298 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
298 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
299 | 299 | $search = $catalogManager->createSearch(); |
300 | 300 | |
301 | - $search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) ); |
|
302 | - $search->setSlice( 0, 1 ); |
|
303 | - $items = $catalogManager->searchItems( $search ); |
|
301 | + $search->setConditions($search->compare('==', 'catalog.code', 'new')); |
|
302 | + $search->setSlice(0, 1); |
|
303 | + $items = $catalogManager->searchItems($search); |
|
304 | 304 | |
305 | - if( ( $item = reset( $items ) ) === false ) { |
|
306 | - throw new \RuntimeException( 'Product item not found' ); |
|
305 | + if (($item = reset($items)) === false) { |
|
306 | + throw new \RuntimeException('Product item not found'); |
|
307 | 307 | } |
308 | 308 | |
309 | - $filter = $this->object->createFilter( 'position', '+', 1, 1 ); |
|
310 | - $filter = $this->object->addFilterCategory( $filter, $item->getId() ); |
|
309 | + $filter = $this->object->createFilter('position', '+', 1, 1); |
|
310 | + $filter = $this->object->addFilterCategory($filter, $item->getId()); |
|
311 | 311 | |
312 | 312 | $total = 0; |
313 | - $results = $this->object->searchItems( $filter, [], $total ); |
|
313 | + $results = $this->object->searchItems($filter, [], $total); |
|
314 | 314 | |
315 | - $this->assertEquals( 3, $total ); |
|
316 | - $this->assertEquals( 1, count( $results ) ); |
|
315 | + $this->assertEquals(3, $total); |
|
316 | + $this->assertEquals(1, count($results)); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
320 | 320 | public function testSearchItemsText() |
321 | 321 | { |
322 | - $filter = $this->object->createFilter( 'relevance', '+', 0, 1, 'unittype13' ); |
|
323 | - $filter = $this->object->addFilterText( $filter, 'Expresso', 'relevance', '+', 'unittype13' ); |
|
322 | + $filter = $this->object->createFilter('relevance', '+', 0, 1, 'unittype13'); |
|
323 | + $filter = $this->object->addFilterText($filter, 'Expresso', 'relevance', '+', 'unittype13'); |
|
324 | 324 | |
325 | 325 | $total = 0; |
326 | - $results = $this->object->searchItems( $filter, [], $total ); |
|
326 | + $results = $this->object->searchItems($filter, [], $total); |
|
327 | 327 | |
328 | - $this->assertEquals( 2, $total ); |
|
329 | - $this->assertEquals( 1, count( $results ) ); |
|
328 | + $this->assertEquals(2, $total); |
|
329 | + $this->assertEquals(1, count($results)); |
|
330 | 330 | } |
331 | 331 | } |
@@ -20,54 +20,54 @@ discard block |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base') |
|
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' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base') |
|
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\Basket\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Decorator\Base') |
|
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 testClear() |
69 | 69 | { |
70 | - $this->stub->expects( $this->once() )->method( 'clear' ); |
|
70 | + $this->stub->expects($this->once())->method('clear'); |
|
71 | 71 | |
72 | 72 | $this->object->clear(); |
73 | 73 | } |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | public function testGet() |
77 | 77 | { |
78 | 78 | $context = \TestHelperFrontend::getContext(); |
79 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->createItem(); |
|
79 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem(); |
|
80 | 80 | |
81 | - $this->stub->expects( $this->once() )->method( 'get' ) |
|
82 | - ->will( $this->returnValue( $order ) ); |
|
81 | + $this->stub->expects($this->once())->method('get') |
|
82 | + ->will($this->returnValue($order)); |
|
83 | 83 | |
84 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() ); |
|
84 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | 88 | public function testSave() |
89 | 89 | { |
90 | - $this->stub->expects( $this->once() )->method( 'save' ); |
|
90 | + $this->stub->expects($this->once())->method('save'); |
|
91 | 91 | |
92 | 92 | $this->object->save(); |
93 | 93 | } |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | |
96 | 96 | public function testSetType() |
97 | 97 | { |
98 | - $this->stub->expects( $this->once() )->method( 'setType' ); |
|
98 | + $this->stub->expects($this->once())->method('setType'); |
|
99 | 99 | |
100 | - $this->object->setType( 'test' ); |
|
100 | + $this->object->setType('test'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
104 | 104 | public function testStore() |
105 | 105 | { |
106 | - $this->stub->expects( $this->once() )->method( 'store' ); |
|
106 | + $this->stub->expects($this->once())->method('store'); |
|
107 | 107 | |
108 | 108 | $this->object->store(); |
109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public function testLoad() |
113 | 113 | { |
114 | - $this->stub->expects( $this->once() )->method( 'load' ); |
|
114 | + $this->stub->expects($this->once())->method('load'); |
|
115 | 115 | |
116 | 116 | $this->object->load( -1 ); |
117 | 117 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | public function testAddProduct() |
121 | 121 | { |
122 | - $this->stub->expects( $this->once() )->method( 'addProduct' ); |
|
122 | + $this->stub->expects($this->once())->method('addProduct'); |
|
123 | 123 | |
124 | 124 | $this->object->addProduct( -1 ); |
125 | 125 | } |
@@ -127,73 +127,73 @@ discard block |
||
127 | 127 | |
128 | 128 | public function testDeleteProduct() |
129 | 129 | { |
130 | - $this->stub->expects( $this->once() )->method( 'deleteProduct' ); |
|
130 | + $this->stub->expects($this->once())->method('deleteProduct'); |
|
131 | 131 | |
132 | - $this->object->deleteProduct( 0 ); |
|
132 | + $this->object->deleteProduct(0); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | 136 | public function testEditProduct() |
137 | 137 | { |
138 | - $this->stub->expects( $this->once() )->method( 'editProduct' ); |
|
138 | + $this->stub->expects($this->once())->method('editProduct'); |
|
139 | 139 | |
140 | - $this->object->editProduct( 0, 1 ); |
|
140 | + $this->object->editProduct(0, 1); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | public function testAddCoupon() |
145 | 145 | { |
146 | - $this->stub->expects( $this->once() )->method( 'addCoupon' ); |
|
146 | + $this->stub->expects($this->once())->method('addCoupon'); |
|
147 | 147 | |
148 | - $this->object->addCoupon( 'test' ); |
|
148 | + $this->object->addCoupon('test'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | public function testDeleteCoupon() |
153 | 153 | { |
154 | - $this->stub->expects( $this->once() )->method( 'deleteCoupon' ); |
|
154 | + $this->stub->expects($this->once())->method('deleteCoupon'); |
|
155 | 155 | |
156 | - $this->object->deleteCoupon( 'test' ); |
|
156 | + $this->object->deleteCoupon('test'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
160 | 160 | public function testSetAddress() |
161 | 161 | { |
162 | - $this->stub->expects( $this->once() )->method( 'setAddress' ); |
|
162 | + $this->stub->expects($this->once())->method('setAddress'); |
|
163 | 163 | |
164 | - $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null ); |
|
164 | + $this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
168 | 168 | public function testAddService() |
169 | 169 | { |
170 | - $this->stub->expects( $this->once() )->method( 'addService' ); |
|
170 | + $this->stub->expects($this->once())->method('addService'); |
|
171 | 171 | |
172 | - $this->object->addService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1 ); |
|
172 | + $this->object->addService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | public function testDeleteService() |
177 | 177 | { |
178 | - $this->stub->expects( $this->once() )->method( 'deleteService' ); |
|
178 | + $this->stub->expects($this->once())->method('deleteService'); |
|
179 | 179 | |
180 | - $this->object->deleteService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ); |
|
180 | + $this->object->deleteService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testGetController() |
185 | 185 | { |
186 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
186 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
187 | 187 | |
188 | - $this->assertSame( $this->stub, $result ); |
|
188 | + $this->assertSame($this->stub, $result); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
192 | - protected function access( $name ) |
|
192 | + protected function access($name) |
|
193 | 193 | { |
194 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' ); |
|
195 | - $method = $class->getMethod( $name ); |
|
196 | - $method->setAccessible( true ); |
|
194 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Decorator\Base'); |
|
195 | + $method = $class->getMethod($name); |
|
196 | + $method->setAccessible(true); |
|
197 | 197 | |
198 | 198 | return $method; |
199 | 199 | } |