@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 33 | 33 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 34 | 34 | */ |
| 35 | - public function checkAttributes( $serviceId, array $attributes ) |
|
| 35 | + public function checkAttributes($serviceId, array $attributes) |
|
| 36 | 36 | { |
| 37 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 38 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
| 37 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 38 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
| 39 | 39 | |
| 40 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
| 40 | + return array_filter($provider->checkConfigFE($attributes)); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | * @param string[] $ref List of domain names whose items should be fetched too |
| 49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 50 | 50 | */ |
| 51 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
| 51 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
| 52 | 52 | { |
| 53 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 54 | - return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) ); |
|
| 53 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 54 | + return $manager->getProvider($manager->getItem($serviceId, $ref, true)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -62,22 +62,22 @@ discard block |
||
| 62 | 62 | * @param string[] $ref List of domain names whose items should be fetched too |
| 63 | 63 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 64 | 64 | */ |
| 65 | - public function getProviders( $type, $ref = ['media', 'price', 'text'] ) |
|
| 65 | + public function getProviders($type, $ref = ['media', 'price', 'text']) |
|
| 66 | 66 | { |
| 67 | 67 | $list = []; |
| 68 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 68 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 69 | 69 | |
| 70 | - $search = $manager->createSearch( true ); |
|
| 70 | + $search = $manager->createSearch(true); |
|
| 71 | 71 | $expr = array( |
| 72 | 72 | $search->getConditions(), |
| 73 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 74 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 73 | + $search->compare('==', 'service.type.code', $type), |
|
| 74 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 75 | 75 | ); |
| 76 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 77 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 76 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 77 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 78 | 78 | |
| 79 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
| 80 | - $list[$id] = $manager->getProvider( $item ); |
|
| 79 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
| 80 | + $list[$id] = $manager->getProvider($item); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | return $list; |
@@ -94,38 +94,38 @@ discard block |
||
| 94 | 94 | * @throws \Exception If an error occurs |
| 95 | 95 | * @deprecated Use getProviders() instead |
| 96 | 96 | */ |
| 97 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] ) |
|
| 97 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text']) |
|
| 98 | 98 | { |
| 99 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 99 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 100 | 100 | |
| 101 | - $search = $serviceManager->createSearch( true ); |
|
| 101 | + $search = $serviceManager->createSearch(true); |
|
| 102 | 102 | $expr = array( |
| 103 | 103 | $search->getConditions(), |
| 104 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 105 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 104 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 105 | + $search->compare('==', 'service.type.code', $type), |
|
| 106 | 106 | ); |
| 107 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 108 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 107 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 108 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 109 | 109 | |
| 110 | - $items = $serviceManager->searchItems( $search, $ref ); |
|
| 110 | + $items = $serviceManager->searchItems($search, $ref); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - foreach( $items as $id => $service ) |
|
| 113 | + foreach ($items as $id => $service) |
|
| 114 | 114 | { |
| 115 | 115 | try |
| 116 | 116 | { |
| 117 | - $provider = $serviceManager->getProvider( $service ); |
|
| 117 | + $provider = $serviceManager->getProvider($service); |
|
| 118 | 118 | |
| 119 | - if( $provider->isAvailable( $basket ) ) { |
|
| 119 | + if ($provider->isAvailable($basket)) { |
|
| 120 | 120 | $this->providers[$type][$id] = $provider; |
| 121 | 121 | } else { |
| 122 | - unset( $items[$id] ); |
|
| 122 | + unset($items[$id]); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 125 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
| 126 | 126 | { |
| 127 | - $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
|
| 128 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
|
| 127 | + $msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id); |
|
| 128 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
@@ -146,16 +146,16 @@ discard block |
||
| 146 | 146 | * @throws \Exception If an error occurs |
| 147 | 147 | * @deprecated Use getProvider() instead |
| 148 | 148 | */ |
| 149 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 149 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 150 | 150 | { |
| 151 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 152 | - return $this->providers[$type][$serviceId]->getConfigFE( $basket ); |
|
| 151 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 152 | + return $this->providers[$type][$serviceId]->getConfigFE($basket); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 156 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 155 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 156 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 157 | 157 | |
| 158 | - return $serviceManager->getProvider( $item )->getConfigFE( $basket ); |
|
| 158 | + return $serviceManager->getProvider($item)->getConfigFE($basket); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
@@ -171,16 +171,16 @@ discard block |
||
| 171 | 171 | * @throws \Exception If an error occurs |
| 172 | 172 | * @deprecated Use getProvider() instead |
| 173 | 173 | */ |
| 174 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 174 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 175 | 175 | { |
| 176 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 177 | - return $this->providers[$type][$serviceId]->calcPrice( $basket ); |
|
| 176 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 177 | + return $this->providers[$type][$serviceId]->calcPrice($basket); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 181 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 180 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 181 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 182 | 182 | |
| 183 | - return $serviceManager->getProvider( $item )->calcPrice( $basket ); |
|
| 183 | + return $serviceManager->getProvider($item)->calcPrice($basket); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -196,22 +196,22 @@ discard block |
||
| 196 | 196 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
| 197 | 197 | * @deprecated Use checkAttributes() instead |
| 198 | 198 | */ |
| 199 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 199 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 200 | 200 | { |
| 201 | - if( !isset( $this->providers[$type][$serviceId] ) ) |
|
| 201 | + if (!isset($this->providers[$type][$serviceId])) |
|
| 202 | 202 | { |
| 203 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 204 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 203 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 204 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 205 | 205 | |
| 206 | - $this->providers[$type][$serviceId] = $serviceManager->getProvider( $item ); |
|
| 206 | + $this->providers[$type][$serviceId] = $serviceManager->getProvider($item); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes ); |
|
| 209 | + $errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes); |
|
| 210 | 210 | |
| 211 | - foreach( $errors as $key => $msg ) |
|
| 211 | + foreach ($errors as $key => $msg) |
|
| 212 | 212 | { |
| 213 | - if( $msg === null ) { |
|
| 214 | - unset( $errors[$key] ); |
|
| 213 | + if ($msg === null) { |
|
| 214 | + unset($errors[$key]); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -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 ); |
@@ -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,137 +20,137 @@ |
||
| 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 testGetProvider() |
| 69 | 69 | { |
| 70 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
| 71 | - $provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) ); |
|
| 70 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
| 71 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery')); |
|
| 72 | 72 | |
| 73 | - $this->stub->expects( $this->once() )->method( 'getProvider' ) |
|
| 74 | - ->will( $this->returnValue( $provider ) ); |
|
| 73 | + $this->stub->expects($this->once())->method('getProvider') |
|
| 74 | + ->will($this->returnValue($provider)); |
|
| 75 | 75 | |
| 76 | - $this->assertSame( $provider, $this->object->getProvider( -1 ) ); |
|
| 76 | + $this->assertSame($provider, $this->object->getProvider( -1 )); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | public function testGetProvideres() |
| 81 | 81 | { |
| 82 | - $this->stub->expects( $this->once() )->method( 'getProviders' ) |
|
| 83 | - ->will( $this->returnValue( [] ) ); |
|
| 82 | + $this->stub->expects($this->once())->method('getProviders') |
|
| 83 | + ->will($this->returnValue([])); |
|
| 84 | 84 | |
| 85 | - $this->assertEquals( [], $this->object->getProviders( 'payment' ) ); |
|
| 85 | + $this->assertEquals([], $this->object->getProviders('payment')); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testCheckAttributes() |
| 90 | 90 | { |
| 91 | - $this->stub->expects( $this->once() )->method( 'checkAttributes' ) |
|
| 92 | - ->will( $this->returnValue( [] ) ); |
|
| 91 | + $this->stub->expects($this->once())->method('checkAttributes') |
|
| 92 | + ->will($this->returnValue([])); |
|
| 93 | 93 | |
| 94 | - $this->assertEquals( [], $this->object->checkAttributes( -1, [] ) ); |
|
| 94 | + $this->assertEquals([], $this->object->checkAttributes( -1, [] )); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | public function testGetServices() |
| 99 | 99 | { |
| 100 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 100 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 101 | 101 | |
| 102 | - $this->stub->expects( $this->once() )->method( 'getServices' ) |
|
| 103 | - ->will( $this->returnValue( [] ) ); |
|
| 102 | + $this->stub->expects($this->once())->method('getServices') |
|
| 103 | + ->will($this->returnValue([])); |
|
| 104 | 104 | |
| 105 | - $this->assertEquals( [], $this->object->getServices( 'payment', $basket ) ); |
|
| 105 | + $this->assertEquals([], $this->object->getServices('payment', $basket)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGetServiceAttributes() |
| 110 | 110 | { |
| 111 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 111 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 112 | 112 | |
| 113 | - $this->stub->expects( $this->once() )->method( 'getServiceAttributes' ) |
|
| 114 | - ->will( $this->returnValue( [] ) ); |
|
| 113 | + $this->stub->expects($this->once())->method('getServiceAttributes') |
|
| 114 | + ->will($this->returnValue([])); |
|
| 115 | 115 | |
| 116 | - $this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) ); |
|
| 116 | + $this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | public function testGetServicePrice() |
| 121 | 121 | { |
| 122 | - $priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem(); |
|
| 123 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 122 | + $priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem(); |
|
| 123 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 124 | 124 | |
| 125 | - $this->stub->expects( $this->once() )->method( 'getServicePrice' ) |
|
| 126 | - ->will( $this->returnValue( $priceItem ) ); |
|
| 125 | + $this->stub->expects($this->once())->method('getServicePrice') |
|
| 126 | + ->will($this->returnValue($priceItem)); |
|
| 127 | 127 | |
| 128 | - $this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) ); |
|
| 128 | + $this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket)); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | public function testCheckServiceAttributes() |
| 133 | 133 | { |
| 134 | - $this->stub->expects( $this->once() )->method( 'checkServiceAttributes' ) |
|
| 135 | - ->will( $this->returnValue( [] ) ); |
|
| 134 | + $this->stub->expects($this->once())->method('checkServiceAttributes') |
|
| 135 | + ->will($this->returnValue([])); |
|
| 136 | 136 | |
| 137 | - $this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) ); |
|
| 137 | + $this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, [])); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | public function testGetController() |
| 142 | 142 | { |
| 143 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 143 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 144 | 144 | |
| 145 | - $this->assertSame( $this->stub, $result ); |
|
| 145 | + $this->assertSame($this->stub, $result); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - protected function access( $name ) |
|
| 149 | + protected function access($name) |
|
| 150 | 150 | { |
| 151 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
| 152 | - $method = $class->getMethod( $name ); |
|
| 153 | - $method->setAccessible( true ); |
|
| 151 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
| 152 | + $method = $class->getMethod($name); |
|
| 153 | + $method->setAccessible(true); |
|
| 154 | 154 | |
| 155 | 155 | return $method; |
| 156 | 156 | } |
@@ -16,59 +16,59 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( \TestHelperFrontend::getContext() ); |
|
| 19 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard(\TestHelperFrontend::getContext()); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | public static function setUpBeforeClass() |
| 24 | 24 | { |
| 25 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 26 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
| 25 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 26 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
| 27 | 27 | self::$basket = $orderBaseMgr->createItem(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | protected function tearDown() |
| 32 | 32 | { |
| 33 | - unset( $this->object ); |
|
| 33 | + unset($this->object); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | public function testCheckAttributes() |
| 38 | 38 | { |
| 39 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
| 40 | - $this->assertEquals( [], $attributes ); |
|
| 39 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
| 40 | + $this->assertEquals([], $attributes); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetProviders() |
| 45 | 45 | { |
| 46 | - $providers = $this->object->getProviders( 'delivery' ); |
|
| 47 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
| 46 | + $providers = $this->object->getProviders('delivery'); |
|
| 47 | + $this->assertGreaterThan(0, count($providers)); |
|
| 48 | 48 | |
| 49 | - foreach( $providers as $provider ) { |
|
| 50 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 49 | + foreach ($providers as $provider) { |
|
| 50 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testGetProvider() |
| 56 | 56 | { |
| 57 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
| 58 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 57 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
| 58 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testGetServices() |
| 63 | 63 | { |
| 64 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 65 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 64 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 65 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 66 | 66 | |
| 67 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 68 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
| 67 | + $services = $this->object->getServices('delivery', $basket); |
|
| 68 | + $this->assertGreaterThan(0, count($services)); |
|
| 69 | 69 | |
| 70 | - foreach( $services as $service ) { |
|
| 71 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
| 70 | + foreach ($services as $service) { |
|
| 71 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,83 +76,83 @@ discard block |
||
| 76 | 76 | public function testGetServiceAttributes() |
| 77 | 77 | { |
| 78 | 78 | $service = $this->getServiceItem(); |
| 79 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
| 79 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
| 80 | 80 | |
| 81 | - $this->assertEquals( 0, count( $attributes ) ); |
|
| 81 | + $this->assertEquals(0, count($attributes)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | public function testGetServiceAttributesCache() |
| 86 | 86 | { |
| 87 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 88 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 87 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 88 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 89 | 89 | |
| 90 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 90 | + $services = $this->object->getServices('delivery', $basket); |
|
| 91 | 91 | |
| 92 | - if( ( $service = reset( $services ) ) === false ) { |
|
| 93 | - throw new \RuntimeException( 'No service item found' ); |
|
| 92 | + if (($service = reset($services)) === false) { |
|
| 93 | + throw new \RuntimeException('No service item found'); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
| 96 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
| 97 | 97 | |
| 98 | - $this->assertEquals( 0, count( $attributes ) ); |
|
| 98 | + $this->assertEquals(0, count($attributes)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | public function testGetServiceAttributesNoItems() |
| 103 | 103 | { |
| 104 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 105 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
| 104 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 105 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGetServicePrice() |
| 110 | 110 | { |
| 111 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 112 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 111 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 112 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 113 | 113 | |
| 114 | 114 | $service = $this->getServiceItem(); |
| 115 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
| 115 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
| 116 | 116 | |
| 117 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
| 118 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
| 117 | + $this->assertEquals('12.95', $price->getValue()); |
|
| 118 | + $this->assertEquals('1.99', $price->getCosts()); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testGetServicePriceCache() |
| 123 | 123 | { |
| 124 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 125 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 124 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 125 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 126 | 126 | |
| 127 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 127 | + $services = $this->object->getServices('delivery', $basket); |
|
| 128 | 128 | |
| 129 | - if( ( $service = reset( $services ) ) === false ) { |
|
| 130 | - throw new \RuntimeException( 'No service item found' ); |
|
| 129 | + if (($service = reset($services)) === false) { |
|
| 130 | + throw new \RuntimeException('No service item found'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
| 133 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
| 134 | 134 | |
| 135 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
| 136 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
| 135 | + $this->assertEquals('12.95', $price->getValue()); |
|
| 136 | + $this->assertEquals('1.99', $price->getCosts()); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | public function testGetServicePriceNoItems() |
| 141 | 141 | { |
| 142 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 143 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 142 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 143 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 144 | 144 | |
| 145 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 146 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
| 145 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 146 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | public function testCheckServiceAttributes() |
| 151 | 151 | { |
| 152 | 152 | $service = $this->getServiceItem(); |
| 153 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), array() ); |
|
| 153 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), array()); |
|
| 154 | 154 | |
| 155 | - $this->assertEquals( array(), $attributes ); |
|
| 155 | + $this->assertEquals(array(), $attributes); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function getServiceItem() |
| 163 | 163 | { |
| 164 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 165 | - return $manager->findItem( 'unitcode', [], 'service', 'delivery' ); |
|
| 164 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 165 | + return $manager->findItem('unitcode', [], 'service', 'delivery'); |
|
| 166 | 166 | } |
| 167 | 167 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 28 | 28 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 29 | 29 | */ |
| 30 | - public function checkAttributes( $serviceId, array $attributes ); |
|
| 30 | + public function checkAttributes($serviceId, array $attributes); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Returns the service item for the given ID |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 37 | 37 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 38 | 38 | */ |
| 39 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
| 39 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Returns the service providers for the given type |
@@ -45,5 +45,5 @@ discard block |
||
| 45 | 45 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 46 | 46 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 47 | 47 | */ |
| 48 | - public function getProviders( $type, $ref = ['media', 'price', 'text'] ); |
|
| 48 | + public function getProviders($type, $ref = ['media', 'price', 'text']); |
|
| 49 | 49 | } |