@@ -93,8 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $interval = new \DateInterval( $item->getInterval() ); |
| 95 | 95 | $item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) ); |
| 96 | - } |
|
| 97 | - catch( \Exception $e ) |
|
| 96 | + } catch( \Exception $e ) |
|
| 98 | 97 | { |
| 99 | 98 | $item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT ); |
| 100 | 99 | $item->setDateEnd( date_create()->format( 'Y-m-d' ) ); |
@@ -108,8 +107,7 @@ discard block |
||
| 108 | 107 | foreach( $processors as $processor ) { |
| 109 | 108 | $processor->renew( $item, $newInvoice ); |
| 110 | 109 | } |
| 111 | - } |
|
| 112 | - catch( \Exception $e ) |
|
| 110 | + } catch( \Exception $e ) |
|
| 113 | 111 | { |
| 114 | 112 | $msg = 'Unable to process subscription with ID "%1$s": %2$s'; |
| 115 | 113 | $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | |
| 153 | 151 | $context->setUserId( $baseItem->getCustomerId() ); |
| 154 | 152 | $context->setGroupIds( $customerItem->getGroups() ); |
| 155 | - } |
|
| 156 | - catch( \Exception $e ) {} // Subscription without account |
|
| 153 | + } catch( \Exception $e ) {} // Subscription without account |
|
| 157 | 154 | |
| 158 | 155 | return $context; |
| 159 | 156 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function getName() |
| 30 | 30 | { |
| 31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process renew' ); |
|
| 31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process renew'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function getDescription() |
| 41 | 41 | { |
| 42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Renews subscriptions at next date' ); |
|
| 42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Renews subscriptions at next date'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -54,73 +54,73 @@ discard block |
||
| 54 | 54 | $config = $context->getConfig(); |
| 55 | 55 | $logger = $context->getLogger(); |
| 56 | 56 | |
| 57 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
| 57 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
| 58 | 58 | |
| 59 | - $date = date( 'Y-m-d' ); |
|
| 60 | - $processors = $this->getProcessors( $names ); |
|
| 61 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
| 59 | + $date = date('Y-m-d'); |
|
| 60 | + $processors = $this->getProcessors($names); |
|
| 61 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
| 62 | 62 | |
| 63 | - $search = $manager->createSearch( true ); |
|
| 63 | + $search = $manager->createSearch(true); |
|
| 64 | 64 | $expr = [ |
| 65 | - $search->compare( '<=', 'subscription.datenext', $date ), |
|
| 66 | - $search->combine( '||', [ |
|
| 67 | - $search->compare( '==', 'subscription.dateend', null ), |
|
| 68 | - $search->compare( '>', 'subscription.dateend', $date ), |
|
| 69 | - ] ), |
|
| 65 | + $search->compare('<=', 'subscription.datenext', $date), |
|
| 66 | + $search->combine('||', [ |
|
| 67 | + $search->compare('==', 'subscription.dateend', null), |
|
| 68 | + $search->compare('>', 'subscription.dateend', $date), |
|
| 69 | + ]), |
|
| 70 | 70 | $search->getConditions(), |
| 71 | 71 | ]; |
| 72 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 73 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
| 72 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 73 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
| 74 | 74 | |
| 75 | 75 | $start = 0; |
| 76 | 76 | |
| 77 | 77 | do |
| 78 | 78 | { |
| 79 | - $search->setSlice( $start, 100 ); |
|
| 80 | - $items = $manager->searchItems( $search ); |
|
| 79 | + $search->setSlice($start, 100); |
|
| 80 | + $items = $manager->searchItems($search); |
|
| 81 | 81 | |
| 82 | - foreach( $items as $item ) |
|
| 82 | + foreach ($items as $item) |
|
| 83 | 83 | { |
| 84 | 84 | try |
| 85 | 85 | { |
| 86 | - $context = $this->createContext( $item->getOrderBaseId() ); |
|
| 87 | - $newOrder = $this->createOrderBase( $context, $item ); |
|
| 88 | - $newInvoice = $this->createOrderInvoice( $context, $newOrder ); |
|
| 86 | + $context = $this->createContext($item->getOrderBaseId()); |
|
| 87 | + $newOrder = $this->createOrderBase($context, $item); |
|
| 88 | + $newInvoice = $this->createOrderInvoice($context, $newOrder); |
|
| 89 | 89 | |
| 90 | 90 | try |
| 91 | 91 | { |
| 92 | - $this->createPayment( $context, $newOrder, $newInvoice ); |
|
| 92 | + $this->createPayment($context, $newOrder, $newInvoice); |
|
| 93 | 93 | |
| 94 | - $interval = new \DateInterval( $item->getInterval() ); |
|
| 95 | - $item->setDateNext( date_create()->add( $interval )->format( 'Y-m-d' ) ); |
|
| 94 | + $interval = new \DateInterval($item->getInterval()); |
|
| 95 | + $item->setDateNext(date_create()->add($interval)->format('Y-m-d')); |
|
| 96 | 96 | } |
| 97 | - catch( \Exception $e ) |
|
| 97 | + catch (\Exception $e) |
|
| 98 | 98 | { |
| 99 | - $item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT ); |
|
| 100 | - $item->setDateEnd( date_create()->format( 'Y-m-d' ) ); |
|
| 101 | - $manager->saveItem( $item ); |
|
| 99 | + $item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_PAYMENT); |
|
| 100 | + $item->setDateEnd(date_create()->format('Y-m-d')); |
|
| 101 | + $manager->saveItem($item); |
|
| 102 | 102 | |
| 103 | 103 | throw $e; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $manager->saveItem( $item ); |
|
| 106 | + $manager->saveItem($item); |
|
| 107 | 107 | |
| 108 | - foreach( $processors as $processor ) { |
|
| 109 | - $processor->renew( $item, $newInvoice ); |
|
| 108 | + foreach ($processors as $processor) { |
|
| 109 | + $processor->renew($item, $newInvoice); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - catch( \Exception $e ) |
|
| 112 | + catch (\Exception $e) |
|
| 113 | 113 | { |
| 114 | 114 | $msg = 'Unable to process subscription with ID "%1$s": %2$s'; |
| 115 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
| 116 | - $logger->log( $e->getTraceAsString() ); |
|
| 115 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
| 116 | + $logger->log($e->getTraceAsString()); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $count = count( $items ); |
|
| 120 | + $count = count($items); |
|
| 121 | 121 | $start += $count; |
| 122 | 122 | } |
| 123 | - while( $count === $search->getSliceSize() ); |
|
| 123 | + while ($count === $search->getSliceSize()); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Order including product and addresses |
| 132 | 132 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery service added |
| 133 | 133 | */ |
| 134 | - protected function addDeliveryService( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 134 | + protected function addDeliveryService(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 135 | 135 | { |
| 136 | 136 | $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY; |
| 137 | 137 | |
| 138 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 139 | - $orderServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
| 138 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 139 | + $orderServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
| 140 | 140 | |
| 141 | - $search = $serviceManager->createSearch( true ); |
|
| 142 | - $search->setSortations( [$search->sort( '+', 'service.position' )] ); |
|
| 143 | - $search->setConditions( $search->compare( '==', 'service.type.code', $type ) ); |
|
| 141 | + $search = $serviceManager->createSearch(true); |
|
| 142 | + $search->setSortations([$search->sort('+', 'service.position')]); |
|
| 143 | + $search->setConditions($search->compare('==', 'service.type.code', $type)); |
|
| 144 | 144 | |
| 145 | - foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item ) |
|
| 145 | + foreach ($serviceManager->searchItems($search, ['media', 'price', 'text']) as $item) |
|
| 146 | 146 | { |
| 147 | - $provider = $serviceManager->getProvider( $item, $item->getType() ); |
|
| 147 | + $provider = $serviceManager->getProvider($item, $item->getType()); |
|
| 148 | 148 | |
| 149 | - if( $provider->isAvailable( $basket ) === true ) |
|
| 149 | + if ($provider->isAvailable($basket) === true) |
|
| 150 | 150 | { |
| 151 | - $orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item ); |
|
| 152 | - $basket->addService( $orderServiceItem, $type ); |
|
| 151 | + $orderServiceItem = $orderServiceManager->createItem()->copyFrom($item); |
|
| 152 | + $basket->addService($orderServiceItem, $type); |
|
| 153 | 153 | |
| 154 | 154 | return $basket; |
| 155 | 155 | } |
@@ -165,30 +165,30 @@ discard block |
||
| 165 | 165 | * @param string $baseId Unique order base ID |
| 166 | 166 | * @return \Aimeos\MShop\Context\Item\Iface New context object |
| 167 | 167 | */ |
| 168 | - protected function createContext( $baseId ) |
|
| 168 | + protected function createContext($baseId) |
|
| 169 | 169 | { |
| 170 | 170 | $context = clone $this->getContext(); |
| 171 | 171 | |
| 172 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 173 | - $baseItem = $manager->getItem( $baseId ); |
|
| 172 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 173 | + $baseItem = $manager->getItem($baseId); |
|
| 174 | 174 | |
| 175 | 175 | $locale = $baseItem->getLocale(); |
| 176 | 176 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 177 | 177 | |
| 178 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 179 | - $locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level ); |
|
| 178 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 179 | + $locale = $manager->bootstrap($baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level); |
|
| 180 | 180 | |
| 181 | - $context->setLocale( $locale ); |
|
| 181 | + $context->setLocale($locale); |
|
| 182 | 182 | |
| 183 | 183 | try |
| 184 | 184 | { |
| 185 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 186 | - $customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); |
|
| 185 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 186 | + $customerItem = $manager->getItem($baseItem->getCustomerId(), ['customer/group']); |
|
| 187 | 187 | |
| 188 | - $context->setUserId( $baseItem->getCustomerId() ); |
|
| 189 | - $context->setGroupIds( $customerItem->getGroups() ); |
|
| 188 | + $context->setUserId($baseItem->getCustomerId()); |
|
| 189 | + $context->setGroupIds($customerItem->getGroups()); |
|
| 190 | 190 | } |
| 191 | - catch( \Exception $e ) {} // Subscription without account |
|
| 191 | + catch (\Exception $e) {} // Subscription without account |
|
| 192 | 192 | |
| 193 | 193 | return $context; |
| 194 | 194 | } |
@@ -201,39 +201,39 @@ discard block |
||
| 201 | 201 | * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID |
| 202 | 202 | * @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage |
| 203 | 203 | */ |
| 204 | - protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription ) |
|
| 204 | + protected function createOrderBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription) |
|
| 205 | 205 | { |
| 206 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 206 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 207 | 207 | |
| 208 | - $basket = $manager->load( $subscription->getOrderBaseId() ); |
|
| 208 | + $basket = $manager->load($subscription->getOrderBaseId()); |
|
| 209 | 209 | |
| 210 | 210 | $newBasket = $manager->createItem(); |
| 211 | - $newBasket->setCustomerId( $basket->getCustomerId() ); |
|
| 211 | + $newBasket->setCustomerId($basket->getCustomerId()); |
|
| 212 | 212 | |
| 213 | - foreach( $basket->getProducts() as $orderProduct ) |
|
| 213 | + foreach ($basket->getProducts() as $orderProduct) |
|
| 214 | 214 | { |
| 215 | - if( $orderProduct->getId() === $subscription->getOrderProductId() ) |
|
| 215 | + if ($orderProduct->getId() === $subscription->getOrderProductId()) |
|
| 216 | 216 | { |
| 217 | - foreach( $orderProduct->getAttributeItems() as $attrItem ) { |
|
| 218 | - $attrItem->setId( null ); |
|
| 217 | + foreach ($orderProduct->getAttributeItems() as $attrItem) { |
|
| 218 | + $attrItem->setId(null); |
|
| 219 | 219 | } |
| 220 | - $newBasket->addProduct( $orderProduct->setId( null ) ); |
|
| 220 | + $newBasket->addProduct($orderProduct->setId(null)); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - foreach( $basket->getAddresses() as $type => $orderAddress ) { |
|
| 225 | - $newBasket->setAddress( $orderAddress, $type ); |
|
| 224 | + foreach ($basket->getAddresses() as $type => $orderAddress) { |
|
| 225 | + $newBasket->setAddress($orderAddress, $type); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT; |
| 229 | 229 | |
| 230 | - foreach( $basket->getService( $type ) as $orderService ) { |
|
| 231 | - $newBasket->addService( $orderService, $type ); |
|
| 230 | + foreach ($basket->getService($type) as $orderService) { |
|
| 231 | + $newBasket->addService($orderService, $type); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $newBasket = $this->addDeliveryService( $context, $newBasket ); |
|
| 234 | + $newBasket = $this->addDeliveryService($context, $newBasket); |
|
| 235 | 235 | |
| 236 | - return $manager->store( $newBasket ); |
|
| 236 | + return $manager->store($newBasket); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage |
| 245 | 245 | * @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage |
| 246 | 246 | */ |
| 247 | - protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 247 | + protected function createOrderInvoice(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 248 | 248 | { |
| 249 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 249 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 250 | 250 | |
| 251 | 251 | $item = $manager->createItem(); |
| 252 | - $item->setBaseId( $basket->getId() ); |
|
| 253 | - $item->setType( 'subscription' ); |
|
| 252 | + $item->setBaseId($basket->getId()); |
|
| 253 | + $item->setType('subscription'); |
|
| 254 | 254 | |
| 255 | - return $manager->saveItem( $item ); |
|
| 255 | + return $manager->saveItem($item); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -263,17 +263,17 @@ discard block |
||
| 263 | 263 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services |
| 264 | 264 | * @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order |
| 265 | 265 | */ |
| 266 | - protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 267 | - \Aimeos\MShop\Order\Item\Iface $invoice ) |
|
| 266 | + protected function createPayment(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 267 | + \Aimeos\MShop\Order\Item\Iface $invoice) |
|
| 268 | 268 | { |
| 269 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 269 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 270 | 270 | |
| 271 | - foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service ) |
|
| 271 | + foreach ($basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT) as $service) |
|
| 272 | 272 | { |
| 273 | - $item = $manager->getItem( $service->getServiceId() ); |
|
| 274 | - $provider = $manager->getProvider( $item, 'payment' ); |
|
| 273 | + $item = $manager->getItem($service->getServiceId()); |
|
| 274 | + $provider = $manager->getProvider($item, 'payment'); |
|
| 275 | 275 | |
| 276 | - $provider->repay( $invoice ); |
|
| 276 | + $provider->repay($invoice); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -20,49 +20,49 @@ discard block |
||
| 20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
| 21 | 21 | $this->context = \TestHelperJobs::getContext(); |
| 22 | 22 | |
| 23 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos ); |
|
| 23 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos); |
|
| 24 | 24 | |
| 25 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 25 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 31 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 32 | 32 | \Aimeos\MShop\Factory::clear(); |
| 33 | 33 | |
| 34 | - unset( $this->object, $this->context ); |
|
| 34 | + unset($this->object, $this->context); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGetName() |
| 39 | 39 | { |
| 40 | - $this->assertEquals( 'Subscription process start', $this->object->getName() ); |
|
| 40 | + $this->assertEquals('Subscription process start', $this->object->getName()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetDescription() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() ); |
|
| 46 | + $this->assertEquals('Process subscriptions initially', $this->object->getDescription()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testRun() |
| 51 | 51 | { |
| 52 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 52 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 53 | 53 | $item = $this->getSubscription(); |
| 54 | 54 | |
| 55 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 56 | - ->setConstructorArgs( [$this->context] ) |
|
| 57 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 55 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 56 | + ->setConstructorArgs([$this->context]) |
|
| 57 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 58 | 58 | ->getMock(); |
| 59 | 59 | |
| 60 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
| 60 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
| 61 | 61 | |
| 62 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 63 | - ->will( $this->returnValue( [$item] ) ); |
|
| 62 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 63 | + ->will($this->returnValue([$item])); |
|
| 64 | 64 | |
| 65 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 65 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 66 | 66 | |
| 67 | 67 | $this->object->run(); |
| 68 | 68 | } |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function testRunException() |
| 72 | 72 | { |
| 73 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 74 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] ); |
|
| 73 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 74 | + $this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']); |
|
| 75 | 75 | |
| 76 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 77 | - ->setConstructorArgs( [$this->context] ) |
|
| 78 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 76 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 77 | + ->setConstructorArgs([$this->context]) |
|
| 78 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 79 | 79 | ->getMock(); |
| 80 | 80 | |
| 81 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
| 81 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
| 82 | 82 | |
| 83 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 84 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
| 83 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 84 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
| 85 | 85 | |
| 86 | - $managerStub->expects( $this->once() )->method( 'saveItem' ) |
|
| 87 | - ->will( $this->throwException( new \Exception() ) ); |
|
| 86 | + $managerStub->expects($this->once())->method('saveItem') |
|
| 87 | + ->will($this->throwException(new \Exception())); |
|
| 88 | 88 | |
| 89 | 89 | $this->object->run(); |
| 90 | 90 | } |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | protected function getSubscription() |
| 94 | 94 | { |
| 95 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
| 95 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
| 96 | 96 | |
| 97 | 97 | $search = $manager->createSearch(); |
| 98 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 98 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 99 | 99 | |
| 100 | - $items = $manager->searchItems( $search ); |
|
| 100 | + $items = $manager->searchItems($search); |
|
| 101 | 101 | |
| 102 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 102 | + if (($item = reset($items)) !== false) { |
|
| 103 | 103 | return $item; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - throw new \Exception( 'No subscription item found' ); |
|
| 106 | + throw new \Exception('No subscription item found'); |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | $listItem = $listMap[$content][$type][$typecode]; |
| 109 | 109 | $refItem = $listItem->getRefItem(); |
| 110 | 110 | unset( $listItems[ $listItem->getId() ] ); |
| 111 | - } |
|
| 112 | - else |
|
| 111 | + } else |
|
| 113 | 112 | { |
| 114 | 113 | $listItem = $listManager->createItem( $typecode, 'text' ); |
| 115 | 114 | $refItem = $manager->createItem( $type, 'catalog' ); |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 43 | 43 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor |
| 44 | 44 | */ |
| 45 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 46 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
|
| 45 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 46 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null) |
|
| 47 | 47 | { |
| 48 | - parent::__construct( $context, $mapping, $object ); |
|
| 48 | + parent::__construct($context, $mapping, $object); |
|
| 49 | 49 | |
| 50 | 50 | /** controller/common/catalog/import/csv/processor/text/listtypes |
| 51 | 51 | * Names of the catalog list types for texts that are updated or removed |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @see controller/common/catalog/import/csv/processor/price/listtypes |
| 67 | 67 | * @see controller/common/catalog/import/csv/processor/catalog/listtypes |
| 68 | 68 | */ |
| 69 | - $this->listTypes = $context->getConfig()->get( 'controller/common/catalog/import/csv/processor/text/listtypes' ); |
|
| 69 | + $this->listTypes = $context->getConfig()->get('controller/common/catalog/import/csv/processor/text/listtypes'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -77,53 +77,53 @@ discard block |
||
| 77 | 77 | * @param array $data List of CSV fields with position as key and data as value |
| 78 | 78 | * @return array List of data which hasn't been imported |
| 79 | 79 | */ |
| 80 | - public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data ) |
|
| 80 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data) |
|
| 81 | 81 | { |
| 82 | - $listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
| 83 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text' ); |
|
| 82 | + $listManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
| 83 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text'); |
|
| 84 | 84 | |
| 85 | 85 | $listMap = []; |
| 86 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
| 87 | - $listItems = $catalog->getListItems( 'text', $this->listTypes ); |
|
| 86 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
| 87 | + $listItems = $catalog->getListItems('text', $this->listTypes); |
|
| 88 | 88 | |
| 89 | - foreach( $listItems as $listItem ) |
|
| 89 | + foreach ($listItems as $listItem) |
|
| 90 | 90 | { |
| 91 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
| 92 | - $listMap[ $refItem->getContent() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem; |
|
| 91 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
| 92 | + $listMap[$refItem->getContent()][$refItem->getType()][$listItem->getType()] = $listItem; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - foreach( $map as $pos => $list ) |
|
| 96 | + foreach ($map as $pos => $list) |
|
| 97 | 97 | { |
| 98 | - if( $this->checkEntry( $list ) === false ) { |
|
| 98 | + if ($this->checkEntry($list) === false) { |
|
| 99 | 99 | continue; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $content = trim( $list['text.content'] ); |
|
| 103 | - $type = trim( isset( $list['text.type'] ) ? $list['text.type'] : 'name' ); |
|
| 104 | - $typecode = trim( isset( $list['catalog.lists.type'] ) ? $list['catalog.lists.type'] : 'default' ); |
|
| 102 | + $content = trim($list['text.content']); |
|
| 103 | + $type = trim(isset($list['text.type']) ? $list['text.type'] : 'name'); |
|
| 104 | + $typecode = trim(isset($list['catalog.lists.type']) ? $list['catalog.lists.type'] : 'default'); |
|
| 105 | 105 | |
| 106 | - if( isset( $listMap[$content][$type][$typecode] ) ) |
|
| 106 | + if (isset($listMap[$content][$type][$typecode])) |
|
| 107 | 107 | { |
| 108 | 108 | $listItem = $listMap[$content][$type][$typecode]; |
| 109 | 109 | $refItem = $listItem->getRefItem(); |
| 110 | - unset( $listItems[ $listItem->getId() ] ); |
|
| 110 | + unset($listItems[$listItem->getId()]); |
|
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - $listItem = $listManager->createItem( $typecode, 'text' ); |
|
| 115 | - $refItem = $manager->createItem( $type, 'catalog' ); |
|
| 114 | + $listItem = $listManager->createItem($typecode, 'text'); |
|
| 115 | + $refItem = $manager->createItem($type, 'catalog'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $refItem->fromArray( $this->addItemDefaults( $list ) ); |
|
| 119 | - $listItem->fromArray( $this->addListItemDefaults( $list, $pos ) ); |
|
| 118 | + $refItem->fromArray($this->addItemDefaults($list)); |
|
| 119 | + $listItem->fromArray($this->addListItemDefaults($list, $pos)); |
|
| 120 | 120 | |
| 121 | - $catalog->addListItem( 'text', $listItem, $refItem ); |
|
| 121 | + $catalog->addListItem('text', $listItem, $refItem); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $catalog->deleteListItems( $listItems, true ); |
|
| 124 | + $catalog->deleteListItems($listItems, true); |
|
| 125 | 125 | |
| 126 | - return $this->getObject()->process( $catalog, $data ); |
|
| 126 | + return $this->getObject()->process($catalog, $data); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | * @param array $list Associative list of domain item keys and their values, e.g. "text.status" => 1 |
| 134 | 134 | * @return array Given associative list enriched by default values if they were not already set |
| 135 | 135 | */ |
| 136 | - protected function addItemDefaults( array $list ) |
|
| 136 | + protected function addItemDefaults(array $list) |
|
| 137 | 137 | { |
| 138 | - if( !isset( $list['text.label'] ) ) { |
|
| 139 | - $list['text.label'] = mb_strcut( trim( $list['text.content'] ), 0, 255 ); |
|
| 138 | + if (!isset($list['text.label'])) { |
|
| 139 | + $list['text.label'] = mb_strcut(trim($list['text.content']), 0, 255); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if( !isset( $list['text.status'] ) ) { |
|
| 142 | + if (!isset($list['text.status'])) { |
|
| 143 | 143 | $list['text.status'] = 1; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | * @param array $list Associative list of key/value pairs from the mapping |
| 154 | 154 | * @return boolean True if valid, false if not |
| 155 | 155 | */ |
| 156 | - protected function checkEntry( array $list ) |
|
| 156 | + protected function checkEntry(array $list) |
|
| 157 | 157 | { |
| 158 | - if( !isset( $list['text.content'] ) || trim( $list['text.content'] ) === '' || isset( $list['catalog.lists.type'] ) |
|
| 159 | - && $this->listTypes !== null && !in_array( trim( $list['catalog.lists.type'] ), (array) $this->listTypes ) |
|
| 158 | + if (!isset($list['text.content']) || trim($list['text.content']) === '' || isset($list['catalog.lists.type']) |
|
| 159 | + && $this->listTypes !== null && !in_array(trim($list['catalog.lists.type']), (array) $this->listTypes) |
|
| 160 | 160 | ) { |
| 161 | 161 | return false; |
| 162 | 162 | } |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | $listItem = $listMap[$url][$type][$typecode]; |
| 113 | 113 | $refItem = $listItem->getRefItem(); |
| 114 | 114 | unset( $listItems[ $listItem->getId() ] ); |
| 115 | - } |
|
| 116 | - else |
|
| 115 | + } else |
|
| 117 | 116 | { |
| 118 | 117 | $listItem = $listManager->createItem( $typecode, 'media' ); |
| 119 | 118 | $refItem = $manager->createItem( $type, 'catalog' ); |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 43 | 43 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor |
| 44 | 44 | */ |
| 45 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 46 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
|
| 45 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 46 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null) |
|
| 47 | 47 | { |
| 48 | - parent::__construct( $context, $mapping, $object ); |
|
| 48 | + parent::__construct($context, $mapping, $object); |
|
| 49 | 49 | |
| 50 | 50 | /** controller/common/catalog/import/csv/processor/media/listtypes |
| 51 | 51 | * Names of the catalog list types for media that are updated or removed |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @see controller/common/catalog/import/csv/processor/price/listtypes |
| 67 | 67 | * @see controller/common/catalog/import/csv/processor/text/listtypes |
| 68 | 68 | */ |
| 69 | - $this->listTypes = $context->getConfig()->get( 'controller/common/catalog/import/csv/processor/media/listtypes' ); |
|
| 69 | + $this->listTypes = $context->getConfig()->get('controller/common/catalog/import/csv/processor/media/listtypes'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -77,60 +77,60 @@ discard block |
||
| 77 | 77 | * @param array $data List of CSV fields with position as key and data as value |
| 78 | 78 | * @return array List of data which hasn't been imported |
| 79 | 79 | */ |
| 80 | - public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data ) |
|
| 80 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data) |
|
| 81 | 81 | { |
| 82 | 82 | $context = $this->getContext(); |
| 83 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
| 84 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' ); |
|
| 85 | - $separator = $context->getConfig()->get( 'controller/common/catalog/import/csv/separator', "\n" ); |
|
| 83 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
| 84 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists'); |
|
| 85 | + $separator = $context->getConfig()->get('controller/common/catalog/import/csv/separator', "\n"); |
|
| 86 | 86 | |
| 87 | 87 | $listMap = []; |
| 88 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
| 89 | - $listItems = $catalog->getListItems( 'media', $this->listTypes ); |
|
| 88 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
| 89 | + $listItems = $catalog->getListItems('media', $this->listTypes); |
|
| 90 | 90 | |
| 91 | - foreach( $listItems as $listItem ) |
|
| 91 | + foreach ($listItems as $listItem) |
|
| 92 | 92 | { |
| 93 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
| 94 | - $listMap[ $refItem->getUrl() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem; |
|
| 93 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
| 94 | + $listMap[$refItem->getUrl()][$refItem->getType()][$listItem->getType()] = $listItem; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - foreach( $map as $pos => $list ) |
|
| 98 | + foreach ($map as $pos => $list) |
|
| 99 | 99 | { |
| 100 | - if( $this->checkEntry( $list ) === false ) { |
|
| 100 | + if ($this->checkEntry($list) === false) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $urls = explode( $separator, trim( $list['media.url'] ) ); |
|
| 105 | - $type = trim( $this->getValue( $list, 'media.type', 'default' ) ); |
|
| 106 | - $typecode = trim( $this->getValue( $list, 'catalog.lists.type', 'default' ) ); |
|
| 104 | + $urls = explode($separator, trim($list['media.url'])); |
|
| 105 | + $type = trim($this->getValue($list, 'media.type', 'default')); |
|
| 106 | + $typecode = trim($this->getValue($list, 'catalog.lists.type', 'default')); |
|
| 107 | 107 | |
| 108 | - foreach( $urls as $url ) |
|
| 108 | + foreach ($urls as $url) |
|
| 109 | 109 | { |
| 110 | - if( isset( $listMap[$url][$type][$typecode] ) ) |
|
| 110 | + if (isset($listMap[$url][$type][$typecode])) |
|
| 111 | 111 | { |
| 112 | 112 | $listItem = $listMap[$url][$type][$typecode]; |
| 113 | 113 | $refItem = $listItem->getRefItem(); |
| 114 | - unset( $listItems[ $listItem->getId() ] ); |
|
| 114 | + unset($listItems[$listItem->getId()]); |
|
| 115 | 115 | } |
| 116 | 116 | else |
| 117 | 117 | { |
| 118 | - $listItem = $listManager->createItem( $typecode, 'media' ); |
|
| 119 | - $refItem = $manager->createItem( $type, 'catalog' ); |
|
| 118 | + $listItem = $listManager->createItem($typecode, 'media'); |
|
| 119 | + $refItem = $manager->createItem($type, 'catalog'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $list['media.url'] = $url; |
| 123 | 123 | |
| 124 | - $list = $refItem->fromArray( $this->addItemDefaults( $list ) ); |
|
| 125 | - $list = $listItem->fromArray( $this->addListItemDefaults( $list, $pos++ ) ); |
|
| 124 | + $list = $refItem->fromArray($this->addItemDefaults($list)); |
|
| 125 | + $list = $listItem->fromArray($this->addListItemDefaults($list, $pos++)); |
|
| 126 | 126 | |
| 127 | - $catalog->addListItem( 'media', $listItem, $refItem ); |
|
| 127 | + $catalog->addListItem('media', $listItem, $refItem); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $catalog->deleteListItems( $listItems, true ); |
|
| 131 | + $catalog->deleteListItems($listItems, true); |
|
| 132 | 132 | |
| 133 | - return $this->getObject()->process( $catalog, $data ); |
|
| 133 | + return $this->getObject()->process($catalog, $data); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | * @param array $list Associative list of domain item keys and their values, e.g. "media.status" => 1 |
| 141 | 141 | * @return array Given associative list enriched by default values if they were not already set |
| 142 | 142 | */ |
| 143 | - protected function addItemDefaults( array $list ) |
|
| 143 | + protected function addItemDefaults(array $list) |
|
| 144 | 144 | { |
| 145 | - if( !isset( $list['media.label'] ) ) { |
|
| 145 | + if (!isset($list['media.label'])) { |
|
| 146 | 146 | $list['media.label'] = $list['media.url']; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if( !isset( $list['media.preview'] ) ) { |
|
| 149 | + if (!isset($list['media.preview'])) { |
|
| 150 | 150 | $list['media.preview'] = $list['media.url']; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if( !isset( $list['media.status'] ) ) { |
|
| 153 | + if (!isset($list['media.status'])) { |
|
| 154 | 154 | $list['media.status'] = 1; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * @param array $list Associative list of key/value pairs from the mapping |
| 165 | 165 | * @return boolean True if valid, false if not |
| 166 | 166 | */ |
| 167 | - protected function checkEntry( array $list ) |
|
| 167 | + protected function checkEntry(array $list) |
|
| 168 | 168 | { |
| 169 | - if( !isset( $list['media.url'] ) || trim( $list['media.url'] ) === '' || isset( $list['catalog.lists.type'] ) |
|
| 170 | - && $this->listTypes !== null && !in_array( trim( $list['catalog.lists.type'] ), (array) $this->listTypes ) |
|
| 169 | + if (!isset($list['media.url']) || trim($list['media.url']) === '' || isset($list['catalog.lists.type']) |
|
| 170 | + && $this->listTypes !== null && !in_array(trim($list['catalog.lists.type']), (array) $this->listTypes) |
|
| 171 | 171 | ) { |
| 172 | 172 | return false; |
| 173 | 173 | } |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperCntl::getContext(); |
| 23 | - $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $this->context, [] ); |
|
| 23 | + $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($this->context, []); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 29 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 30 | 30 | \Aimeos\MShop\Factory::clear(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -49,31 +49,31 @@ discard block |
||
| 49 | 49 | 4 => 1, |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 52 | + $catalog = $this->create('job_csv_test'); |
|
| 53 | 53 | |
| 54 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 55 | - $object->process( $catalog, $data ); |
|
| 54 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 55 | + $object->process($catalog, $data); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | $listItems = $catalog->getListItems(); |
| 59 | - $listItem = reset( $listItems ); |
|
| 59 | + $listItem = reset($listItems); |
|
| 60 | 60 | |
| 61 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 62 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 61 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 62 | + $this->assertEquals(1, count($listItems)); |
|
| 63 | 63 | |
| 64 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
| 65 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
| 66 | - $this->assertEquals( 'text', $listItem->getDomain() ); |
|
| 67 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 64 | + $this->assertEquals(1, $listItem->getStatus()); |
|
| 65 | + $this->assertEquals(0, $listItem->getPosition()); |
|
| 66 | + $this->assertEquals('text', $listItem->getDomain()); |
|
| 67 | + $this->assertEquals('default', $listItem->getType()); |
|
| 68 | 68 | |
| 69 | 69 | $refItem = $listItem->getRefItem(); |
| 70 | 70 | |
| 71 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
| 72 | - $this->assertEquals( 'name', $refItem->getType() ); |
|
| 73 | - $this->assertEquals( 'test text', $refItem->getLabel() ); |
|
| 74 | - $this->assertEquals( 'Job CSV test', $refItem->getContent() ); |
|
| 75 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
| 76 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
| 71 | + $this->assertEquals(1, $refItem->getStatus()); |
|
| 72 | + $this->assertEquals('name', $refItem->getType()); |
|
| 73 | + $this->assertEquals('test text', $refItem->getLabel()); |
|
| 74 | + $this->assertEquals('Job CSV test', $refItem->getContent()); |
|
| 75 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
| 76 | + $this->assertEquals(1, $refItem->getStatus()); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -101,27 +101,27 @@ discard block |
||
| 101 | 101 | 7 => 'Long: Job CSV test 2', |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 104 | + $catalog = $this->create('job_csv_test'); |
|
| 105 | 105 | |
| 106 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 107 | - $object->process( $catalog, $data ); |
|
| 106 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 107 | + $object->process($catalog, $data); |
|
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | $pos = 0; |
| 111 | 111 | $listItems = $catalog->getListItems(); |
| 112 | 112 | $expected = array( |
| 113 | - 0 => array( 'name', 'Job CSV test' ), |
|
| 114 | - 1 => array( 'short', 'Short: Job CSV test' ), |
|
| 115 | - 2 => array( 'long', 'Long: Job CSV test' ), |
|
| 116 | - 3 => array( 'long', 'Long: Job CSV test 2' ), |
|
| 113 | + 0 => array('name', 'Job CSV test'), |
|
| 114 | + 1 => array('short', 'Short: Job CSV test'), |
|
| 115 | + 2 => array('long', 'Long: Job CSV test'), |
|
| 116 | + 3 => array('long', 'Long: Job CSV test 2'), |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - $this->assertEquals( 4, count( $listItems ) ); |
|
| 119 | + $this->assertEquals(4, count($listItems)); |
|
| 120 | 120 | |
| 121 | - foreach( $listItems as $listItem ) |
|
| 121 | + foreach ($listItems as $listItem) |
|
| 122 | 122 | { |
| 123 | - $this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() ); |
|
| 124 | - $this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() ); |
|
| 123 | + $this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType()); |
|
| 124 | + $this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent()); |
|
| 125 | 125 | $pos++; |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -144,21 +144,21 @@ discard block |
||
| 144 | 144 | 1 => 'Short: Job CSV test', |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 147 | + $catalog = $this->create('job_csv_test'); |
|
| 148 | 148 | |
| 149 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 150 | - $object->process( $catalog, $data ); |
|
| 151 | - $object->process( $catalog, $dataUpdate ); |
|
| 149 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 150 | + $object->process($catalog, $data); |
|
| 151 | + $object->process($catalog, $dataUpdate); |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | $listItems = $catalog->getListItems(); |
| 155 | - $listItem = reset( $listItems ); |
|
| 155 | + $listItem = reset($listItems); |
|
| 156 | 156 | |
| 157 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 158 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 157 | + $this->assertEquals(1, count($listItems)); |
|
| 158 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 159 | 159 | |
| 160 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
| 161 | - $this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() ); |
|
| 160 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
| 161 | + $this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent()); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | 1 => 'Job CSV test', |
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 177 | + $catalog = $this->create('job_csv_test'); |
|
| 178 | 178 | |
| 179 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 180 | - $object->process( $catalog, $data ); |
|
| 179 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 180 | + $object->process($catalog, $data); |
|
| 181 | 181 | |
| 182 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint ); |
|
| 183 | - $object->process( $catalog, [] ); |
|
| 182 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint); |
|
| 183 | + $object->process($catalog, []); |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | $listItems = $catalog->getListItems(); |
| 187 | 187 | |
| 188 | - $this->assertEquals( 0, count( $listItems ) ); |
|
| 188 | + $this->assertEquals(0, count($listItems)); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | 3 => '', |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 208 | + $catalog = $this->create('job_csv_test'); |
|
| 209 | 209 | |
| 210 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 211 | - $object->process( $catalog, $data ); |
|
| 210 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 211 | + $object->process($catalog, $data); |
|
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | $listItems = $catalog->getListItems(); |
| 215 | 215 | |
| 216 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 216 | + $this->assertEquals(1, count($listItems)); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -237,35 +237,35 @@ discard block |
||
| 237 | 237 | 5 => 'default', |
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | - $this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/text/listtypes', array( 'default' ) ); |
|
| 240 | + $this->context->getConfig()->set('controller/common/catalog/import/csv/processor/text/listtypes', array('default')); |
|
| 241 | 241 | |
| 242 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 242 | + $catalog = $this->create('job_csv_test'); |
|
| 243 | 243 | |
| 244 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 245 | - $object->process( $catalog, $data ); |
|
| 244 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint); |
|
| 245 | + $object->process($catalog, $data); |
|
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | $listItems = $catalog->getListItems(); |
| 249 | - $listItem = reset( $listItems ); |
|
| 249 | + $listItem = reset($listItems); |
|
| 250 | 250 | |
| 251 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 252 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 251 | + $this->assertEquals(1, count($listItems)); |
|
| 252 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 253 | 253 | |
| 254 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 255 | - $this->assertEquals( 'short', $listItem->getRefItem()->getType() ); |
|
| 256 | - $this->assertEquals( 'test short', $listItem->getRefItem()->getContent() ); |
|
| 254 | + $this->assertEquals('default', $listItem->getType()); |
|
| 255 | + $this->assertEquals('short', $listItem->getRefItem()->getType()); |
|
| 256 | + $this->assertEquals('test short', $listItem->getRefItem()->getContent()); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * @param string $code |
| 262 | 262 | */ |
| 263 | - protected function create( $code ) |
|
| 263 | + protected function create($code) |
|
| 264 | 264 | { |
| 265 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 265 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 266 | 266 | |
| 267 | 267 | $item = $manager->createItem(); |
| 268 | - $item->setCode( $code ); |
|
| 268 | + $item->setCode($code); |
|
| 269 | 269 | |
| 270 | 270 | return $item; |
| 271 | 271 | } |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperCntl::getContext(); |
| 23 | - $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $this->context, [] ); |
|
| 23 | + $this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($this->context, []); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 29 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 30 | 30 | \Aimeos\MShop\Factory::clear(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -51,32 +51,32 @@ discard block |
||
| 51 | 51 | 5 => 1, |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 54 | + $catalog = $this->create('job_csv_test'); |
|
| 55 | 55 | |
| 56 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 57 | - $object->process( $catalog, $data ); |
|
| 56 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 57 | + $object->process($catalog, $data); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | $listItems = $catalog->getListItems(); |
| 61 | - $listItem = reset( $listItems ); |
|
| 61 | + $listItem = reset($listItems); |
|
| 62 | 62 | |
| 63 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 64 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 63 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 64 | + $this->assertEquals(1, count($listItems)); |
|
| 65 | 65 | |
| 66 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
| 67 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
| 68 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
| 69 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 66 | + $this->assertEquals(1, $listItem->getStatus()); |
|
| 67 | + $this->assertEquals(0, $listItem->getPosition()); |
|
| 68 | + $this->assertEquals('media', $listItem->getDomain()); |
|
| 69 | + $this->assertEquals('default', $listItem->getType()); |
|
| 70 | 70 | |
| 71 | 71 | $refItem = $listItem->getRefItem(); |
| 72 | 72 | |
| 73 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
| 74 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
| 75 | - $this->assertEquals( 'test image', $refItem->getLabel() ); |
|
| 76 | - $this->assertEquals( 'image/jpeg', $refItem->getMimetype() ); |
|
| 77 | - $this->assertEquals( 'path/to/preview', $refItem->getPreview() ); |
|
| 78 | - $this->assertEquals( 'path/to/file', $refItem->getUrl() ); |
|
| 79 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
| 73 | + $this->assertEquals(1, $refItem->getStatus()); |
|
| 74 | + $this->assertEquals('default', $refItem->getType()); |
|
| 75 | + $this->assertEquals('test image', $refItem->getLabel()); |
|
| 76 | + $this->assertEquals('image/jpeg', $refItem->getMimetype()); |
|
| 77 | + $this->assertEquals('path/to/preview', $refItem->getPreview()); |
|
| 78 | + $this->assertEquals('path/to/file', $refItem->getUrl()); |
|
| 79 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -90,21 +90,21 @@ discard block |
||
| 90 | 90 | 0 => "path/to/0\npath/to/1\npath/to/2\npath/to/3", |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 93 | + $catalog = $this->create('job_csv_test'); |
|
| 94 | 94 | |
| 95 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 96 | - $object->process( $catalog, $data ); |
|
| 95 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 96 | + $object->process($catalog, $data); |
|
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | $pos = 0; |
| 100 | 100 | $listItems = $catalog->getListItems(); |
| 101 | - $expected = array( 'path/to/0', 'path/to/1', 'path/to/2', 'path/to/3' ); |
|
| 101 | + $expected = array('path/to/0', 'path/to/1', 'path/to/2', 'path/to/3'); |
|
| 102 | 102 | |
| 103 | - $this->assertEquals( 4, count( $listItems ) ); |
|
| 103 | + $this->assertEquals(4, count($listItems)); |
|
| 104 | 104 | |
| 105 | - foreach( $listItems as $listItem ) |
|
| 105 | + foreach ($listItems as $listItem) |
|
| 106 | 106 | { |
| 107 | - $this->assertEquals( $expected[$pos], $listItem->getRefItem()->getUrl() ); |
|
| 107 | + $this->assertEquals($expected[$pos], $listItem->getRefItem()->getUrl()); |
|
| 108 | 108 | $pos++; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -126,20 +126,20 @@ discard block |
||
| 126 | 126 | 3 => 'path/to/3', |
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 129 | + $catalog = $this->create('job_csv_test'); |
|
| 130 | 130 | |
| 131 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 132 | - $object->process( $catalog, $data ); |
|
| 131 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 132 | + $object->process($catalog, $data); |
|
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | $pos = 0; |
| 136 | 136 | $listItems = $catalog->getListItems(); |
| 137 | 137 | |
| 138 | - $this->assertEquals( 4, count( $listItems ) ); |
|
| 138 | + $this->assertEquals(4, count($listItems)); |
|
| 139 | 139 | |
| 140 | - foreach( $listItems as $listItem ) |
|
| 140 | + foreach ($listItems as $listItem) |
|
| 141 | 141 | { |
| 142 | - $this->assertEquals( $data[$pos], $listItem->getRefItem()->getUrl() ); |
|
| 142 | + $this->assertEquals($data[$pos], $listItem->getRefItem()->getUrl()); |
|
| 143 | 143 | $pos++; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -162,21 +162,21 @@ discard block |
||
| 162 | 162 | 1 => '', |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 165 | + $catalog = $this->create('job_csv_test'); |
|
| 166 | 166 | |
| 167 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 168 | - $object->process( $catalog, $data ); |
|
| 169 | - $object->process( $catalog, $dataUpdate ); |
|
| 167 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 168 | + $object->process($catalog, $data); |
|
| 169 | + $object->process($catalog, $dataUpdate); |
|
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | $listItems = $catalog->getListItems(); |
| 173 | - $listItem = reset( $listItems ); |
|
| 173 | + $listItem = reset($listItems); |
|
| 174 | 174 | |
| 175 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 176 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 175 | + $this->assertEquals(1, count($listItems)); |
|
| 176 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 177 | 177 | |
| 178 | - $this->assertEquals( 'path/to/new', $listItem->getRefItem()->getUrl() ); |
|
| 179 | - $this->assertEquals( null, $listItem->getRefItem()->getLanguageId() ); |
|
| 178 | + $this->assertEquals('path/to/new', $listItem->getRefItem()->getUrl()); |
|
| 179 | + $this->assertEquals(null, $listItem->getRefItem()->getLanguageId()); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -190,18 +190,18 @@ discard block |
||
| 190 | 190 | 0 => '/path/to/file', |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 193 | + $catalog = $this->create('job_csv_test'); |
|
| 194 | 194 | |
| 195 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 196 | - $object->process( $catalog, $data ); |
|
| 195 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 196 | + $object->process($catalog, $data); |
|
| 197 | 197 | |
| 198 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, [], $this->endpoint ); |
|
| 199 | - $object->process( $catalog, [] ); |
|
| 198 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, [], $this->endpoint); |
|
| 199 | + $object->process($catalog, []); |
|
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | $listItems = $catalog->getListItems(); |
| 203 | 203 | |
| 204 | - $this->assertEquals( 0, count( $listItems ) ); |
|
| 204 | + $this->assertEquals(0, count($listItems)); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
@@ -217,15 +217,15 @@ discard block |
||
| 217 | 217 | 1 => '', |
| 218 | 218 | ); |
| 219 | 219 | |
| 220 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 220 | + $catalog = $this->create('job_csv_test'); |
|
| 221 | 221 | |
| 222 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 223 | - $object->process( $catalog, $data ); |
|
| 222 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 223 | + $object->process($catalog, $data); |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | $listItems = $catalog->getListItems(); |
| 227 | 227 | |
| 228 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 228 | + $this->assertEquals(1, count($listItems)); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
@@ -245,34 +245,34 @@ discard block |
||
| 245 | 245 | 3 => 'default', |
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | - $this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/media/listtypes', array( 'default' ) ); |
|
| 248 | + $this->context->getConfig()->set('controller/common/catalog/import/csv/processor/media/listtypes', array('default')); |
|
| 249 | 249 | |
| 250 | - $catalog = $this->create( 'job_csv_test' ); |
|
| 250 | + $catalog = $this->create('job_csv_test'); |
|
| 251 | 251 | |
| 252 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 253 | - $object->process( $catalog, $data ); |
|
| 252 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 253 | + $object->process($catalog, $data); |
|
| 254 | 254 | |
| 255 | 255 | |
| 256 | 256 | $listItems = $catalog->getListItems(); |
| 257 | - $listItem = reset( $listItems ); |
|
| 257 | + $listItem = reset($listItems); |
|
| 258 | 258 | |
| 259 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 260 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 259 | + $this->assertEquals(1, count($listItems)); |
|
| 260 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 261 | 261 | |
| 262 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 263 | - $this->assertEquals( 'path/to/file2', $listItem->getRefItem()->getUrl() ); |
|
| 262 | + $this->assertEquals('default', $listItem->getType()); |
|
| 263 | + $this->assertEquals('path/to/file2', $listItem->getRefItem()->getUrl()); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @param string $code |
| 269 | 269 | */ |
| 270 | - protected function create( $code ) |
|
| 270 | + protected function create($code) |
|
| 271 | 271 | { |
| 272 | - $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context ); |
|
| 272 | + $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context); |
|
| 273 | 273 | |
| 274 | 274 | $item = $manager->createItem(); |
| 275 | - $item->setCode( $code ); |
|
| 275 | + $item->setCode($code); |
|
| 276 | 276 | |
| 277 | 277 | return $item; |
| 278 | 278 | } |
@@ -18,18 +18,18 @@ discard block |
||
| 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 = \TestHelperJobs::getContext(); |
| 24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 25 | 25 | |
| 26 | - $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos ); |
|
| 26 | + $this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 32 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 33 | 33 | \Aimeos\MShop\Factory::clear(); |
| 34 | 34 | |
| 35 | 35 | $this->object = null; |
@@ -38,40 +38,40 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function testGetName() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Product site map', $this->object->getName() ); |
|
| 41 | + $this->assertEquals('Product site map', $this->object->getName()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() |
| 46 | 46 | { |
| 47 | 47 | $text = 'Creates a product site map for search engines'; |
| 48 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 48 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testRun() |
| 53 | 53 | { |
| 54 | - $this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 ); |
|
| 54 | + $this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5); |
|
| 55 | 55 | |
| 56 | 56 | $this->object->run(); |
| 57 | 57 | |
| 58 | 58 | $ds = DIRECTORY_SEPARATOR; |
| 59 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
| 60 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
| 61 | - $this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
| 59 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
| 60 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
| 61 | + $this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
| 62 | 62 | |
| 63 | - $file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 ); |
|
| 64 | - $file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 ); |
|
| 65 | - $index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 ); |
|
| 63 | + $file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000); |
|
| 64 | + $file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000); |
|
| 65 | + $index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000); |
|
| 66 | 66 | |
| 67 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' ); |
|
| 68 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' ); |
|
| 69 | - unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' ); |
|
| 67 | + unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz'); |
|
| 68 | + unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz'); |
|
| 69 | + unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz'); |
|
| 70 | 70 | |
| 71 | - $this->assertContains( 'Cafe_Noire_Expresso', $file2 ); |
|
| 72 | - $this->assertContains( 'Unittest%3A_Bundle', $file2 ); |
|
| 71 | + $this->assertContains('Cafe_Noire_Expresso', $file2); |
|
| 72 | + $this->assertContains('Unittest%3A_Bundle', $file2); |
|
| 73 | 73 | |
| 74 | - $this->assertContains( 'aimeos-sitemap-1.xml.gz', $index ); |
|
| 75 | - $this->assertContains( 'aimeos-sitemap-2.xml.gz', $index ); |
|
| 74 | + $this->assertContains('aimeos-sitemap-1.xml.gz', $index); |
|
| 75 | + $this->assertContains('aimeos-sitemap-2.xml.gz', $index); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperCntl::getContext(); |
| 23 | - $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
| 23 | + $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 29 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 30 | 30 | \Aimeos\MShop\Factory::clear(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -49,26 +49,26 @@ discard block |
||
| 49 | 49 | 4 => '50', |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - $product = $this->create( 'job_csv_test' ); |
|
| 52 | + $product = $this->create('job_csv_test'); |
|
| 53 | 53 | |
| 54 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 55 | - $object->process( $product, $data ); |
|
| 54 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
| 55 | + $object->process($product, $data); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | $pos = 0; |
| 59 | 59 | $expected = array( |
| 60 | - array( 'package-weight', '3.00', 'de' ), |
|
| 61 | - array( 'package-width', '50', null ), |
|
| 60 | + array('package-weight', '3.00', 'de'), |
|
| 61 | + array('package-width', '50', null), |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | $items = $product->getPropertyItems(); |
| 65 | - $this->assertEquals( 2, count( $items ) ); |
|
| 65 | + $this->assertEquals(2, count($items)); |
|
| 66 | 66 | |
| 67 | - foreach( $items as $item ) |
|
| 67 | + foreach ($items as $item) |
|
| 68 | 68 | { |
| 69 | - $this->assertEquals( $expected[$pos][0], $item->getType() ); |
|
| 70 | - $this->assertEquals( $expected[$pos][1], $item->getValue() ); |
|
| 71 | - $this->assertEquals( $expected[$pos][2], $item->getLanguageId() ); |
|
| 69 | + $this->assertEquals($expected[$pos][0], $item->getType()); |
|
| 70 | + $this->assertEquals($expected[$pos][1], $item->getValue()); |
|
| 71 | + $this->assertEquals($expected[$pos][2], $item->getLanguageId()); |
|
| 72 | 72 | $pos++; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -91,21 +91,21 @@ discard block |
||
| 91 | 91 | 1 => '10', |
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | - $product = $this->create( 'job_csv_test' ); |
|
| 94 | + $product = $this->create('job_csv_test'); |
|
| 95 | 95 | |
| 96 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 97 | - $object->process( $product, $data ); |
|
| 98 | - $object->process( $product, $dataUpdate ); |
|
| 96 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
| 97 | + $object->process($product, $data); |
|
| 98 | + $object->process($product, $dataUpdate); |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | $items = $product->getPropertyItems(); |
| 102 | - $item = reset( $items ); |
|
| 102 | + $item = reset($items); |
|
| 103 | 103 | |
| 104 | - $this->assertEquals( 1, count( $items ) ); |
|
| 105 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item ); |
|
| 104 | + $this->assertEquals(1, count($items)); |
|
| 105 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item); |
|
| 106 | 106 | |
| 107 | - $this->assertEquals( 'package-height', $item->getType() ); |
|
| 108 | - $this->assertEquals( '10', $item->getValue() ); |
|
| 107 | + $this->assertEquals('package-height', $item->getType()); |
|
| 108 | + $this->assertEquals('10', $item->getValue()); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -121,18 +121,18 @@ discard block |
||
| 121 | 121 | 1 => '3.00', |
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | - $product = $this->create( 'job_csv_test' ); |
|
| 124 | + $product = $this->create('job_csv_test'); |
|
| 125 | 125 | |
| 126 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 127 | - $object->process( $product, $data ); |
|
| 126 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
| 127 | + $object->process($product, $data); |
|
| 128 | 128 | |
| 129 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, [], $this->endpoint ); |
|
| 130 | - $object->process( $product, [] ); |
|
| 129 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, [], $this->endpoint); |
|
| 130 | + $object->process($product, []); |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | $items = $product->getPropertyItems(); |
| 134 | 134 | |
| 135 | - $this->assertEquals( 0, count( $items ) ); |
|
| 135 | + $this->assertEquals(0, count($items)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -152,23 +152,23 @@ discard block |
||
| 152 | 152 | 3 => '3.00', |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | - $product = $this->create( 'job_csv_test' ); |
|
| 155 | + $product = $this->create('job_csv_test'); |
|
| 156 | 156 | |
| 157 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 158 | - $object->process( $product, $data ); |
|
| 157 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint); |
|
| 158 | + $object->process($product, $data); |
|
| 159 | 159 | |
| 160 | 160 | $items = $product->getPropertyItems(); |
| 161 | 161 | |
| 162 | - $this->assertEquals( 1, count( $items ) ); |
|
| 162 | + $this->assertEquals(1, count($items)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * @param string $code |
| 168 | 168 | */ |
| 169 | - protected function create( $code ) |
|
| 169 | + protected function create($code) |
|
| 170 | 170 | { |
| 171 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
| 172 | - return $manager->createItem()->setCode( $code ); |
|
| 171 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
| 172 | + return $manager->createItem()->setCode($code); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | \ No newline at end of file |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperCntl::getContext(); |
| 23 | - $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] ); |
|
| 23 | + $this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 29 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 30 | 30 | \Aimeos\MShop\Factory::clear(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -51,31 +51,31 @@ discard block |
||
| 51 | 51 | 5 => 1, |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $product = $this->create( 'job_csv_test' ); |
|
| 54 | + $product = $this->create('job_csv_test'); |
|
| 55 | 55 | |
| 56 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 57 | - $object->process( $product, $data ); |
|
| 56 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 57 | + $object->process($product, $data); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | $listItems = $product->getListItems(); |
| 61 | - $listItem = reset( $listItems ); |
|
| 61 | + $listItem = reset($listItems); |
|
| 62 | 62 | |
| 63 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 64 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 63 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 64 | + $this->assertEquals(1, count($listItems)); |
|
| 65 | 65 | |
| 66 | - $this->assertEquals( 1, $listItem->getStatus() ); |
|
| 67 | - $this->assertEquals( 0, $listItem->getPosition() ); |
|
| 68 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 66 | + $this->assertEquals(1, $listItem->getStatus()); |
|
| 67 | + $this->assertEquals(0, $listItem->getPosition()); |
|
| 68 | + $this->assertEquals('default', $listItem->getType()); |
|
| 69 | 69 | |
| 70 | 70 | $refItem = $listItem->getRefItem(); |
| 71 | 71 | |
| 72 | - $this->assertEquals( 1, $refItem->getStatus() ); |
|
| 73 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
| 74 | - $this->assertEquals( 'test image', $refItem->getLabel() ); |
|
| 75 | - $this->assertEquals( 'image/jpeg', $refItem->getMimetype() ); |
|
| 76 | - $this->assertEquals( 'path/to/preview', $refItem->getPreview() ); |
|
| 77 | - $this->assertEquals( 'path/to/file', $refItem->getUrl() ); |
|
| 78 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
| 72 | + $this->assertEquals(1, $refItem->getStatus()); |
|
| 73 | + $this->assertEquals('default', $refItem->getType()); |
|
| 74 | + $this->assertEquals('test image', $refItem->getLabel()); |
|
| 75 | + $this->assertEquals('image/jpeg', $refItem->getMimetype()); |
|
| 76 | + $this->assertEquals('path/to/preview', $refItem->getPreview()); |
|
| 77 | + $this->assertEquals('path/to/file', $refItem->getUrl()); |
|
| 78 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -89,21 +89,21 @@ discard block |
||
| 89 | 89 | 0 => "path/to/0\npath/to/1\npath/to/2\npath/to/3", |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - $product = $this->create( 'job_csv_test' ); |
|
| 92 | + $product = $this->create('job_csv_test'); |
|
| 93 | 93 | |
| 94 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 95 | - $object->process( $product, $data ); |
|
| 94 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 95 | + $object->process($product, $data); |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | $pos = 0; |
| 99 | 99 | $listItems = $product->getListItems(); |
| 100 | - $expected = array( 'path/to/0', 'path/to/1', 'path/to/2', 'path/to/3' ); |
|
| 100 | + $expected = array('path/to/0', 'path/to/1', 'path/to/2', 'path/to/3'); |
|
| 101 | 101 | |
| 102 | - $this->assertEquals( 4, count( $listItems ) ); |
|
| 102 | + $this->assertEquals(4, count($listItems)); |
|
| 103 | 103 | |
| 104 | - foreach( $listItems as $listItem ) |
|
| 104 | + foreach ($listItems as $listItem) |
|
| 105 | 105 | { |
| 106 | - $this->assertEquals( $expected[$pos], $listItem->getRefItem()->getUrl() ); |
|
| 106 | + $this->assertEquals($expected[$pos], $listItem->getRefItem()->getUrl()); |
|
| 107 | 107 | $pos++; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -125,20 +125,20 @@ discard block |
||
| 125 | 125 | 3 => 'path/to/3', |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | - $product = $this->create( 'job_csv_test' ); |
|
| 128 | + $product = $this->create('job_csv_test'); |
|
| 129 | 129 | |
| 130 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 131 | - $object->process( $product, $data ); |
|
| 130 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 131 | + $object->process($product, $data); |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | $pos = 0; |
| 135 | 135 | $listItems = $product->getListItems(); |
| 136 | 136 | |
| 137 | - $this->assertEquals( 4, count( $listItems ) ); |
|
| 137 | + $this->assertEquals(4, count($listItems)); |
|
| 138 | 138 | |
| 139 | - foreach( $listItems as $listItem ) |
|
| 139 | + foreach ($listItems as $listItem) |
|
| 140 | 140 | { |
| 141 | - $this->assertEquals( $data[$pos], $listItem->getRefItem()->getUrl() ); |
|
| 141 | + $this->assertEquals($data[$pos], $listItem->getRefItem()->getUrl()); |
|
| 142 | 142 | $pos++; |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | 1 => '', |
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | - $product = $this->create( 'job_csv_test' ); |
|
| 164 | + $product = $this->create('job_csv_test'); |
|
| 165 | 165 | |
| 166 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 167 | - $object->process( $product, $data ); |
|
| 168 | - $object->process( $product, $dataUpdate ); |
|
| 166 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 167 | + $object->process($product, $data); |
|
| 168 | + $object->process($product, $dataUpdate); |
|
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | $listItems = $product->getListItems(); |
| 172 | - $listItem = reset( $listItems ); |
|
| 172 | + $listItem = reset($listItems); |
|
| 173 | 173 | |
| 174 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 175 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 174 | + $this->assertEquals(1, count($listItems)); |
|
| 175 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 176 | 176 | |
| 177 | - $this->assertEquals( 'path/to/new', $listItem->getRefItem()->getUrl() ); |
|
| 178 | - $this->assertEquals( null, $listItem->getRefItem()->getLanguageId() ); |
|
| 177 | + $this->assertEquals('path/to/new', $listItem->getRefItem()->getUrl()); |
|
| 178 | + $this->assertEquals(null, $listItem->getRefItem()->getLanguageId()); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | 0 => '/path/to/file', |
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | - $product = $this->create( 'job_csv_test' ); |
|
| 192 | + $product = $this->create('job_csv_test'); |
|
| 193 | 193 | |
| 194 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 195 | - $object->process( $product, $data ); |
|
| 194 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 195 | + $object->process($product, $data); |
|
| 196 | 196 | |
| 197 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, [], $this->endpoint ); |
|
| 198 | - $object->process( $product, [] ); |
|
| 197 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, [], $this->endpoint); |
|
| 198 | + $object->process($product, []); |
|
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | $listItems = $product->getListItems(); |
| 202 | 202 | |
| 203 | - $this->assertEquals( 0, count( $listItems ) ); |
|
| 203 | + $this->assertEquals(0, count($listItems)); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | 1 => '', |
| 217 | 217 | ); |
| 218 | 218 | |
| 219 | - $product = $this->create( 'job_csv_test' ); |
|
| 219 | + $product = $this->create('job_csv_test'); |
|
| 220 | 220 | |
| 221 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 222 | - $object->process( $product, $data ); |
|
| 221 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 222 | + $object->process($product, $data); |
|
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | $listItems = $product->getListItems(); |
| 226 | 226 | |
| 227 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 227 | + $this->assertEquals(1, count($listItems)); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -244,31 +244,31 @@ discard block |
||
| 244 | 244 | 3 => 'default', |
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | - $this->context->getConfig()->set( 'controller/common/product/import/csv/processor/media/listtypes', array( 'default' ) ); |
|
| 247 | + $this->context->getConfig()->set('controller/common/product/import/csv/processor/media/listtypes', array('default')); |
|
| 248 | 248 | |
| 249 | - $product = $this->create( 'job_csv_test' ); |
|
| 249 | + $product = $this->create('job_csv_test'); |
|
| 250 | 250 | |
| 251 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint ); |
|
| 252 | - $object->process( $product, $data ); |
|
| 251 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint); |
|
| 252 | + $object->process($product, $data); |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | $listItems = $product->getListItems(); |
| 256 | - $listItem = reset( $listItems ); |
|
| 256 | + $listItem = reset($listItems); |
|
| 257 | 257 | |
| 258 | - $this->assertEquals( 1, count( $listItems ) ); |
|
| 259 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem ); |
|
| 258 | + $this->assertEquals(1, count($listItems)); |
|
| 259 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem); |
|
| 260 | 260 | |
| 261 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
| 262 | - $this->assertEquals( 'path/to/file2', $listItem->getRefItem()->getUrl() ); |
|
| 261 | + $this->assertEquals('default', $listItem->getType()); |
|
| 262 | + $this->assertEquals('path/to/file2', $listItem->getRefItem()->getUrl()); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
| 266 | 266 | /** |
| 267 | 267 | * @param string $code |
| 268 | 268 | */ |
| 269 | - protected function create( $code ) |
|
| 269 | + protected function create($code) |
|
| 270 | 270 | { |
| 271 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
| 272 | - return $manager->createItem()->setCode( $code ); |
|
| 271 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
| 272 | + return $manager->createItem()->setCode($code); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | \ No newline at end of file |