@@ -96,7 +96,6 @@ |
||
96 | 96 | { |
97 | 97 | /** |
98 | 98 | * @param string $classprefix |
99 | - * @param string $path |
|
100 | 99 | */ |
101 | 100 | public static function addDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
102 | 101 | \Aimeos\Admin\JQAdm\Iface $client, $templatePaths, array $decorators, $classprefix ) |
@@ -17,76 +17,76 @@ discard block |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | |
22 | 22 | $config = $this->context->getConfig(); |
23 | - $config->set( 'admin/jqadm/common/decorators/default', array() ); |
|
24 | - $config->set( 'admin/jqadm/decorators/global', array() ); |
|
25 | - $config->set( 'admin/jqadm/decorators/local', array() ); |
|
23 | + $config->set('admin/jqadm/common/decorators/default', array()); |
|
24 | + $config->set('admin/jqadm/decorators/global', array()); |
|
25 | + $config->set('admin/jqadm/decorators/local', array()); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testInjectClient() |
31 | 31 | { |
32 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
33 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client ); |
|
32 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
33 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client); |
|
34 | 34 | |
35 | - $iClient = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
35 | + $iClient = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
36 | 36 | |
37 | - $this->assertSame( $client, $iClient ); |
|
37 | + $this->assertSame($client, $iClient); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | public function testInjectClientReset() |
42 | 42 | { |
43 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
44 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client ); |
|
45 | - \Aimeos\Admin\JQAdm\Product\Factory::injectClient( '\\Aimeos\\Admin\\JQAdm\\Product\\Standard', null ); |
|
43 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
44 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', $client); |
|
45 | + \Aimeos\Admin\JQAdm\Product\Factory::injectClient('\\Aimeos\\Admin\\JQAdm\\Product\\Standard', null); |
|
46 | 46 | |
47 | - $new = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
47 | + $new = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
48 | 48 | |
49 | - $this->assertNotSame( $client, $new ); |
|
49 | + $this->assertNotSame($client, $new); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testAddDecoratorsInvalidName() |
54 | 54 | { |
55 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
55 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
56 | 56 | |
57 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
58 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, array(), |
|
59 | - array( '$' ), 'Test' ); |
|
57 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
58 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, array(), |
|
59 | + array('$'), 'Test'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testAddDecoratorsInvalidClass() |
64 | 64 | { |
65 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
65 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
66 | 66 | |
67 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
68 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, array(), |
|
69 | - array( 'Test' ), 'TestDecorator' ); |
|
67 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
68 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, array(), |
|
69 | + array('Test'), 'TestDecorator'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testAddDecoratorsInvalidInterface() |
74 | 74 | { |
75 | - $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
75 | + $client = \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
76 | 76 | |
77 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
78 | - \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $this->context, $client, array(), |
|
79 | - array( 'Test' ), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\' ); |
|
77 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
78 | + \Aimeos\Admin\JQAdm\Common\Factory\TestAbstract::addDecoratorsPublic($this->context, $client, array(), |
|
79 | + array('Test'), '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testAddClientDecoratorsExcludes() |
84 | 84 | { |
85 | - $this->context->getConfig()->set( 'admin/jqadm/decorators/excludes', array( 'TestDecorator' ) ); |
|
86 | - $this->context->getConfig()->set( 'admin/jqadm/common/decorators/default', array( 'TestDecorator' ) ); |
|
85 | + $this->context->getConfig()->set('admin/jqadm/decorators/excludes', array('TestDecorator')); |
|
86 | + $this->context->getConfig()->set('admin/jqadm/common/decorators/default', array('TestDecorator')); |
|
87 | 87 | |
88 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
89 | - \Aimeos\Admin\JQAdm\Product\Factory::createClient( $this->context, array(), 'Standard' ); |
|
88 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
89 | + \Aimeos\Admin\JQAdm\Product\Factory::createClient($this->context, array(), 'Standard'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | * @param string $classprefix |
99 | 99 | * @param string $path |
100 | 100 | */ |
101 | - public static function addDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
102 | - \Aimeos\Admin\JQAdm\Iface $client, $templatePaths, array $decorators, $classprefix ) |
|
101 | + public static function addDecoratorsPublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
102 | + \Aimeos\Admin\JQAdm\Iface $client, $templatePaths, array $decorators, $classprefix) |
|
103 | 103 | { |
104 | - self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
104 | + self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
105 | 105 | } |
106 | 106 | |
107 | - public static function addClientDecoratorsPublic( \Aimeos\MShop\Context\Item\Iface $context, |
|
108 | - \Aimeos\Admin\JQAdm\Iface $client, $templatePaths, $path ) |
|
107 | + public static function addClientDecoratorsPublic(\Aimeos\MShop\Context\Item\Iface $context, |
|
108 | + \Aimeos\Admin\JQAdm\Iface $client, $templatePaths, $path) |
|
109 | 109 | { |
110 | - self::addClientDecorators( $context, $client, $templatePaths, $path ); |
|
110 | + self::addClientDecorators($context, $client, $templatePaths, $path); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
34 | 34 | * and a list of relative paths inside the core or the extension as values |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
36 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->templatePaths = $templatePaths; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param array $param List of method parameter |
48 | 48 | * @return boolean False for every call |
49 | 49 | */ |
50 | - public function __call( $name, array $param ) |
|
50 | + public function __call($name, array $param) |
|
51 | 51 | { |
52 | 52 | return false; |
53 | 53 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getView() |
62 | 62 | { |
63 | - if( !isset( $this->view ) ) { |
|
64 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No view available' ) ); |
|
63 | + if (!isset($this->view)) { |
|
64 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No view available')); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $this->view; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
75 | 75 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
76 | 76 | */ |
77 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
77 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
78 | 78 | { |
79 | 79 | $this->view = $view; |
80 | 80 | return $this; |
@@ -110,29 +110,29 @@ discard block |
||
110 | 110 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\" |
111 | 111 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
112 | 112 | */ |
113 | - protected function addDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
114 | - array $decorators, $classprefix ) |
|
113 | + protected function addDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
114 | + array $decorators, $classprefix) |
|
115 | 115 | { |
116 | 116 | $iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface'; |
117 | 117 | |
118 | - foreach( $decorators as $name ) |
|
118 | + foreach ($decorators as $name) |
|
119 | 119 | { |
120 | - if( ctype_alnum( $name ) === false ) |
|
120 | + if (ctype_alnum($name) === false) |
|
121 | 121 | { |
122 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
123 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
122 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
123 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | $classname = $classprefix . $name; |
127 | 127 | |
128 | - if( class_exists( $classname ) === false ) { |
|
129 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
128 | + if (class_exists($classname) === false) { |
|
129 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
130 | 130 | } |
131 | 131 | |
132 | - $client = new $classname( $client, $this->context, $this->templatePaths ); |
|
132 | + $client = new $classname($client, $this->context, $this->templatePaths); |
|
133 | 133 | |
134 | - if( !( $client instanceof $iface ) ) { |
|
135 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
134 | + if (!($client instanceof $iface)) { |
|
135 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface)); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -148,35 +148,35 @@ discard block |
||
148 | 148 | * @param string $path Admin string in lower case, e.g. "catalog/detail/basic" |
149 | 149 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
150 | 150 | */ |
151 | - protected function addClientDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path ) |
|
151 | + protected function addClientDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path) |
|
152 | 152 | { |
153 | - if( !is_string( $path ) || $path === '' ) { |
|
154 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
153 | + if (!is_string($path) || $path === '') { |
|
154 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path)); |
|
155 | 155 | } |
156 | 156 | |
157 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
157 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
158 | 158 | $config = $this->context->getConfig(); |
159 | 159 | |
160 | - $decorators = $config->get( 'admin/jqadm/common/decorators/default', array() ); |
|
161 | - $excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() ); |
|
160 | + $decorators = $config->get('admin/jqadm/common/decorators/default', array()); |
|
161 | + $excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array()); |
|
162 | 162 | |
163 | - foreach( $decorators as $key => $name ) |
|
163 | + foreach ($decorators as $key => $name) |
|
164 | 164 | { |
165 | - if( in_array( $name, $excludes ) ) { |
|
166 | - unset( $decorators[$key] ); |
|
165 | + if (in_array($name, $excludes)) { |
|
166 | + unset($decorators[$key]); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
171 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
171 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
172 | 172 | |
173 | 173 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
174 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() ); |
|
175 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
174 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array()); |
|
175 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
176 | 176 | |
177 | 177 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\'; |
178 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() ); |
|
179 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
178 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array()); |
|
179 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
180 | 180 | |
181 | 181 | return $client; |
182 | 182 | } |
@@ -189,35 +189,35 @@ discard block |
||
189 | 189 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
190 | 190 | * @return \Aimeos\Admin\JQAdm\Iface Sub-part object |
191 | 191 | */ |
192 | - protected function createSubClient( $path, $name ) |
|
192 | + protected function createSubClient($path, $name) |
|
193 | 193 | { |
194 | - $path = strtolower( $path ); |
|
194 | + $path = strtolower($path); |
|
195 | 195 | |
196 | - if( $name === null ) { |
|
197 | - $name = $this->context->getConfig()->get( 'admin/jqadm/' . $path . '/name', 'Standard' ); |
|
196 | + if ($name === null) { |
|
197 | + $name = $this->context->getConfig()->get('admin/jqadm/' . $path . '/name', 'Standard'); |
|
198 | 198 | } |
199 | 199 | |
200 | - if( empty( $name ) || ctype_alnum( $name ) === false ) { |
|
201 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $name ) ); |
|
200 | + if (empty($name) || ctype_alnum($name) === false) { |
|
201 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $name)); |
|
202 | 202 | } |
203 | 203 | |
204 | - $subnames = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
204 | + $subnames = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
205 | 205 | |
206 | 206 | $classname = '\\Aimeos\\Admin\\JQAdm\\' . $subnames . '\\' . $name; |
207 | 207 | $interface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
208 | 208 | |
209 | - if( class_exists( $classname ) === false ) { |
|
210 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
209 | + if (class_exists($classname) === false) { |
|
210 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
211 | 211 | } |
212 | 212 | |
213 | - $object = new $classname( $this->context, $this->templatePaths ); |
|
213 | + $object = new $classname($this->context, $this->templatePaths); |
|
214 | 214 | |
215 | - if( ( $object instanceof $interface ) === false ) { |
|
216 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
215 | + if (($object instanceof $interface) === false) { |
|
216 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
217 | 217 | } |
218 | 218 | |
219 | - $object = $this->addClientDecorators( $object, $this->templatePaths, $path ); |
|
220 | - $object->setView( $this->view ); |
|
219 | + $object = $this->addClientDecorators($object, $this->templatePaths, $path); |
|
220 | + $object->setView($this->view); |
|
221 | 221 | |
222 | 222 | return $object; |
223 | 223 | } |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | * @param array $names List of parameter names |
230 | 230 | * @return array Associative list of parameters names as key and their values |
231 | 231 | */ |
232 | - protected function getClientParams( $names = array( 'resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort' ) ) |
|
232 | + protected function getClientParams($names = array('resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort')) |
|
233 | 233 | { |
234 | 234 | $list = array(); |
235 | 235 | |
236 | - foreach( $names as $name ) |
|
236 | + foreach ($names as $name) |
|
237 | 237 | { |
238 | - if( ( $val = $this->view->param( $name ) ) !== null ) { |
|
238 | + if (($val = $this->view->param($name)) !== null) { |
|
239 | 239 | $list[$name] = $val; |
240 | 240 | } |
241 | 241 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function getSubClients() |
272 | 272 | { |
273 | - if( !isset( $this->subclients ) ) |
|
273 | + if (!isset($this->subclients)) |
|
274 | 274 | { |
275 | 275 | $this->subclients = array(); |
276 | 276 | |
277 | - foreach( $this->getSubClientNames() as $name ) { |
|
278 | - $this->subclients[] = $this->getSubClient( $name ); |
|
277 | + foreach ($this->getSubClientNames() as $name) { |
|
278 | + $this->subclients[] = $this->getSubClient($name); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | * @param array $params List of criteria data with condition, sorting and paging |
302 | 302 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
303 | 303 | */ |
304 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
304 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
305 | 305 | { |
306 | - $this->initCriteriaConditions( $criteria, $params ); |
|
307 | - $this->initCriteriaSortations( $criteria, $params ); |
|
308 | - $this->initCriteriaSlice( $criteria, $params ); |
|
306 | + $this->initCriteriaConditions($criteria, $params); |
|
307 | + $this->initCriteriaSortations($criteria, $params); |
|
308 | + $this->initCriteriaSlice($criteria, $params); |
|
309 | 309 | |
310 | 310 | return $criteria; |
311 | 311 | } |
@@ -317,24 +317,24 @@ discard block |
||
317 | 317 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
318 | 318 | * @param array $params List of criteria data with condition, sorting and paging |
319 | 319 | */ |
320 | - private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
320 | + private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
321 | 321 | { |
322 | - if( isset( $params['filter'] ) && isset( $params['filter']['key'] ) ) |
|
322 | + if (isset($params['filter']) && isset($params['filter']['key'])) |
|
323 | 323 | { |
324 | 324 | $expr = array(); |
325 | 325 | $existing = $criteria->getConditions(); |
326 | 326 | |
327 | - foreach( (array) $params['filter']['key'] as $idx => $key ) |
|
327 | + foreach ((array) $params['filter']['key'] as $idx => $key) |
|
328 | 328 | { |
329 | - if( $key != '' && isset( $params['filter']['op'][$idx] ) && $params['filter']['op'][$idx] != '' |
|
330 | - && isset( $params['filter']['val'][$idx] ) |
|
329 | + if ($key != '' && isset($params['filter']['op'][$idx]) && $params['filter']['op'][$idx] != '' |
|
330 | + && isset($params['filter']['val'][$idx]) |
|
331 | 331 | ) { |
332 | - $expr[] = $criteria->compare( $params['filter']['op'][$idx], $key, $params['filter']['val'][$idx] ); |
|
332 | + $expr[] = $criteria->compare($params['filter']['op'][$idx], $key, $params['filter']['val'][$idx]); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | $expr[] = $existing; |
337 | - $criteria->setConditions( $criteria->combine( '&&', $expr ) ); |
|
337 | + $criteria->setConditions($criteria->combine('&&', $expr)); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
346 | 346 | * @param array $params List of criteria data with condition, sorting and paging |
347 | 347 | */ |
348 | - private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
348 | + private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
349 | 349 | { |
350 | - $start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 ); |
|
351 | - $size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 100 ); |
|
350 | + $start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0); |
|
351 | + $size = (isset($params['page']['limit']) ? $params['page']['limit'] : 100); |
|
352 | 352 | |
353 | - $criteria->setSlice( $start, $size ); |
|
353 | + $criteria->setSlice($start, $size); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -360,23 +360,23 @@ discard block |
||
360 | 360 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
361 | 361 | * @param array $params List of criteria data with condition, sorting and paging |
362 | 362 | */ |
363 | - private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
363 | + private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
364 | 364 | { |
365 | - if( !isset( $params['sort'] ) ) { |
|
365 | + if (!isset($params['sort'])) { |
|
366 | 366 | return; |
367 | 367 | } |
368 | 368 | |
369 | 369 | $sortation = array(); |
370 | 370 | |
371 | - foreach( (array) $params['sort'] as $sort ) |
|
371 | + foreach ((array) $params['sort'] as $sort) |
|
372 | 372 | { |
373 | - if( $sort[0] === '-' ) { |
|
374 | - $sortation[] = $criteria->sort( '-', substr( $sort, 1 ) ); |
|
373 | + if ($sort[0] === '-') { |
|
374 | + $sortation[] = $criteria->sort('-', substr($sort, 1)); |
|
375 | 375 | } else { |
376 | - $sortation[] = $criteria->sort( '+', $sort ); break; |
|
376 | + $sortation[] = $criteria->sort('+', $sort); break; |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - $criteria->setSortations( $sortation ); |
|
380 | + $criteria->setSortations($sortation); |
|
381 | 381 | } |
382 | 382 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
33 | 33 | * and a list of relative paths inside the core or the extension as values |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\Admin\JQAdm\Iface $client, |
|
36 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
35 | + public function __construct(\Aimeos\Admin\JQAdm\Iface $client, |
|
36 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
37 | 37 | { |
38 | - parent::__construct( $context, $templatePaths ); |
|
38 | + parent::__construct($context, $templatePaths); |
|
39 | 39 | |
40 | 40 | $this->client = $client; |
41 | 41 | } |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @return mixed Returns the value of the called method |
50 | 50 | * @throws \Aimeos\Admin\JQAdm\Exception If method call failed |
51 | 51 | */ |
52 | - public function __call( $name, array $param ) |
|
52 | + public function __call($name, array $param) |
|
53 | 53 | { |
54 | - if( ( $result = @call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
55 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
54 | + if (($result = @call_user_func_array(array($this->client, $name), $param)) === false) { |
|
55 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Unable to call method "%1$s"', $name)); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | return $result; |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | * @param string|null $name Name of the sub-client (Default if null) |
133 | 133 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
134 | 134 | */ |
135 | - public function getSubClient( $type, $name = null ) |
|
135 | + public function getSubClient($type, $name = null) |
|
136 | 136 | { |
137 | - return $this->client->getSubClient( $type, $name ); |
|
137 | + return $this->client->getSubClient($type, $name); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
156 | 156 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
157 | 157 | */ |
158 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
158 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
159 | 159 | { |
160 | - $this->client->setView( $view ); |
|
160 | + $this->client->setView($view); |
|
161 | 161 | return $this; |
162 | 162 | } |
163 | 163 |
@@ -22,44 +22,44 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Selection\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Selection\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | - $this->assertStringStartsWith( '<div class="product-item-selection', $result ); |
|
43 | + $this->assertNull($this->view->get('errors')); |
|
44 | + $this->assertStringStartsWith('<div class="product-item-selection', $result); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'U:TEST', array( 'product' ) ); |
|
52 | + $this->view->item = $manager->findItem('U:TEST', array('product')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'U:TESTSUB01', $result ); |
|
57 | - $this->assertContains( 'U:TESTSUB02', $result ); |
|
58 | - $this->assertContains( 'U:TESTSUB03', $result ); |
|
59 | - $this->assertContains( 'U:TESTSUB04', $result ); |
|
60 | - $this->assertContains( 'U:TESTSUB05', $result ); |
|
61 | - $this->assertContains( 'value="30"', $result ); |
|
62 | - $this->assertContains( 'value="32"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('U:TESTSUB01', $result); |
|
57 | + $this->assertContains('U:TESTSUB02', $result); |
|
58 | + $this->assertContains('U:TESTSUB03', $result); |
|
59 | + $this->assertContains('U:TESTSUB04', $result); |
|
60 | + $this->assertContains('U:TESTSUB05', $result); |
|
61 | + $this->assertContains('value="30"', $result); |
|
62 | + $this->assertContains('value="32"', $result); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -67,124 +67,124 @@ discard block |
||
67 | 67 | { |
68 | 68 | $param = array( |
69 | 69 | 'selection' => array( |
70 | - 'product.id' => array( 0 => '' ), |
|
71 | - 'product.code' => array( 0 => 'testprod' ), |
|
72 | - 'product.label' => array( 0 => 'test product' ), |
|
70 | + 'product.id' => array(0 => ''), |
|
71 | + 'product.code' => array(0 => 'testprod'), |
|
72 | + 'product.label' => array(0 => 'test product'), |
|
73 | 73 | 'attr' => array( |
74 | - 'id' => array( 0 => '123' ), |
|
75 | - 'label' => array( 0 => 'test attribute' ), |
|
76 | - 'ref' => array( 0 => 'testprod' ), |
|
74 | + 'id' => array(0 => '123'), |
|
75 | + 'label' => array(0 => 'test attribute'), |
|
76 | + 'ref' => array(0 => 'testprod'), |
|
77 | 77 | ) |
78 | 78 | ), |
79 | 79 | ); |
80 | 80 | |
81 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
82 | - $this->view->addHelper( 'param', $helper ); |
|
81 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
82 | + $this->view->addHelper('param', $helper); |
|
83 | 83 | |
84 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
85 | - $this->view->item = $manager->findItem( 'U:TEST' ); |
|
84 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
85 | + $this->view->item = $manager->findItem('U:TEST'); |
|
86 | 86 | |
87 | 87 | $result = $this->object->get(); |
88 | 88 | |
89 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
90 | - $this->assertContains( 'testprod', $result ); |
|
91 | - $this->assertContains( 'value="123"', $result ); |
|
89 | + $this->assertNull($this->view->get('errors')); |
|
90 | + $this->assertContains('testprod', $result); |
|
91 | + $this->assertContains('value="123"', $result); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | public function testSave() |
96 | 96 | { |
97 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
97 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
98 | 98 | |
99 | - $item = $manager->findItem( 'U:TEST' ); |
|
100 | - $item->setCode( 'jqadm-test-selection' ); |
|
101 | - $item->setId( null ); |
|
99 | + $item = $manager->findItem('U:TEST'); |
|
100 | + $item->setCode('jqadm-test-selection'); |
|
101 | + $item->setId(null); |
|
102 | 102 | |
103 | - $manager->saveItem( $item ); |
|
103 | + $manager->saveItem($item); |
|
104 | 104 | |
105 | - $attrManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
106 | - $attrItem = $attrManager->findItem( 'xs', array(), 'product', 'size' ); |
|
105 | + $attrManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
106 | + $attrItem = $attrManager->findItem('xs', array(), 'product', 'size'); |
|
107 | 107 | |
108 | 108 | |
109 | 109 | $param = array( |
110 | 110 | 'selection' => array( |
111 | - 'product.lists.id' => array( 0 => '' ), |
|
112 | - 'product.id' => array( 0 => $item->getId() ), |
|
113 | - 'product.code' => array( 0 => 'testprod' ), |
|
114 | - 'product.label' => array( 0 => 'test product' ), |
|
111 | + 'product.lists.id' => array(0 => ''), |
|
112 | + 'product.id' => array(0 => $item->getId()), |
|
113 | + 'product.code' => array(0 => 'testprod'), |
|
114 | + 'product.label' => array(0 => 'test product'), |
|
115 | 115 | 'attr' => array( |
116 | - 'id' => array( 0 => $attrItem->getId() ), |
|
117 | - 'label' => array( 0 => 'test attribute' ), |
|
118 | - 'ref' => array( 0 => 'testprod' ), |
|
116 | + 'id' => array(0 => $attrItem->getId()), |
|
117 | + 'label' => array(0 => 'test attribute'), |
|
118 | + 'ref' => array(0 => 'testprod'), |
|
119 | 119 | ) |
120 | 120 | ), |
121 | 121 | ); |
122 | 122 | |
123 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
124 | - $this->view->addHelper( 'param', $helper ); |
|
123 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
124 | + $this->view->addHelper('param', $helper); |
|
125 | 125 | $this->view->item = $item; |
126 | 126 | |
127 | 127 | $result = $this->object->save(); |
128 | 128 | |
129 | - $item = $manager->getItem( $item->getId(), array( 'product' ) ); |
|
130 | - $variants = $item->getListItems( 'product', 'default' ); |
|
129 | + $item = $manager->getItem($item->getId(), array('product')); |
|
130 | + $variants = $item->getListItems('product', 'default'); |
|
131 | 131 | |
132 | - if( empty( $variants ) ) { |
|
133 | - throw new \Exception( 'No variant products available' ); |
|
132 | + if (empty($variants)) { |
|
133 | + throw new \Exception('No variant products available'); |
|
134 | 134 | } |
135 | 135 | |
136 | - $variant = $manager->getItem( reset( $variants )->getRefId(), array( 'attribute' ) ); |
|
137 | - $attributes = $variant->getListItems( 'attribute', 'variant' ); |
|
136 | + $variant = $manager->getItem(reset($variants)->getRefId(), array('attribute')); |
|
137 | + $attributes = $variant->getListItems('attribute', 'variant'); |
|
138 | 138 | |
139 | - $manager->deleteItems( array( $item->getId(), $variant->getId() ) ); |
|
139 | + $manager->deleteItems(array($item->getId(), $variant->getId())); |
|
140 | 140 | |
141 | 141 | |
142 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
143 | - $this->assertNull( $result ); |
|
144 | - $this->assertEquals( 1, count( $variants ) ); |
|
145 | - $this->assertEquals( 1, count( $attributes ) ); |
|
146 | - $this->assertEquals( 'testprod', $variant->getCode() ); |
|
147 | - $this->assertEquals( $attrItem->getId(), reset( $attributes )->getRefId() ); |
|
142 | + $this->assertNull($this->view->get('errors')); |
|
143 | + $this->assertNull($result); |
|
144 | + $this->assertEquals(1, count($variants)); |
|
145 | + $this->assertEquals(1, count($attributes)); |
|
146 | + $this->assertEquals('testprod', $variant->getCode()); |
|
147 | + $this->assertEquals($attrItem->getId(), reset($attributes)->getRefId()); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | public function testSaveException() |
152 | 152 | { |
153 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Selection\Standard' ) |
|
154 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
155 | - ->setMethods( array( 'updateItems' ) ) |
|
153 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Selection\Standard') |
|
154 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
155 | + ->setMethods(array('updateItems')) |
|
156 | 156 | ->getMock(); |
157 | 157 | |
158 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
159 | - ->will( $this->throwException( new \Exception() ) ); |
|
158 | + $object->expects($this->once())->method('updateItems') |
|
159 | + ->will($this->throwException(new \Exception())); |
|
160 | 160 | |
161 | - $object->setView( \TestHelperJqadm::getView() ); |
|
161 | + $object->setView(\TestHelperJqadm::getView()); |
|
162 | 162 | |
163 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
163 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
164 | 164 | $object->save(); |
165 | 165 | } |
166 | 166 | |
167 | 167 | |
168 | 168 | public function testSaveMShopException() |
169 | 169 | { |
170 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Selection\Standard' ) |
|
171 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
172 | - ->setMethods( array( 'updateItems' ) ) |
|
170 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Selection\Standard') |
|
171 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
172 | + ->setMethods(array('updateItems')) |
|
173 | 173 | ->getMock(); |
174 | 174 | |
175 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
176 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
175 | + $object->expects($this->once())->method('updateItems') |
|
176 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
177 | 177 | |
178 | - $object->setView( \TestHelperJqadm::getView() ); |
|
178 | + $object->setView(\TestHelperJqadm::getView()); |
|
179 | 179 | |
180 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
180 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
181 | 181 | $object->save(); |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | public function testGetSubClient() |
186 | 186 | { |
187 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
188 | - $this->object->getSubClient( 'invalid' ); |
|
187 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
188 | + $this->object->getSubClient('invalid'); |
|
189 | 189 | } |
190 | 190 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Texts', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Texts', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'ABCD', array( 'text' ) ); |
|
52 | + $this->view->item = $manager->findItem('ABCD', array('text')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="Unterproduct 1"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="Unterproduct 1"', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,113 +61,113 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'ABCD', array( 'text' ) ); |
|
73 | + $this->view->item = $manager->findItem('ABCD', array('text')); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'value="Unterproduct 1"', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('value="Unterproduct 1"', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
83 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
84 | 84 | |
85 | - $item = $manager->findItem( 'CNC' ); |
|
86 | - $item->setCode( 'jqadm-test-save' ); |
|
87 | - $item->setId( null ); |
|
85 | + $item = $manager->findItem('CNC'); |
|
86 | + $item->setCode('jqadm-test-save'); |
|
87 | + $item->setId(null); |
|
88 | 88 | |
89 | - $manager->saveItem( $item ); |
|
89 | + $manager->saveItem($item); |
|
90 | 90 | |
91 | 91 | |
92 | 92 | $param = array( |
93 | 93 | 'text' => array( |
94 | - 'langid' => array( 'de' ), |
|
95 | - 'name' => array( 'listid' => '', 'content' => 'test name' ), |
|
96 | - 'short' => array( 'listid' => '', 'content' => 'short desc' ), |
|
97 | - 'long' => array( 'listid' => '', 'content' => 'long desc' ), |
|
98 | - 'url' => array( 'listid' => '', 'content' => 'url segment' ), |
|
99 | - 'meta-keyword' => array( 'listid' => '', 'content' => 'meta keywords' ), |
|
100 | - 'meta-description' => array( 'listid' => '', 'content' => 'meta desc' ), |
|
94 | + 'langid' => array('de'), |
|
95 | + 'name' => array('listid' => '', 'content' => 'test name'), |
|
96 | + 'short' => array('listid' => '', 'content' => 'short desc'), |
|
97 | + 'long' => array('listid' => '', 'content' => 'long desc'), |
|
98 | + 'url' => array('listid' => '', 'content' => 'url segment'), |
|
99 | + 'meta-keyword' => array('listid' => '', 'content' => 'meta keywords'), |
|
100 | + 'meta-description' => array('listid' => '', 'content' => 'meta desc'), |
|
101 | 101 | ), |
102 | 102 | ); |
103 | 103 | |
104 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
105 | - $this->view->addHelper( 'param', $helper ); |
|
104 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
105 | + $this->view->addHelper('param', $helper); |
|
106 | 106 | $this->view->item = $item; |
107 | 107 | |
108 | 108 | $result = $this->object->save(); |
109 | 109 | |
110 | - $item = $manager->getItem( $item->getId(), array( 'text' ) ); |
|
111 | - $manager->deleteItem( $item->getId() ); |
|
110 | + $item = $manager->getItem($item->getId(), array('text')); |
|
111 | + $manager->deleteItem($item->getId()); |
|
112 | 112 | |
113 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
114 | - $this->assertNull( $result ); |
|
115 | - $this->assertEquals( 6, count( $item->getListItems() ) ); |
|
113 | + $this->assertNull($this->view->get('errors')); |
|
114 | + $this->assertNull($result); |
|
115 | + $this->assertEquals(6, count($item->getListItems())); |
|
116 | 116 | |
117 | - foreach( $item->getListItems( 'text' ) as $listItem ) |
|
117 | + foreach ($item->getListItems('text') as $listItem) |
|
118 | 118 | { |
119 | - $this->assertEquals( 'text', $listItem->getDomain() ); |
|
120 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
119 | + $this->assertEquals('text', $listItem->getDomain()); |
|
120 | + $this->assertEquals('default', $listItem->getType()); |
|
121 | 121 | |
122 | 122 | $refItem = $listItem->getRefItem(); |
123 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
123 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | 128 | public function testSaveException() |
129 | 129 | { |
130 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Text\Standard' ) |
|
131 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
132 | - ->setMethods( array( 'updateItems' ) ) |
|
130 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Text\Standard') |
|
131 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
132 | + ->setMethods(array('updateItems')) |
|
133 | 133 | ->getMock(); |
134 | 134 | |
135 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
136 | - ->will( $this->throwException( new \Exception() ) ); |
|
135 | + $object->expects($this->once())->method('updateItems') |
|
136 | + ->will($this->throwException(new \Exception())); |
|
137 | 137 | |
138 | - $object->setView( \TestHelperJqadm::getView() ); |
|
138 | + $object->setView(\TestHelperJqadm::getView()); |
|
139 | 139 | |
140 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
140 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
141 | 141 | $object->save(); |
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | 145 | public function testSaveMShopException() |
146 | 146 | { |
147 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Text\Standard' ) |
|
148 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
149 | - ->setMethods( array( 'updateItems' ) ) |
|
147 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Text\Standard') |
|
148 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
149 | + ->setMethods(array('updateItems')) |
|
150 | 150 | ->getMock(); |
151 | 151 | |
152 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
153 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
152 | + $object->expects($this->once())->method('updateItems') |
|
153 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
154 | 154 | |
155 | - $object->setView( \TestHelperJqadm::getView() ); |
|
155 | + $object->setView(\TestHelperJqadm::getView()); |
|
156 | 156 | |
157 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
157 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
158 | 158 | $object->save(); |
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testSearch() |
163 | 163 | { |
164 | - $this->assertNull( $this->object->search() ); |
|
164 | + $this->assertNull($this->object->search()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
168 | 168 | public function testGetSubClient() |
169 | 169 | { |
170 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
171 | - $this->object->getSubClient( 'invalid' ); |
|
170 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
171 | + $this->object->getSubClient('invalid'); |
|
172 | 172 | } |
173 | 173 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Price\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Price\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Prices', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Prices', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC', array( 'price' ) ); |
|
52 | + $this->view->item = $manager->findItem('CNC', array('price')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="for 1 product"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="for 1 product"', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,123 +61,123 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'CNC', array( 'price' ) ); |
|
73 | + $this->view->item = $manager->findItem('CNC', array('price')); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'value="for 1 product"', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('value="for 1 product"', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'price/type' ); |
|
84 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
83 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'price/type'); |
|
84 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
85 | 85 | |
86 | - $item = $manager->findItem( 'CNC' ); |
|
87 | - $item->setCode( 'jqadm-test-price' ); |
|
88 | - $item->setId( null ); |
|
86 | + $item = $manager->findItem('CNC'); |
|
87 | + $item->setCode('jqadm-test-price'); |
|
88 | + $item->setId(null); |
|
89 | 89 | |
90 | - $manager->saveItem( $item ); |
|
90 | + $manager->saveItem($item); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | $param = array( |
94 | 94 | 'price' => array( |
95 | - 'product.lists.id' => array( '' ), |
|
96 | - 'price.typeid' => array( $typeManager->findItem( 'default', array(), 'product' )->getId() ), |
|
97 | - 'price.currencyid' => array( 'EUR' ), |
|
98 | - 'price.label' => array( 'test' ), |
|
99 | - 'price.quantity' => array( '2' ), |
|
100 | - 'price.value' => array( '10.00' ), |
|
101 | - 'price.costs' => array( '1.00' ), |
|
102 | - 'price.rebate' => array( '5.00' ), |
|
103 | - 'price.taxrate' => array( '20.00' ), |
|
95 | + 'product.lists.id' => array(''), |
|
96 | + 'price.typeid' => array($typeManager->findItem('default', array(), 'product')->getId()), |
|
97 | + 'price.currencyid' => array('EUR'), |
|
98 | + 'price.label' => array('test'), |
|
99 | + 'price.quantity' => array('2'), |
|
100 | + 'price.value' => array('10.00'), |
|
101 | + 'price.costs' => array('1.00'), |
|
102 | + 'price.rebate' => array('5.00'), |
|
103 | + 'price.taxrate' => array('20.00'), |
|
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
108 | - $this->view->addHelper( 'param', $helper ); |
|
107 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
108 | + $this->view->addHelper('param', $helper); |
|
109 | 109 | $this->view->item = $item; |
110 | 110 | |
111 | 111 | $result = $this->object->save(); |
112 | 112 | |
113 | - $item = $manager->getItem( $item->getId(), array( 'price' ) ); |
|
114 | - $manager->deleteItem( $item->getId() ); |
|
113 | + $item = $manager->getItem($item->getId(), array('price')); |
|
114 | + $manager->deleteItem($item->getId()); |
|
115 | 115 | |
116 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
117 | - $this->assertNull( $result ); |
|
118 | - $this->assertEquals( 1, count( $item->getListItems() ) ); |
|
116 | + $this->assertNull($this->view->get('errors')); |
|
117 | + $this->assertNull($result); |
|
118 | + $this->assertEquals(1, count($item->getListItems())); |
|
119 | 119 | |
120 | - foreach( $item->getListItems( 'price' ) as $listItem ) |
|
120 | + foreach ($item->getListItems('price') as $listItem) |
|
121 | 121 | { |
122 | - $this->assertEquals( 'price', $listItem->getDomain() ); |
|
123 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
122 | + $this->assertEquals('price', $listItem->getDomain()); |
|
123 | + $this->assertEquals('default', $listItem->getType()); |
|
124 | 124 | |
125 | 125 | $refItem = $listItem->getRefItem(); |
126 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
127 | - $this->assertEquals( 'EUR', $refItem->getCurrencyId() ); |
|
128 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
129 | - $this->assertEquals( '2', $refItem->getQuantity() ); |
|
130 | - $this->assertEquals( '10.00', $refItem->getValue() ); |
|
131 | - $this->assertEquals( '1.00', $refItem->getCosts() ); |
|
132 | - $this->assertEquals( '5.00', $refItem->getRebate() ); |
|
133 | - $this->assertEquals( '20.00', $refItem->getTaxRate() ); |
|
126 | + $this->assertEquals('default', $refItem->getType()); |
|
127 | + $this->assertEquals('EUR', $refItem->getCurrencyId()); |
|
128 | + $this->assertEquals('test', $refItem->getLabel()); |
|
129 | + $this->assertEquals('2', $refItem->getQuantity()); |
|
130 | + $this->assertEquals('10.00', $refItem->getValue()); |
|
131 | + $this->assertEquals('1.00', $refItem->getCosts()); |
|
132 | + $this->assertEquals('5.00', $refItem->getRebate()); |
|
133 | + $this->assertEquals('20.00', $refItem->getTaxRate()); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | |
138 | 138 | public function testSaveException() |
139 | 139 | { |
140 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Price\Standard' ) |
|
141 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
142 | - ->setMethods( array( 'updateItems' ) ) |
|
140 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Price\Standard') |
|
141 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
142 | + ->setMethods(array('updateItems')) |
|
143 | 143 | ->getMock(); |
144 | 144 | |
145 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
146 | - ->will( $this->throwException( new \Exception() ) ); |
|
145 | + $object->expects($this->once())->method('updateItems') |
|
146 | + ->will($this->throwException(new \Exception())); |
|
147 | 147 | |
148 | - $object->setView( \TestHelperJqadm::getView() ); |
|
148 | + $object->setView(\TestHelperJqadm::getView()); |
|
149 | 149 | |
150 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
150 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
151 | 151 | $object->save(); |
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testSaveMShopException() |
156 | 156 | { |
157 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Price\Standard' ) |
|
158 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
159 | - ->setMethods( array( 'updateItems' ) ) |
|
157 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Price\Standard') |
|
158 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
159 | + ->setMethods(array('updateItems')) |
|
160 | 160 | ->getMock(); |
161 | 161 | |
162 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
163 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
162 | + $object->expects($this->once())->method('updateItems') |
|
163 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
164 | 164 | |
165 | - $object->setView( \TestHelperJqadm::getView() ); |
|
165 | + $object->setView(\TestHelperJqadm::getView()); |
|
166 | 166 | |
167 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
167 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
168 | 168 | $object->save(); |
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | 172 | public function testSearch() |
173 | 173 | { |
174 | - $this->assertNull( $this->object->search() ); |
|
174 | + $this->assertNull($this->object->search()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testGetSubClient() |
179 | 179 | { |
180 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
181 | - $this->object->getSubClient( 'invalid' ); |
|
180 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
181 | + $this->object->getSubClient('invalid'); |
|
182 | 182 | } |
183 | 183 | } |
@@ -22,124 +22,124 @@ |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Stock\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Stock\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | - $this->assertStringStartsWith( '<div class="product-item-stock', $result ); |
|
43 | + $this->assertNull($this->view->get('errors')); |
|
44 | + $this->assertStringStartsWith('<div class="product-item-stock', $result); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
52 | + $this->view->item = $manager->findItem('CNC'); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="1200"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="1200"', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testGet() |
61 | 61 | { |
62 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
62 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
63 | 63 | |
64 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
64 | + $this->view->item = $manager->findItem('CNC'); |
|
65 | 65 | $result = $this->object->get(); |
66 | 66 | |
67 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
68 | - $this->assertContains( 'value="1200"', $result ); |
|
67 | + $this->assertNull($this->view->get('errors')); |
|
68 | + $this->assertContains('value="1200"', $result); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | public function testSave() |
73 | 73 | { |
74 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
75 | - $whManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product/stock/warehouse' ); |
|
74 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
75 | + $whManager = \Aimeos\MShop\Factory::createManager($this->context, 'product/stock/warehouse'); |
|
76 | 76 | |
77 | - $item = $manager->findItem( 'CNC' ); |
|
78 | - $item->setCode( 'jqadm-test-stock' ); |
|
79 | - $item->setId( null ); |
|
77 | + $item = $manager->findItem('CNC'); |
|
78 | + $item->setCode('jqadm-test-stock'); |
|
79 | + $item->setId(null); |
|
80 | 80 | |
81 | - $manager->saveItem( $item ); |
|
81 | + $manager->saveItem($item); |
|
82 | 82 | |
83 | 83 | |
84 | 84 | $param = array( |
85 | 85 | 'stock' => array( |
86 | - 'product.stock.id' => array( '' ), |
|
87 | - 'product.stock.warehouseid' => array( $whManager->findItem( 'default' )->getId() ), |
|
88 | - 'product.stock.dateback' => array( '2000-01-01 00:00:00' ), |
|
89 | - 'product.stock.stocklevel' => array( '-1' ), |
|
86 | + 'product.stock.id' => array(''), |
|
87 | + 'product.stock.warehouseid' => array($whManager->findItem('default')->getId()), |
|
88 | + 'product.stock.dateback' => array('2000-01-01 00:00:00'), |
|
89 | + 'product.stock.stocklevel' => array('-1'), |
|
90 | 90 | ), |
91 | 91 | ); |
92 | 92 | |
93 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
94 | - $this->view->addHelper( 'param', $helper ); |
|
93 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
94 | + $this->view->addHelper('param', $helper); |
|
95 | 95 | $this->view->item = $item; |
96 | 96 | |
97 | 97 | $result = $this->object->save(); |
98 | 98 | |
99 | - $manager->deleteItem( $item->getId() ); |
|
99 | + $manager->deleteItem($item->getId()); |
|
100 | 100 | |
101 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
102 | - $this->assertNull( $result ); |
|
101 | + $this->assertNull($this->view->get('errors')); |
|
102 | + $this->assertNull($result); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
106 | 106 | public function testSaveException() |
107 | 107 | { |
108 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Stock\Standard' ) |
|
109 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
110 | - ->setMethods( array( 'updateItems' ) ) |
|
108 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Stock\Standard') |
|
109 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
110 | + ->setMethods(array('updateItems')) |
|
111 | 111 | ->getMock(); |
112 | 112 | |
113 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
114 | - ->will( $this->throwException( new \Exception() ) ); |
|
113 | + $object->expects($this->once())->method('updateItems') |
|
114 | + ->will($this->throwException(new \Exception())); |
|
115 | 115 | |
116 | - $object->setView( \TestHelperJqadm::getView() ); |
|
116 | + $object->setView(\TestHelperJqadm::getView()); |
|
117 | 117 | |
118 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
118 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
119 | 119 | $object->save(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | 123 | public function testSaveMShopException() |
124 | 124 | { |
125 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Stock\Standard' ) |
|
126 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
127 | - ->setMethods( array( 'updateItems' ) ) |
|
125 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Stock\Standard') |
|
126 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
127 | + ->setMethods(array('updateItems')) |
|
128 | 128 | ->getMock(); |
129 | 129 | |
130 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
131 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
130 | + $object->expects($this->once())->method('updateItems') |
|
131 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
132 | 132 | |
133 | - $object->setView( \TestHelperJqadm::getView() ); |
|
133 | + $object->setView(\TestHelperJqadm::getView()); |
|
134 | 134 | |
135 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
135 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
136 | 136 | $object->save(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | |
140 | 140 | public function testGetSubClient() |
141 | 141 | { |
142 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
143 | - $this->object->getSubClient( 'invalid' ); |
|
142 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
143 | + $this->object->getSubClient('invalid'); |
|
144 | 144 | } |
145 | 145 | } |
@@ -22,68 +22,68 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Physical\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Physical\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Physical', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Physical', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
52 | + $this->view->item = $manager->findItem('CNC'); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="20.0"', $result ); |
|
57 | - $this->assertContains( 'value="15.0"', $result ); |
|
58 | - $this->assertContains( 'value="10.0"', $result ); |
|
59 | - $this->assertContains( 'value="1.25"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="20.0"', $result); |
|
57 | + $this->assertContains('value="15.0"', $result); |
|
58 | + $this->assertContains('value="10.0"', $result); |
|
59 | + $this->assertContains('value="1.25"', $result); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGet() |
64 | 64 | { |
65 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
65 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
66 | 66 | |
67 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
67 | + $this->view->item = $manager->findItem('CNC'); |
|
68 | 68 | $result = $this->object->get(); |
69 | 69 | |
70 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
71 | - $this->assertContains( 'value="20.0"', $result ); |
|
72 | - $this->assertContains( 'value="15.0"', $result ); |
|
73 | - $this->assertContains( 'value="10.0"', $result ); |
|
74 | - $this->assertContains( 'value="1.25"', $result ); |
|
70 | + $this->assertNull($this->view->get('errors')); |
|
71 | + $this->assertContains('value="20.0"', $result); |
|
72 | + $this->assertContains('value="15.0"', $result); |
|
73 | + $this->assertContains('value="10.0"', $result); |
|
74 | + $this->assertContains('value="1.25"', $result); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testSave() |
79 | 79 | { |
80 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
80 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
81 | 81 | |
82 | - $item = $manager->findItem( 'CNC' ); |
|
83 | - $item->setCode( 'jqadm-test-physical' ); |
|
84 | - $item->setId( null ); |
|
82 | + $item = $manager->findItem('CNC'); |
|
83 | + $item->setCode('jqadm-test-physical'); |
|
84 | + $item->setId(null); |
|
85 | 85 | |
86 | - $manager->saveItem( $item ); |
|
86 | + $manager->saveItem($item); |
|
87 | 87 | |
88 | 88 | |
89 | 89 | $param = array( |
@@ -93,56 +93,56 @@ discard block |
||
93 | 93 | ), |
94 | 94 | ); |
95 | 95 | |
96 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
97 | - $this->view->addHelper( 'param', $helper ); |
|
96 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
97 | + $this->view->addHelper('param', $helper); |
|
98 | 98 | $this->view->item = $item; |
99 | 99 | |
100 | 100 | $result = $this->object->save(); |
101 | 101 | |
102 | - $manager->deleteItem( $item->getId() ); |
|
102 | + $manager->deleteItem($item->getId()); |
|
103 | 103 | |
104 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
105 | - $this->assertNull( $result ); |
|
104 | + $this->assertNull($this->view->get('errors')); |
|
105 | + $this->assertNull($result); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testSaveException() |
110 | 110 | { |
111 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Physical\Standard' ) |
|
112 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
113 | - ->setMethods( array( 'updateItems' ) ) |
|
111 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Physical\Standard') |
|
112 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
113 | + ->setMethods(array('updateItems')) |
|
114 | 114 | ->getMock(); |
115 | 115 | |
116 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
117 | - ->will( $this->throwException( new \Exception() ) ); |
|
116 | + $object->expects($this->once())->method('updateItems') |
|
117 | + ->will($this->throwException(new \Exception())); |
|
118 | 118 | |
119 | - $object->setView( \TestHelperJqadm::getView() ); |
|
119 | + $object->setView(\TestHelperJqadm::getView()); |
|
120 | 120 | |
121 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
121 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
122 | 122 | $object->save(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | public function testSaveMShopException() |
127 | 127 | { |
128 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Physical\Standard' ) |
|
129 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
130 | - ->setMethods( array( 'updateItems' ) ) |
|
128 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Physical\Standard') |
|
129 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
130 | + ->setMethods(array('updateItems')) |
|
131 | 131 | ->getMock(); |
132 | 132 | |
133 | - $object->expects( $this->once() )->method( 'updateItems' ) |
|
134 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
133 | + $object->expects($this->once())->method('updateItems') |
|
134 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
135 | 135 | |
136 | - $object->setView( \TestHelperJqadm::getView() ); |
|
136 | + $object->setView(\TestHelperJqadm::getView()); |
|
137 | 137 | |
138 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
138 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
139 | 139 | $object->save(); |
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | public function testGetSubClient() |
144 | 144 | { |
145 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
146 | - $this->object->getSubClient( 'invalid' ); |
|
145 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
146 | + $this->object->getSubClient('invalid'); |
|
147 | 147 | } |
148 | 148 | } |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->view = \TestHelperJqadm::getView(); |
20 | - $request = $this->getMock( '\Psr\Http\Message\ServerRequestInterface' ); |
|
21 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
22 | - $this->view ->addHelper( 'request', $helper ); |
|
20 | + $request = $this->getMock('\Psr\Http\Message\ServerRequestInterface'); |
|
21 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
22 | + $this->view ->addHelper('request', $helper); |
|
23 | 23 | |
24 | 24 | $this->context = \TestHelperJqadm::getContext(); |
25 | 25 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
26 | 26 | |
27 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Standard( $this->context, $templatePaths ); |
|
28 | - $this->object->setView( $this->view ); |
|
27 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Standard($this->context, $templatePaths); |
|
28 | + $this->object->setView($this->view); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | protected function tearDown() |
33 | 33 | { |
34 | - unset( $this->object ); |
|
34 | + unset($this->object); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | |
44 | 44 | public function testCreateException() |
45 | 45 | { |
46 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
47 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
48 | - ->setMethods( array( 'getSubClients' ) ) |
|
46 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
47 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
48 | + ->setMethods(array('getSubClients')) |
|
49 | 49 | ->getMock(); |
50 | 50 | |
51 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
52 | - ->will( $this->throwException( new \Exception() ) ); |
|
51 | + $object->expects($this->once())->method('getSubClients') |
|
52 | + ->will($this->throwException(new \Exception())); |
|
53 | 53 | |
54 | - $object->setView( $this->getViewNoRender() ); |
|
54 | + $object->setView($this->getViewNoRender()); |
|
55 | 55 | |
56 | 56 | $object->create(); |
57 | 57 | } |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | |
60 | 60 | public function testCreateMShopException() |
61 | 61 | { |
62 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
63 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
64 | - ->setMethods( array( 'getSubClients' ) ) |
|
62 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
63 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
64 | + ->setMethods(array('getSubClients')) |
|
65 | 65 | ->getMock(); |
66 | 66 | |
67 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
68 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
67 | + $object->expects($this->once())->method('getSubClients') |
|
68 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
69 | 69 | |
70 | - $object->setView( $this->getViewNoRender() ); |
|
70 | + $object->setView($this->getViewNoRender()); |
|
71 | 71 | |
72 | 72 | $object->create(); |
73 | 73 | } |
@@ -75,29 +75,29 @@ discard block |
||
75 | 75 | |
76 | 76 | public function testCopy() |
77 | 77 | { |
78 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
78 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
79 | 79 | |
80 | - $param = array( 'id' => $manager->findItem( 'CNC' )->getId() ); |
|
81 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
82 | - $this->view->addHelper( 'param', $helper ); |
|
80 | + $param = array('id' => $manager->findItem('CNC')->getId()); |
|
81 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
82 | + $this->view->addHelper('param', $helper); |
|
83 | 83 | |
84 | 84 | $result = $this->object->copy(); |
85 | 85 | |
86 | - $this->assertContains( 'CNC_copy', $result ); |
|
86 | + $this->assertContains('CNC_copy', $result); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testCopyException() |
91 | 91 | { |
92 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
93 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
94 | - ->setMethods( array( 'getSubClients' ) ) |
|
92 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
93 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
94 | + ->setMethods(array('getSubClients')) |
|
95 | 95 | ->getMock(); |
96 | 96 | |
97 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
98 | - ->will( $this->throwException( new \Exception() ) ); |
|
97 | + $object->expects($this->once())->method('getSubClients') |
|
98 | + ->will($this->throwException(new \Exception())); |
|
99 | 99 | |
100 | - $object->setView( $this->getViewNoRender() ); |
|
100 | + $object->setView($this->getViewNoRender()); |
|
101 | 101 | |
102 | 102 | $object->copy(); |
103 | 103 | } |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | |
106 | 106 | public function testCopyMShopException() |
107 | 107 | { |
108 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
109 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
110 | - ->setMethods( array( 'getSubClients' ) ) |
|
108 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
109 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
110 | + ->setMethods(array('getSubClients')) |
|
111 | 111 | ->getMock(); |
112 | 112 | |
113 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
114 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
113 | + $object->expects($this->once())->method('getSubClients') |
|
114 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
115 | 115 | |
116 | - $object->setView( $this->getViewNoRender() ); |
|
116 | + $object->setView($this->getViewNoRender()); |
|
117 | 117 | |
118 | 118 | $object->copy(); |
119 | 119 | } |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | |
122 | 122 | public function testDelete() |
123 | 123 | { |
124 | - $this->assertNull( $this->object->delete() ); |
|
124 | + $this->assertNull($this->object->delete()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | 128 | public function testDeleteException() |
129 | 129 | { |
130 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
131 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
132 | - ->setMethods( array( 'getSubClients' ) ) |
|
130 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
131 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
132 | + ->setMethods(array('getSubClients')) |
|
133 | 133 | ->getMock(); |
134 | 134 | |
135 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
136 | - ->will( $this->throwException( new \Exception() ) ); |
|
135 | + $object->expects($this->once())->method('getSubClients') |
|
136 | + ->will($this->throwException(new \Exception())); |
|
137 | 137 | |
138 | - $object->setView( $this->getViewNoRender() ); |
|
138 | + $object->setView($this->getViewNoRender()); |
|
139 | 139 | |
140 | 140 | $object->delete(); |
141 | 141 | } |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | |
144 | 144 | public function testDeleteMShopException() |
145 | 145 | { |
146 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
147 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
148 | - ->setMethods( array( 'getSubClients' ) ) |
|
146 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
147 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
148 | + ->setMethods(array('getSubClients')) |
|
149 | 149 | ->getMock(); |
150 | 150 | |
151 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
152 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
151 | + $object->expects($this->once())->method('getSubClients') |
|
152 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
153 | 153 | |
154 | - $object->setView( $this->getViewNoRender() ); |
|
154 | + $object->setView($this->getViewNoRender()); |
|
155 | 155 | |
156 | 156 | $object->delete(); |
157 | 157 | } |
@@ -159,29 +159,29 @@ discard block |
||
159 | 159 | |
160 | 160 | public function testGet() |
161 | 161 | { |
162 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
162 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
163 | 163 | |
164 | - $param = array( 'id' => $manager->findItem( 'CNC' )->getId() ); |
|
165 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
166 | - $this->view->addHelper( 'param', $helper ); |
|
164 | + $param = array('id' => $manager->findItem('CNC')->getId()); |
|
165 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
166 | + $this->view->addHelper('param', $helper); |
|
167 | 167 | |
168 | 168 | $result = $this->object->get(); |
169 | 169 | |
170 | - $this->assertContains( 'CNC', $result ); |
|
170 | + $this->assertContains('CNC', $result); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | 174 | public function testGetException() |
175 | 175 | { |
176 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
177 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
178 | - ->setMethods( array( 'getSubClients' ) ) |
|
176 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
177 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
178 | + ->setMethods(array('getSubClients')) |
|
179 | 179 | ->getMock(); |
180 | 180 | |
181 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
182 | - ->will( $this->throwException( new \Exception() ) ); |
|
181 | + $object->expects($this->once())->method('getSubClients') |
|
182 | + ->will($this->throwException(new \Exception())); |
|
183 | 183 | |
184 | - $object->setView( $this->getViewNoRender() ); |
|
184 | + $object->setView($this->getViewNoRender()); |
|
185 | 185 | |
186 | 186 | $object->get(); |
187 | 187 | } |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | |
190 | 190 | public function testGetMShopException() |
191 | 191 | { |
192 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
193 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
194 | - ->setMethods( array( 'getSubClients' ) ) |
|
192 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
193 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
194 | + ->setMethods(array('getSubClients')) |
|
195 | 195 | ->getMock(); |
196 | 196 | |
197 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
198 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
197 | + $object->expects($this->once())->method('getSubClients') |
|
198 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
199 | 199 | |
200 | - $object->setView( $this->getViewNoRender() ); |
|
200 | + $object->setView($this->getViewNoRender()); |
|
201 | 201 | |
202 | 202 | $object->get(); |
203 | 203 | } |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | |
206 | 206 | public function testSave() |
207 | 207 | { |
208 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
209 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product/type' ); |
|
208 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
209 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'product/type'); |
|
210 | 210 | |
211 | 211 | $search = $typeManager->createSearch(); |
212 | - $search->setSlice( 0, 1 ); |
|
213 | - $typeItems = $typeManager->searchItems( $search ); |
|
212 | + $search->setSlice(0, 1); |
|
213 | + $typeItems = $typeManager->searchItems($search); |
|
214 | 214 | |
215 | - if( ( $typeItem = reset( $typeItems ) ) === false ) { |
|
216 | - throw new \Exception( 'No product type item found' ); |
|
215 | + if (($typeItem = reset($typeItems)) === false) { |
|
216 | + throw new \Exception('No product type item found'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -226,42 +226,42 @@ discard block |
||
226 | 226 | 'product.datestart' => null, |
227 | 227 | 'product.dateend' => null, |
228 | 228 | 'config' => array( |
229 | - 'key' => array( 0 => 'test key' ), |
|
230 | - 'val' => array( 0 => 'test value' ), |
|
229 | + 'key' => array(0 => 'test key'), |
|
230 | + 'val' => array(0 => 'test value'), |
|
231 | 231 | ), |
232 | 232 | ), |
233 | 233 | ); |
234 | 234 | |
235 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
236 | - $this->view->addHelper( 'param', $helper ); |
|
235 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
236 | + $this->view->addHelper('param', $helper); |
|
237 | 237 | |
238 | 238 | $this->object->save(); |
239 | 239 | |
240 | - $manager->deleteItem( $manager->findItem( 'test' )->getId() ); |
|
240 | + $manager->deleteItem($manager->findItem('test')->getId()); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | public function testSaveException() |
245 | 245 | { |
246 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
247 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
248 | - ->setMethods( array( 'getSubClients' ) ) |
|
246 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
247 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
248 | + ->setMethods(array('getSubClients')) |
|
249 | 249 | ->getMock(); |
250 | 250 | |
251 | 251 | $name = 'AdminJQAdmStandard'; |
252 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
252 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
253 | 253 | |
254 | - $mock = $this->getMockBuilder( '\Aimeos\MShop\Product\Manager\Standard' ) |
|
255 | - ->setConstructorArgs( array( $this->context ) ) |
|
256 | - ->setMethods( array( 'createItem' ) ) |
|
254 | + $mock = $this->getMockBuilder('\Aimeos\MShop\Product\Manager\Standard') |
|
255 | + ->setConstructorArgs(array($this->context)) |
|
256 | + ->setMethods(array('createItem')) |
|
257 | 257 | ->getMock(); |
258 | 258 | |
259 | - $mock->expects( $this->exactly( 2 ) )->method( 'createItem' ) |
|
260 | - ->will( $this->throwException( new \Exception() ) ); |
|
259 | + $mock->expects($this->exactly(2))->method('createItem') |
|
260 | + ->will($this->throwException(new \Exception())); |
|
261 | 261 | |
262 | - \Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $mock ); |
|
262 | + \Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $mock); |
|
263 | 263 | |
264 | - $object->setView( $this->getViewNoRender() ); |
|
264 | + $object->setView($this->getViewNoRender()); |
|
265 | 265 | |
266 | 266 | $object->save(); |
267 | 267 | } |
@@ -269,25 +269,25 @@ discard block |
||
269 | 269 | |
270 | 270 | public function testSaveMShopException() |
271 | 271 | { |
272 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
273 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
274 | - ->setMethods( array( 'getSubClients' ) ) |
|
272 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
273 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
274 | + ->setMethods(array('getSubClients')) |
|
275 | 275 | ->getMock(); |
276 | 276 | |
277 | 277 | $name = 'AdminJQAdmStandard'; |
278 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
278 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
279 | 279 | |
280 | - $mock = $this->getMockBuilder( '\Aimeos\MShop\Product\Manager\Standard' ) |
|
281 | - ->setConstructorArgs( array( $this->context ) ) |
|
282 | - ->setMethods( array( 'createItem' ) ) |
|
280 | + $mock = $this->getMockBuilder('\Aimeos\MShop\Product\Manager\Standard') |
|
281 | + ->setConstructorArgs(array($this->context)) |
|
282 | + ->setMethods(array('createItem')) |
|
283 | 283 | ->getMock(); |
284 | 284 | |
285 | - $mock->expects( $this->exactly( 2 ) )->method( 'createItem' ) |
|
286 | - ->will( $this->throwException( new \Exception() ) ); |
|
285 | + $mock->expects($this->exactly(2))->method('createItem') |
|
286 | + ->will($this->throwException(new \Exception())); |
|
287 | 287 | |
288 | - \Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $mock ); |
|
288 | + \Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $mock); |
|
289 | 289 | |
290 | - $object->setView( $this->getViewNoRender() ); |
|
290 | + $object->setView($this->getViewNoRender()); |
|
291 | 291 | |
292 | 292 | $object->save(); |
293 | 293 | } |
@@ -295,26 +295,26 @@ discard block |
||
295 | 295 | |
296 | 296 | public function testSearch() |
297 | 297 | { |
298 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, array( 'site' => 'unittest', 'lang' => 'de' ) ); |
|
299 | - $this->view->addHelper( 'param', $helper ); |
|
298 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, array('site' => 'unittest', 'lang' => 'de')); |
|
299 | + $this->view->addHelper('param', $helper); |
|
300 | 300 | |
301 | 301 | $result = $this->object->search(); |
302 | 302 | |
303 | - $this->assertContains( 'CNE', $result ); |
|
303 | + $this->assertContains('CNE', $result); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
307 | 307 | public function testSearchException() |
308 | 308 | { |
309 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
310 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
311 | - ->setMethods( array( 'getSubClients' ) ) |
|
309 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
310 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
311 | + ->setMethods(array('getSubClients')) |
|
312 | 312 | ->getMock(); |
313 | 313 | |
314 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
315 | - ->will( $this->throwException( new \Exception() ) ); |
|
314 | + $object->expects($this->once())->method('getSubClients') |
|
315 | + ->will($this->throwException(new \Exception())); |
|
316 | 316 | |
317 | - $object->setView( $this->getViewNoRender() ); |
|
317 | + $object->setView($this->getViewNoRender()); |
|
318 | 318 | |
319 | 319 | $object->search(); |
320 | 320 | } |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | |
323 | 323 | public function testSearchMShopException() |
324 | 324 | { |
325 | - $object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Standard' ) |
|
326 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
327 | - ->setMethods( array( 'getSubClients' ) ) |
|
325 | + $object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Standard') |
|
326 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
327 | + ->setMethods(array('getSubClients')) |
|
328 | 328 | ->getMock(); |
329 | 329 | |
330 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
331 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
330 | + $object->expects($this->once())->method('getSubClients') |
|
331 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
332 | 332 | |
333 | - $object->setView( $this->getViewNoRender() ); |
|
333 | + $object->setView($this->getViewNoRender()); |
|
334 | 334 | |
335 | 335 | $object->search(); |
336 | 336 | } |
@@ -338,16 +338,16 @@ discard block |
||
338 | 338 | |
339 | 339 | public function testGetSubClient() |
340 | 340 | { |
341 | - $this->setExpectedException( '\Aimeos\Admin\JQAdm\Exception' ); |
|
342 | - $this->object->getSubClient( 'invalid' ); |
|
341 | + $this->setExpectedException('\Aimeos\Admin\JQAdm\Exception'); |
|
342 | + $this->object->getSubClient('invalid'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
346 | 346 | protected function getViewNoRender() |
347 | 347 | { |
348 | - return $this->getMockBuilder( '\Aimeos\MW\View\Standard' ) |
|
349 | - ->setConstructorArgs( array( array() ) ) |
|
350 | - ->setMethods( array( 'render', 'config' ) ) |
|
348 | + return $this->getMockBuilder('\Aimeos\MW\View\Standard') |
|
349 | + ->setConstructorArgs(array(array())) |
|
350 | + ->setMethods(array('render', 'config')) |
|
351 | 351 | ->getMock(); |
352 | 352 | } |
353 | 353 | } |