@@ -121,8 +121,7 @@ |
||
| 121 | 121 | } else { |
| 122 | 122 | unset( $items[$id] ); |
| 123 | 123 | } |
| 124 | - } |
|
| 125 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 124 | + } catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 126 | 125 | { |
| 127 | 126 | $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
| 128 | 127 | $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 36 | 36 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 37 | 37 | */ |
| 38 | - public function checkAttributes( $serviceId, array $attributes ) |
|
| 38 | + public function checkAttributes($serviceId, array $attributes) |
|
| 39 | 39 | { |
| 40 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 41 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
| 40 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 41 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
| 42 | 42 | |
| 43 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
| 43 | + return array_filter($provider->checkConfigFE($attributes)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | * @param string[] $ref List of domain names whose items should be fetched too |
| 52 | 52 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 53 | 53 | */ |
| 54 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
| 54 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
| 55 | 55 | { |
| 56 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 57 | - return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) ); |
|
| 56 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 57 | + return $manager->getProvider($manager->getItem($serviceId, $ref, true)); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -65,26 +65,26 @@ discard block |
||
| 65 | 65 | * @param string[] $ref List of domain names whose items should be fetched too |
| 66 | 66 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 67 | 67 | */ |
| 68 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
| 68 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
| 69 | 69 | { |
| 70 | 70 | $list = []; |
| 71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 71 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 72 | 72 | |
| 73 | - $search = $manager->createSearch( true ); |
|
| 74 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 73 | + $search = $manager->createSearch(true); |
|
| 74 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 75 | 75 | |
| 76 | - if( $type != null ) |
|
| 76 | + if ($type != null) |
|
| 77 | 77 | { |
| 78 | 78 | $expr = array( |
| 79 | 79 | $search->getConditions(), |
| 80 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 81 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 80 | + $search->compare('==', 'service.type.code', $type), |
|
| 81 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 82 | 82 | ); |
| 83 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 83 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
| 87 | - $list[$id] = $manager->getProvider( $item ); |
|
| 86 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
| 87 | + $list[$id] = $manager->getProvider($item); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $list; |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 103 | 103 | * or null if no form data is required |
| 104 | 104 | */ |
| 105 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
| 105 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
| 106 | 106 | { |
| 107 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 107 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 108 | 108 | |
| 109 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
| 110 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 109 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
| 110 | + $provider->injectGlobalConfigBE($urls); |
|
| 111 | 111 | |
| 112 | - return $provider->process( $orderItem, $params ); |
|
| 112 | + return $provider->process($orderItem, $params); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -122,35 +122,35 @@ discard block |
||
| 122 | 122 | * (keys are <type>.url-self, <type>.url-success, <type>.url-update where type can be "delivery" or "payment") |
| 123 | 123 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 124 | 124 | */ |
| 125 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls ) |
|
| 125 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls) |
|
| 126 | 126 | { |
| 127 | 127 | $queryParams = $request->getQueryParams(); |
| 128 | 128 | |
| 129 | - if( !isset( $queryParams['code'] ) ) { |
|
| 129 | + if (!isset($queryParams['code'])) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $context = $this->getContext(); |
| 134 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 134 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 135 | 135 | |
| 136 | - $provider = $manager->getProvider( $manager->findItem( $queryParams['code'] ) ); |
|
| 137 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 136 | + $provider = $manager->getProvider($manager->findItem($queryParams['code'])); |
|
| 137 | + $provider->injectGlobalConfigBE($urls); |
|
| 138 | 138 | |
| 139 | - $params = array_merge( $queryParams, (array) $request->getParsedBody() ); |
|
| 139 | + $params = array_merge($queryParams, (array) $request->getParsedBody()); |
|
| 140 | 140 | $body = (string) $request->getBody(); |
| 141 | 141 | $response = null; |
| 142 | 142 | $headers = []; |
| 143 | 143 | |
| 144 | - if( ( $orderItem = $provider->updateSync( $params, $body, $response, $headers ) ) !== null ) |
|
| 144 | + if (($orderItem = $provider->updateSync($params, $body, $response, $headers)) !== null) |
|
| 145 | 145 | { |
| 146 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 147 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 146 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 147 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
| 148 | 148 | ) { |
| 149 | - $provider->query( $orderItem ); |
|
| 149 | + $provider->query($orderItem); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // update stock, coupons, etc. |
| 153 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
| 153 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $orderItem; |
@@ -167,38 +167,38 @@ discard block |
||
| 167 | 167 | * @throws \Exception If an error occurs |
| 168 | 168 | * @deprecated Use getProviders() instead |
| 169 | 169 | */ |
| 170 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] ) |
|
| 170 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text']) |
|
| 171 | 171 | { |
| 172 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 172 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 173 | 173 | |
| 174 | - $search = $serviceManager->createSearch( true ); |
|
| 174 | + $search = $serviceManager->createSearch(true); |
|
| 175 | 175 | $expr = array( |
| 176 | 176 | $search->getConditions(), |
| 177 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 178 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 177 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 178 | + $search->compare('==', 'service.type.code', $type), |
|
| 179 | 179 | ); |
| 180 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 181 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 180 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 181 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 182 | 182 | |
| 183 | - $items = $serviceManager->searchItems( $search, $ref ); |
|
| 183 | + $items = $serviceManager->searchItems($search, $ref); |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | - foreach( $items as $id => $service ) |
|
| 186 | + foreach ($items as $id => $service) |
|
| 187 | 187 | { |
| 188 | 188 | try |
| 189 | 189 | { |
| 190 | - $provider = $serviceManager->getProvider( $service ); |
|
| 190 | + $provider = $serviceManager->getProvider($service); |
|
| 191 | 191 | |
| 192 | - if( $provider->isAvailable( $basket ) ) { |
|
| 192 | + if ($provider->isAvailable($basket)) { |
|
| 193 | 193 | $this->providers[$type][$id] = $provider; |
| 194 | 194 | } else { |
| 195 | - unset( $items[$id] ); |
|
| 195 | + unset($items[$id]); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 198 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
| 199 | 199 | { |
| 200 | - $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
|
| 201 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
|
| 200 | + $msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id); |
|
| 201 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
@@ -219,16 +219,16 @@ discard block |
||
| 219 | 219 | * @throws \Exception If an error occurs |
| 220 | 220 | * @deprecated Use getProvider() instead |
| 221 | 221 | */ |
| 222 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 222 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 223 | 223 | { |
| 224 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 225 | - return $this->providers[$type][$serviceId]->getConfigFE( $basket ); |
|
| 224 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 225 | + return $this->providers[$type][$serviceId]->getConfigFE($basket); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 229 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 228 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 229 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 230 | 230 | |
| 231 | - return $serviceManager->getProvider( $item )->getConfigFE( $basket ); |
|
| 231 | + return $serviceManager->getProvider($item)->getConfigFE($basket); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -244,16 +244,16 @@ discard block |
||
| 244 | 244 | * @throws \Exception If an error occurs |
| 245 | 245 | * @deprecated Use getProvider() instead |
| 246 | 246 | */ |
| 247 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 247 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 248 | 248 | { |
| 249 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 250 | - return $this->providers[$type][$serviceId]->calcPrice( $basket ); |
|
| 249 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 250 | + return $this->providers[$type][$serviceId]->calcPrice($basket); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 254 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 253 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 254 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 255 | 255 | |
| 256 | - return $serviceManager->getProvider( $item )->calcPrice( $basket ); |
|
| 256 | + return $serviceManager->getProvider($item)->calcPrice($basket); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -269,22 +269,22 @@ discard block |
||
| 269 | 269 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
| 270 | 270 | * @deprecated Use checkAttributes() instead |
| 271 | 271 | */ |
| 272 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 272 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 273 | 273 | { |
| 274 | - if( !isset( $this->providers[$type][$serviceId] ) ) |
|
| 274 | + if (!isset($this->providers[$type][$serviceId])) |
|
| 275 | 275 | { |
| 276 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 277 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 276 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 277 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 278 | 278 | |
| 279 | - $this->providers[$type][$serviceId] = $serviceManager->getProvider( $item ); |
|
| 279 | + $this->providers[$type][$serviceId] = $serviceManager->getProvider($item); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - $errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes ); |
|
| 282 | + $errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes); |
|
| 283 | 283 | |
| 284 | - foreach( $errors as $key => $msg ) |
|
| 284 | + foreach ($errors as $key => $msg) |
|
| 285 | 285 | { |
| 286 | - if( $msg === null ) { |
|
| 287 | - unset( $errors[$key] ); |
|
| 286 | + if ($msg === null) { |
|
| 287 | + unset($errors[$key]); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
@@ -18,106 +18,106 @@ |
||
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
| 21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
| 21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | protected function tearDown() |
| 26 | 26 | { |
| 27 | - unset( $this->context, $this->object ); |
|
| 27 | + unset($this->context, $this->object); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testAddEditSaveDeleteItem() |
| 32 | 32 | { |
| 33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
| 33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 34 | + $id = $manager->findItem('UTC001')->getId(); |
|
| 35 | 35 | |
| 36 | - $this->context->setUserId( $id ); |
|
| 37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
| 38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 36 | + $this->context->setUserId($id); |
|
| 37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
| 38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 39 | 39 | |
| 40 | - $this->context->setUserId( $item->getId() ); |
|
| 41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
| 42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 40 | + $this->context->setUserId($item->getId()); |
|
| 41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
| 42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 43 | 43 | |
| 44 | - $item->setStatus( 0 ); |
|
| 45 | - $this->object->saveItem( $item ); |
|
| 46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
| 44 | + $item->setStatus(0); |
|
| 45 | + $this->object->saveItem($item); |
|
| 46 | + $this->assertEquals(0, $item->getStatus()); |
|
| 47 | 47 | |
| 48 | - $this->object->deleteItem( $item->getId() ); |
|
| 48 | + $this->object->deleteItem($item->getId()); |
|
| 49 | 49 | |
| 50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 51 | - $manager->findItem( 'unittest-ctnl' ); |
|
| 50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 51 | + $manager->findItem('unittest-ctnl'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testCreateItem() |
| 56 | 56 | { |
| 57 | 57 | $result = $this->object->createItem(); |
| 58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testGetItem() |
| 63 | 63 | { |
| 64 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
| 65 | - $this->context->setUserId( $id ); |
|
| 64 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
| 65 | + $this->context->setUserId($id); |
|
| 66 | 66 | |
| 67 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
| 67 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
| 68 | 68 | |
| 69 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 70 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
| 71 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
| 69 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 70 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
| 71 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | public function testFindItem() |
| 76 | 76 | { |
| 77 | - $result = $this->object->findItem( 'UTC001' ); |
|
| 78 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 77 | + $result = $this->object->findItem('UTC001'); |
|
| 78 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | public function testAddEditSaveDeleteAddressItem() |
| 83 | 83 | { |
| 84 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
| 85 | - $this->context->setUserId( $customer->getId() ); |
|
| 84 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
| 85 | + $this->context->setUserId($customer->getId()); |
|
| 86 | 86 | |
| 87 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
| 88 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 87 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
| 88 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 89 | 89 | |
| 90 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
| 91 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 90 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
| 91 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 92 | 92 | |
| 93 | - $item->setLastName( 'test' ); |
|
| 94 | - $this->object->saveAddressItem( $item ); |
|
| 95 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
| 93 | + $item->setLastName('test'); |
|
| 94 | + $this->object->saveAddressItem($item); |
|
| 95 | + $this->assertEquals('test', $item->getLastName()); |
|
| 96 | 96 | |
| 97 | - $this->object->deleteAddressItem( $item->getId() ); |
|
| 97 | + $this->object->deleteAddressItem($item->getId()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | public function testCreateAddressItem() |
| 102 | 102 | { |
| 103 | 103 | $result = $this->object->createAddressItem(); |
| 104 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 104 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testGetAddressItem() |
| 109 | 109 | { |
| 110 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
| 110 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
| 111 | 111 | $search = $manager->createSearch(); |
| 112 | - $search->setSlice( 0, 1 ); |
|
| 113 | - $result = $manager->searchItems( $search ); |
|
| 112 | + $search->setSlice(0, 1); |
|
| 113 | + $result = $manager->searchItems($search); |
|
| 114 | 114 | |
| 115 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 116 | - throw new \RuntimeException( 'No customer address available' ); |
|
| 115 | + if (($item = reset($result)) === false) { |
|
| 116 | + throw new \RuntimeException('No customer address available'); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $this->context->setUserId( $item->getParentId() ); |
|
| 120 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
| 121 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 119 | + $this->context->setUserId($item->getParentId()); |
|
| 120 | + $result = $this->object->getAddressItem($item->getId()); |
|
| 121 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 122 | 122 | } |
| 123 | 123 | } |
@@ -15,31 +15,31 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
| 17 | 17 | |
| 18 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext() ); |
|
| 19 | - $this->assertInstanceOf( $target, $controller ); |
|
| 18 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext()); |
|
| 19 | + $this->assertInstanceOf($target, $controller); |
|
| 20 | 20 | |
| 21 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
| 22 | - $this->assertInstanceOf( $target, $controller ); |
|
| 21 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
| 22 | + $this->assertInstanceOf($target, $controller); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | public function testCreateControllerInvalidImplementation() |
| 27 | 27 | { |
| 28 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 29 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
| 28 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 29 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | public function testCreateControllerInvalidName() |
| 34 | 34 | { |
| 35 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 36 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
| 35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 36 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testCreateControllerNotExisting() |
| 41 | 41 | { |
| 42 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 43 | - \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
| 42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 43 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -20,161 +20,161 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
| 23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
| 28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
| 27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
| 28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
| 29 | 29 | ->getMockForAbstractClass(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - unset( $this->context, $this->object, $this->stub ); |
|
| 35 | + unset($this->context, $this->object, $this->stub); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testConstructException() |
| 40 | 40 | { |
| 41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
| 41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
| 42 | 42 | |
| 43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
| 43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
| 44 | 44 | |
| 45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
| 46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
| 46 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 47 | 47 | ->getMockForAbstractClass(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testCall() |
| 52 | 52 | { |
| 53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
| 53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | - ->setMethods( ['invalid'] ) |
|
| 55 | + ->setMethods(['invalid']) |
|
| 56 | 56 | ->getMock(); |
| 57 | 57 | |
| 58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
| 59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
| 59 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 60 | 60 | ->getMockForAbstractClass(); |
| 61 | 61 | |
| 62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
| 62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
| 63 | 63 | |
| 64 | - $this->assertTrue( $object->invalid() ); |
|
| 64 | + $this->assertTrue($object->invalid()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testCheckAttributes() |
| 69 | 69 | { |
| 70 | - $this->stub->expects( $this->once() )->method( 'checkAttributes' ) |
|
| 71 | - ->will( $this->returnValue( [] ) ); |
|
| 70 | + $this->stub->expects($this->once())->method('checkAttributes') |
|
| 71 | + ->will($this->returnValue([])); |
|
| 72 | 72 | |
| 73 | - $this->assertEquals( [], $this->object->checkAttributes( -1, [] ) ); |
|
| 73 | + $this->assertEquals([], $this->object->checkAttributes( -1, [] )); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testGetProvider() |
| 78 | 78 | { |
| 79 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
| 80 | - $provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) ); |
|
| 79 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
| 80 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery')); |
|
| 81 | 81 | |
| 82 | - $this->stub->expects( $this->once() )->method( 'getProvider' ) |
|
| 83 | - ->will( $this->returnValue( $provider ) ); |
|
| 82 | + $this->stub->expects($this->once())->method('getProvider') |
|
| 83 | + ->will($this->returnValue($provider)); |
|
| 84 | 84 | |
| 85 | - $this->assertSame( $provider, $this->object->getProvider( -1 ) ); |
|
| 85 | + $this->assertSame($provider, $this->object->getProvider( -1 )); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testGetProviders() |
| 90 | 90 | { |
| 91 | - $this->stub->expects( $this->once() )->method( 'getProviders' ) |
|
| 92 | - ->will( $this->returnValue( [] ) ); |
|
| 91 | + $this->stub->expects($this->once())->method('getProviders') |
|
| 92 | + ->will($this->returnValue([])); |
|
| 93 | 93 | |
| 94 | - $this->assertEquals( [], $this->object->getProviders( 'payment' ) ); |
|
| 94 | + $this->assertEquals([], $this->object->getProviders('payment')); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | public function testProcess() |
| 99 | 99 | { |
| 100 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 100 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 101 | 101 | |
| 102 | - $this->stub->expects( $this->once() )->method( 'process' ) |
|
| 103 | - ->will( $this->returnValue( new \Aimeos\MShop\Common\Item\Helper\Form\Standard() ) ); |
|
| 102 | + $this->stub->expects($this->once())->method('process') |
|
| 103 | + ->will($this->returnValue(new \Aimeos\MShop\Common\Item\Helper\Form\Standard())); |
|
| 104 | 104 | |
| 105 | - $this->assertInstanceOf( 'Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process( $item, -1, [], [] ) ); |
|
| 105 | + $this->assertInstanceOf('Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process($item, -1, [], [])); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testUpdateSync() |
| 110 | 110 | { |
| 111 | - $response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock(); |
|
| 112 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 113 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 111 | + $response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
|
| 112 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 113 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 114 | 114 | |
| 115 | - $this->stub->expects( $this->once() )->method( 'updateSync' ) |
|
| 116 | - ->will( $this->returnValue( $item ) ); |
|
| 115 | + $this->stub->expects($this->once())->method('updateSync') |
|
| 116 | + ->will($this->returnValue($item)); |
|
| 117 | 117 | |
| 118 | - $this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [] ) ); |
|
| 118 | + $this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [])); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testGetServices() |
| 123 | 123 | { |
| 124 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 124 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 125 | 125 | |
| 126 | - $this->stub->expects( $this->once() )->method( 'getServices' ) |
|
| 127 | - ->will( $this->returnValue( [] ) ); |
|
| 126 | + $this->stub->expects($this->once())->method('getServices') |
|
| 127 | + ->will($this->returnValue([])); |
|
| 128 | 128 | |
| 129 | - $this->assertEquals( [], $this->object->getServices( 'payment', $basket ) ); |
|
| 129 | + $this->assertEquals([], $this->object->getServices('payment', $basket)); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | public function testGetServiceAttributes() |
| 134 | 134 | { |
| 135 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 135 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 136 | 136 | |
| 137 | - $this->stub->expects( $this->once() )->method( 'getServiceAttributes' ) |
|
| 138 | - ->will( $this->returnValue( [] ) ); |
|
| 137 | + $this->stub->expects($this->once())->method('getServiceAttributes') |
|
| 138 | + ->will($this->returnValue([])); |
|
| 139 | 139 | |
| 140 | - $this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) ); |
|
| 140 | + $this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket)); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | public function testGetServicePrice() |
| 145 | 145 | { |
| 146 | - $priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem(); |
|
| 147 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 146 | + $priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem(); |
|
| 147 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 148 | 148 | |
| 149 | - $this->stub->expects( $this->once() )->method( 'getServicePrice' ) |
|
| 150 | - ->will( $this->returnValue( $priceItem ) ); |
|
| 149 | + $this->stub->expects($this->once())->method('getServicePrice') |
|
| 150 | + ->will($this->returnValue($priceItem)); |
|
| 151 | 151 | |
| 152 | - $this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) ); |
|
| 152 | + $this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | public function testCheckServiceAttributes() |
| 157 | 157 | { |
| 158 | - $this->stub->expects( $this->once() )->method( 'checkServiceAttributes' ) |
|
| 159 | - ->will( $this->returnValue( [] ) ); |
|
| 158 | + $this->stub->expects($this->once())->method('checkServiceAttributes') |
|
| 159 | + ->will($this->returnValue([])); |
|
| 160 | 160 | |
| 161 | - $this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) ); |
|
| 161 | + $this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, [])); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | public function testGetController() |
| 166 | 166 | { |
| 167 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 167 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 168 | 168 | |
| 169 | - $this->assertSame( $this->stub, $result ); |
|
| 169 | + $this->assertSame($this->stub, $result); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | - protected function access( $name ) |
|
| 173 | + protected function access($name) |
|
| 174 | 174 | { |
| 175 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
| 176 | - $method = $class->getMethod( $name ); |
|
| 177 | - $method->setAccessible( true ); |
|
| 175 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
| 176 | + $method = $class->getMethod($name); |
|
| 177 | + $method->setAccessible(true); |
|
| 178 | 178 | |
| 179 | 179 | return $method; |
| 180 | 180 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
| 28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
| 29 | 29 | */ |
| 30 | - public function addItem( $baseId, $type ); |
|
| 30 | + public function addItem($baseId, $type); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $id Unique order ID |
| 45 | 45 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
| 46 | 46 | */ |
| 47 | - public function getItem( $id ); |
|
| 47 | + public function getItem($id); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param integer &$total|null Variable that will contain the total number of available items |
| 55 | 55 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
| 56 | 56 | */ |
| 57 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
| 57 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
| 79 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
| 101 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 117 | 117 | * @return void |
| 118 | 118 | */ |
| 119 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
| 119 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -130,5 +130,5 @@ discard block |
||
| 130 | 130 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
| 131 | 131 | * @deprecated 2017.04 Use store() from basket controller instead |
| 132 | 132 | */ |
| 133 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
| 133 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
| 134 | 134 | } |
@@ -20,136 +20,136 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Standard' ) |
|
| 23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Standard') |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
| 28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
| 27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
| 28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
| 29 | 29 | ->getMockForAbstractClass(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - unset( $this->context, $this->object, $this->stub ); |
|
| 35 | + unset($this->context, $this->object, $this->stub); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testConstructException() |
| 40 | 40 | { |
| 41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
| 41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
| 42 | 42 | |
| 43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
| 43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
| 44 | 44 | |
| 45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
| 46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
| 46 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 47 | 47 | ->getMockForAbstractClass(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testCall() |
| 52 | 52 | { |
| 53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Standard' ) |
|
| 53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Standard') |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | - ->setMethods( ['invalid'] ) |
|
| 55 | + ->setMethods(['invalid']) |
|
| 56 | 56 | ->getMock(); |
| 57 | 57 | |
| 58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ) |
|
| 59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Order\Decorator\Base') |
|
| 59 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 60 | 60 | ->getMockForAbstractClass(); |
| 61 | 61 | |
| 62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
| 62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
| 63 | 63 | |
| 64 | - $this->assertTrue( $object->invalid() ); |
|
| 64 | + $this->assertTrue($object->invalid()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testAddItem() |
| 69 | 69 | { |
| 70 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 70 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 71 | 71 | |
| 72 | - $this->stub->expects( $this->once() )->method( 'addItem' )->will( $this->returnValue( $item ) ); |
|
| 72 | + $this->stub->expects($this->once())->method('addItem')->will($this->returnValue($item)); |
|
| 73 | 73 | |
| 74 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, '' ) ); |
|
| 74 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, '' )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | public function testCreateFilter() |
| 79 | 79 | { |
| 80 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createSearch(); |
|
| 80 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createSearch(); |
|
| 81 | 81 | |
| 82 | - $this->stub->expects( $this->once() )->method( 'createFilter' )->will( $this->returnValue( $search ) ); |
|
| 82 | + $this->stub->expects($this->once())->method('createFilter')->will($this->returnValue($search)); |
|
| 83 | 83 | |
| 84 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
| 84 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | public function testGetItem() |
| 89 | 89 | { |
| 90 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 90 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 91 | 91 | |
| 92 | - $this->stub->expects( $this->once() )->method( 'getItem' )->will( $this->returnValue( $item ) ); |
|
| 92 | + $this->stub->expects($this->once())->method('getItem')->will($this->returnValue($item)); |
|
| 93 | 93 | |
| 94 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( -1 ) ); |
|
| 94 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( -1 )); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | public function testSearchItems() |
| 99 | 99 | { |
| 100 | - $search = $this->getMockBuilder( '\Aimeos\MW\Criteria\Iface' )->getMock(); |
|
| 100 | + $search = $this->getMockBuilder('\Aimeos\MW\Criteria\Iface')->getMock(); |
|
| 101 | 101 | |
| 102 | - $this->stub->expects( $this->once() )->method( 'searchItems' )->will( $this->returnValue( [] ) ); |
|
| 102 | + $this->stub->expects($this->once())->method('searchItems')->will($this->returnValue([])); |
|
| 103 | 103 | |
| 104 | - $this->assertEquals( [], $this->object->searchItems( $search ) ); |
|
| 104 | + $this->assertEquals([], $this->object->searchItems($search)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testUnblock() |
| 109 | 109 | { |
| 110 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 110 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 111 | 111 | |
| 112 | - $this->stub->expects( $this->once() )->method( 'unblock' ); |
|
| 112 | + $this->stub->expects($this->once())->method('unblock'); |
|
| 113 | 113 | |
| 114 | - $this->object->unblock( $orderItem ); |
|
| 114 | + $this->object->unblock($orderItem); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testUpdate() |
| 119 | 119 | { |
| 120 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 120 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 121 | 121 | |
| 122 | - $this->stub->expects( $this->once() )->method( 'update' ); |
|
| 122 | + $this->stub->expects($this->once())->method('update'); |
|
| 123 | 123 | |
| 124 | - $this->object->update( $orderItem ); |
|
| 124 | + $this->object->update($orderItem); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | public function testStore() |
| 129 | 129 | { |
| 130 | - $orderItem = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 131 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 130 | + $orderItem = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 131 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 132 | 132 | |
| 133 | - $this->stub->expects( $this->once() )->method( 'store' ) |
|
| 134 | - ->will( $this->returnValue( $orderItem ) ); |
|
| 133 | + $this->stub->expects($this->once())->method('store') |
|
| 134 | + ->will($this->returnValue($orderItem)); |
|
| 135 | 135 | |
| 136 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->store( $basket ) ); |
|
| 136 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->store($basket)); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | public function testGetController() |
| 141 | 141 | { |
| 142 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 142 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 143 | 143 | |
| 144 | - $this->assertSame( $this->stub, $result ); |
|
| 144 | + $this->assertSame($this->stub, $result); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | - protected function access( $name ) |
|
| 148 | + protected function access($name) |
|
| 149 | 149 | { |
| 150 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Order\Decorator\Base' ); |
|
| 151 | - $method = $class->getMethod( $name ); |
|
| 152 | - $method->setAccessible( true ); |
|
| 150 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Order\Decorator\Base'); |
|
| 151 | + $method = $class->getMethod($name); |
|
| 152 | + $method->setAccessible(true); |
|
| 153 | 153 | |
| 154 | 154 | return $method; |
| 155 | 155 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 31 | 31 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 32 | 32 | */ |
| 33 | - public function checkAttributes( $serviceId, array $attributes ); |
|
| 33 | + public function checkAttributes($serviceId, array $attributes); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Returns the service item for the given ID |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 40 | 40 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 41 | 41 | */ |
| 42 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
| 42 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Returns the service providers for the given type |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 50 | 50 | */ |
| 51 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ); |
|
| 51 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Processes the service for the given order, e.g. payment and delivery services |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 62 | 62 | * or null if no form data is required |
| 63 | 63 | */ |
| 64 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ); |
|
| 64 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params); |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Updates the payment or delivery status for the given request |
@@ -72,5 +72,5 @@ discard block |
||
| 72 | 72 | * (keys are <type>.url-self, <type>.url-success, <type>.url-update where type can be "delivery" or "payment") |
| 73 | 73 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 74 | 74 | */ |
| 75 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls ); |
|
| 75 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls); |
|
| 76 | 76 | } |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | * @param string $type Arbitrary order type (max. eight chars) |
| 30 | 30 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
| 31 | 31 | */ |
| 32 | - public function addItem( $baseId, $type ) |
|
| 32 | + public function addItem($baseId, $type) |
|
| 33 | 33 | { |
| 34 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' ); |
|
| 34 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order'); |
|
| 35 | 35 | |
| 36 | - $item = $manager->createItem()->setBaseId( $baseId )->setType( $type ); |
|
| 37 | - $manager->saveItem( $item ); |
|
| 36 | + $item = $manager->createItem()->setBaseId($baseId)->setType($type); |
|
| 37 | + $manager->saveItem($item); |
|
| 38 | 38 | |
| 39 | 39 | return $item; |
| 40 | 40 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function createFilter() |
| 49 | 49 | { |
| 50 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true ); |
|
| 50 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -57,26 +57,26 @@ discard block |
||
| 57 | 57 | * @param string $id Unique order ID |
| 58 | 58 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
| 59 | 59 | */ |
| 60 | - public function getItem( $id ) |
|
| 60 | + public function getItem($id) |
|
| 61 | 61 | { |
| 62 | 62 | $context = $this->getContext(); |
| 63 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 63 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 64 | 64 | |
| 65 | - $search = $manager->createSearch( true ); |
|
| 65 | + $search = $manager->createSearch(true); |
|
| 66 | 66 | $expr = [ |
| 67 | - $search->compare( '==', 'order.id', $id ), |
|
| 68 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 67 | + $search->compare('==', 'order.id', $id), |
|
| 68 | + $search->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 69 | 69 | $search->getConditions(), |
| 70 | 70 | ]; |
| 71 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 71 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 72 | 72 | |
| 73 | - $items = $manager->searchItems( $search ); |
|
| 73 | + $items = $manager->searchItems($search); |
|
| 74 | 74 | |
| 75 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 75 | + if (($item = reset($items)) !== false) { |
|
| 76 | 76 | return $item; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) ); |
|
| 79 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id)); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | * @param integer|null &$total Variable that will contain the total number of available items |
| 88 | 88 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
| 89 | 89 | */ |
| 90 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
| 90 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
| 91 | 91 | { |
| 92 | 92 | $context = $this->getContext(); |
| 93 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 93 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 94 | 94 | |
| 95 | 95 | $expr = [ |
| 96 | 96 | $filter->getConditions(), |
| 97 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 97 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 98 | 98 | ]; |
| 99 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 99 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 100 | 100 | |
| 101 | - return $manager->searchItems( $filter, [], $total ); |
|
| 101 | + return $manager->searchItems($filter, [], $total); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 122 | 122 | */ |
| 123 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 123 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 124 | 124 | { |
| 125 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
| 125 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 146 | 146 | */ |
| 147 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 147 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 148 | 148 | { |
| 149 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
| 149 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 166 | 166 | */ |
| 167 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 167 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 168 | 168 | { |
| 169 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
| 169 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -181,22 +181,22 @@ discard block |
||
| 181 | 181 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
| 182 | 182 | * @deprecated 2017.04 Use store() from basket controller instead |
| 183 | 183 | */ |
| 184 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 184 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 185 | 185 | { |
| 186 | 186 | $context = $this->getContext(); |
| 187 | 187 | |
| 188 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 189 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 188 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 189 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | $orderBaseManager->begin(); |
| 193 | - $orderBaseManager->store( $basket ); |
|
| 193 | + $orderBaseManager->store($basket); |
|
| 194 | 194 | $orderBaseManager->commit(); |
| 195 | 195 | |
| 196 | 196 | $orderItem = $orderManager->createItem(); |
| 197 | - $orderItem->setBaseId( $basket->getId() ); |
|
| 198 | - $orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB ); |
|
| 199 | - $orderManager->saveItem( $orderItem ); |
|
| 197 | + $orderItem->setBaseId($basket->getId()); |
|
| 198 | + $orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB); |
|
| 199 | + $orderManager->saveItem($orderItem); |
|
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | return $orderItem; |
@@ -18,175 +18,175 @@ |
||
| 18 | 18 | |
| 19 | 19 | protected function setUp() |
| 20 | 20 | { |
| 21 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 21 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 22 | 22 | |
| 23 | 23 | $this->context = \TestHelperFrontend::getContext(); |
| 24 | - $this->object = new \Aimeos\Controller\Frontend\Order\Standard( $this->context ); |
|
| 24 | + $this->object = new \Aimeos\Controller\Frontend\Order\Standard($this->context); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object, $this->context ); |
|
| 30 | + unset($this->object, $this->context); |
|
| 31 | 31 | |
| 32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 32 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 33 | 33 | \Aimeos\MShop\Factory::clear(); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | public function testAddItem() |
| 38 | 38 | { |
| 39 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 40 | - ->setConstructorArgs( [$this->context] ) |
|
| 41 | - ->setMethods( ['saveItem'] ) |
|
| 39 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 40 | + ->setConstructorArgs([$this->context]) |
|
| 41 | + ->setMethods(['saveItem']) |
|
| 42 | 42 | ->getMock(); |
| 43 | 43 | |
| 44 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager ); |
|
| 44 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager); |
|
| 45 | 45 | |
| 46 | - $manager->expects( $this->once() )->method( 'saveItem' ); |
|
| 46 | + $manager->expects($this->once())->method('saveItem'); |
|
| 47 | 47 | |
| 48 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) ); |
|
| 48 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' )); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testCreateFilter() |
| 53 | 53 | { |
| 54 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
| 54 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testGetItem() |
| 59 | 59 | { |
| 60 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 61 | - $customerItem = $manager->findItem( 'UTC001' ); |
|
| 60 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 61 | + $customerItem = $manager->findItem('UTC001'); |
|
| 62 | 62 | |
| 63 | - $this->context->setUserId( $customerItem->getId() ); |
|
| 63 | + $this->context->setUserId($customerItem->getId()); |
|
| 64 | 64 | |
| 65 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' ); |
|
| 66 | - $search = $manager->createSearch()->setSlice( 0, 1 ); |
|
| 67 | - $search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) ); |
|
| 68 | - $result = $manager->searchItems( $search ); |
|
| 65 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order'); |
|
| 66 | + $search = $manager->createSearch()->setSlice(0, 1); |
|
| 67 | + $search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId())); |
|
| 68 | + $result = $manager->searchItems($search); |
|
| 69 | 69 | |
| 70 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 71 | - throw new \RuntimeException( 'No order item found' ); |
|
| 70 | + if (($item = reset($result)) === false) { |
|
| 71 | + throw new \RuntimeException('No order item found'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) ); |
|
| 74 | + $this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId())); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | public function testGetItemException() |
| 79 | 79 | { |
| 80 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' ); |
|
| 81 | - $search = $manager->createSearch()->setSlice( 0, 1 ); |
|
| 82 | - $result = $manager->searchItems( $search ); |
|
| 80 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'order'); |
|
| 81 | + $search = $manager->createSearch()->setSlice(0, 1); |
|
| 82 | + $result = $manager->searchItems($search); |
|
| 83 | 83 | |
| 84 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 85 | - throw new \RuntimeException( 'No order item found' ); |
|
| 84 | + if (($item = reset($result)) === false) { |
|
| 85 | + throw new \RuntimeException('No order item found'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' ); |
|
| 89 | - $this->object->getItem( $item->getId() ); |
|
| 88 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception'); |
|
| 89 | + $this->object->getItem($item->getId()); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testSearchItems() |
| 94 | 94 | { |
| 95 | - $this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) ); |
|
| 95 | + $this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter())); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | public function testStore() |
| 100 | 100 | { |
| 101 | 101 | $name = 'ControllerFrontendOrderStore'; |
| 102 | - $this->context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
| 102 | + $this->context->getConfig()->set('mshop/order/manager/name', $name); |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 106 | - ->setMethods( array( 'saveItem', 'getSubManager' ) ) |
|
| 107 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 105 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 106 | + ->setMethods(array('saveItem', 'getSubManager')) |
|
| 107 | + ->setConstructorArgs(array($this->context)) |
|
| 108 | 108 | ->getMock(); |
| 109 | 109 | |
| 110 | - $orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
| 111 | - ->setMethods( array( 'store' ) ) |
|
| 112 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 110 | + $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
| 111 | + ->setMethods(array('store')) |
|
| 112 | + ->setConstructorArgs(array($this->context)) |
|
| 113 | 113 | ->getMock(); |
| 114 | 114 | |
| 115 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
| 115 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | $orderBaseItem = $orderBaseManagerStub->createItem(); |
| 119 | - $orderBaseItem->setId( 1 ); |
|
| 119 | + $orderBaseItem->setId(1); |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | - $orderBaseManagerStub->expects( $this->once() )->method( 'store' ); |
|
| 122 | + $orderBaseManagerStub->expects($this->once())->method('store'); |
|
| 123 | 123 | |
| 124 | - $orderManagerStub->expects( $this->once() )->method( 'getSubManager' ) |
|
| 125 | - ->will( $this->returnValue( $orderBaseManagerStub ) ); |
|
| 124 | + $orderManagerStub->expects($this->once())->method('getSubManager') |
|
| 125 | + ->will($this->returnValue($orderBaseManagerStub)); |
|
| 126 | 126 | |
| 127 | - $orderManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 127 | + $orderManagerStub->expects($this->once())->method('saveItem'); |
|
| 128 | 128 | |
| 129 | 129 | |
| 130 | - $this->object->store( $orderBaseItem ); |
|
| 130 | + $this->object->store($orderBaseItem); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | public function testBlock() |
| 135 | 135 | { |
| 136 | 136 | $name = 'ControllerFrontendOrderBlock'; |
| 137 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 137 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
| 138 | 138 | |
| 139 | 139 | |
| 140 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 141 | - ->setMethods( array( 'block' ) ) |
|
| 142 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 140 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 141 | + ->setMethods(array('block')) |
|
| 142 | + ->setConstructorArgs(array($this->context)) |
|
| 143 | 143 | ->getMock(); |
| 144 | 144 | |
| 145 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 145 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 146 | 146 | |
| 147 | - $orderCntlStub->expects( $this->once() )->method( 'block' ); |
|
| 147 | + $orderCntlStub->expects($this->once())->method('block'); |
|
| 148 | 148 | |
| 149 | 149 | |
| 150 | - $this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
| 150 | + $this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | public function testUnblock() |
| 155 | 155 | { |
| 156 | 156 | $name = 'ControllerFrontendOrderUnblock'; |
| 157 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 157 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 161 | - ->setMethods( array( 'unblock' ) ) |
|
| 162 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 160 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 161 | + ->setMethods(array('unblock')) |
|
| 162 | + ->setConstructorArgs(array($this->context)) |
|
| 163 | 163 | ->getMock(); |
| 164 | 164 | |
| 165 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 165 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 166 | 166 | |
| 167 | - $orderCntlStub->expects( $this->once() )->method( 'unblock' ); |
|
| 167 | + $orderCntlStub->expects($this->once())->method('unblock'); |
|
| 168 | 168 | |
| 169 | 169 | |
| 170 | - $this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
| 170 | + $this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | public function testUpdate() |
| 175 | 175 | { |
| 176 | 176 | $name = 'ControllerFrontendOrderUpdate'; |
| 177 | - $this->context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 177 | + $this->context->getConfig()->set('controller/common/order/name', $name); |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 181 | - ->setMethods( array( 'update' ) ) |
|
| 182 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 180 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 181 | + ->setMethods(array('update')) |
|
| 182 | + ->setConstructorArgs(array($this->context)) |
|
| 183 | 183 | ->getMock(); |
| 184 | 184 | |
| 185 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 185 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 186 | 186 | |
| 187 | - $orderCntlStub->expects( $this->once() )->method( 'update' ); |
|
| 187 | + $orderCntlStub->expects($this->once())->method('update'); |
|
| 188 | 188 | |
| 189 | 189 | |
| 190 | - $this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() ); |
|
| 190 | + $this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem()); |
|
| 191 | 191 | } |
| 192 | 192 | } |