@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 36 | 36 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 37 | 37 | */ |
| 38 | - public function checkAttributes( $serviceId, array $attributes ) |
|
| 38 | + public function checkAttributes($serviceId, array $attributes) |
|
| 39 | 39 | { |
| 40 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'service' ); |
|
| 40 | + $manager = \Aimeos\MShop::create($this->getContext(), 'service'); |
|
| 41 | 41 | |
| 42 | - $item = $manager->getItem( $serviceId, [], true ); |
|
| 43 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 42 | + $item = $manager->getItem($serviceId, [], true); |
|
| 43 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 44 | 44 | |
| 45 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
| 45 | + return array_filter($provider->checkConfigFE($attributes)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @param string[] $ref List of domain names whose items should be fetched too |
| 54 | 54 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 55 | 55 | */ |
| 56 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
| 56 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
| 57 | 57 | { |
| 58 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'service' ); |
|
| 59 | - $item = $manager->getItem( $serviceId, $ref, true ); |
|
| 58 | + $manager = \Aimeos\MShop::create($this->getContext(), 'service'); |
|
| 59 | + $item = $manager->getItem($serviceId, $ref, true); |
|
| 60 | 60 | |
| 61 | - return $manager->getProvider( $item, $item->getType() ); |
|
| 61 | + return $manager->getProvider($item, $item->getType()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -69,25 +69,25 @@ discard block |
||
| 69 | 69 | * @param string[] $ref List of domain names whose items should be fetched too |
| 70 | 70 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 71 | 71 | */ |
| 72 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
| 72 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
| 73 | 73 | { |
| 74 | 74 | $list = []; |
| 75 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'service' ); |
|
| 75 | + $manager = \Aimeos\MShop::create($this->getContext(), 'service'); |
|
| 76 | 76 | |
| 77 | - $search = $manager->createSearch( true ); |
|
| 78 | - $search->setSortations( [$search->sort( '+', 'service.position' )] ); |
|
| 77 | + $search = $manager->createSearch(true); |
|
| 78 | + $search->setSortations([$search->sort('+', 'service.position')]); |
|
| 79 | 79 | |
| 80 | - if( $type != null ) |
|
| 80 | + if ($type != null) |
|
| 81 | 81 | { |
| 82 | 82 | $expr = array( |
| 83 | 83 | $search->getConditions(), |
| 84 | - $search->compare( '==', 'service.type', $type ), |
|
| 84 | + $search->compare('==', 'service.type', $type), |
|
| 85 | 85 | ); |
| 86 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 86 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
| 90 | - $list[$id] = $manager->getProvider( $item, $item->getType() ); |
|
| 89 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
| 90 | + $list[$id] = $manager->getProvider($item, $item->getType()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $list; |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | * @return \Aimeos\MShop\Common\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 106 | 106 | * or null if no form data is required |
| 107 | 107 | */ |
| 108 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
| 108 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
| 109 | 109 | { |
| 110 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'service' ); |
|
| 111 | - $item = $manager->getItem( $serviceId, [], true ); |
|
| 110 | + $manager = \Aimeos\MShop::create($this->getContext(), 'service'); |
|
| 111 | + $item = $manager->getItem($serviceId, [], true); |
|
| 112 | 112 | |
| 113 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 114 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 113 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 114 | + $provider->injectGlobalConfigBE($urls); |
|
| 115 | 115 | |
| 116 | - return $provider->process( $orderItem, $params ); |
|
| 116 | + return $provider->process($orderItem, $params); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | * @param string $code Unique code of the service used for the current order |
| 126 | 126 | * @return \Psr\Http\Message\ResponseInterface Response object |
| 127 | 127 | */ |
| 128 | - public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code ) |
|
| 128 | + public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code) |
|
| 129 | 129 | { |
| 130 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'service' ); |
|
| 131 | - $item = $manager->findItem( $code ); |
|
| 130 | + $manager = \Aimeos\MShop::create($this->getContext(), 'service'); |
|
| 131 | + $item = $manager->findItem($code); |
|
| 132 | 132 | |
| 133 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 133 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 134 | 134 | |
| 135 | - return $provider->updatePush( $request, $response ); |
|
| 135 | + return $provider->updatePush($request, $response); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -144,24 +144,24 @@ discard block |
||
| 144 | 144 | * @param string $orderid ID of the order whose payment status should be updated |
| 145 | 145 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 146 | 146 | */ |
| 147 | - public function updateSync( ServerRequestInterface $request, $code, $orderid ) |
|
| 147 | + public function updateSync(ServerRequestInterface $request, $code, $orderid) |
|
| 148 | 148 | { |
| 149 | 149 | $context = $this->getContext(); |
| 150 | - $orderManager = \Aimeos\MShop::create( $context, 'order' ); |
|
| 151 | - $serviceManager = \Aimeos\MShop::create( $context, 'service' ); |
|
| 150 | + $orderManager = \Aimeos\MShop::create($context, 'order'); |
|
| 151 | + $serviceManager = \Aimeos\MShop::create($context, 'service'); |
|
| 152 | 152 | |
| 153 | - $orderItem = $orderManager->getItem( $orderid ); |
|
| 154 | - $serviceItem = $serviceManager->findItem( $code ); |
|
| 153 | + $orderItem = $orderManager->getItem($orderid); |
|
| 154 | + $serviceItem = $serviceManager->findItem($code); |
|
| 155 | 155 | |
| 156 | - $provider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() ); |
|
| 156 | + $provider = $serviceManager->getProvider($serviceItem, $serviceItem->getType()); |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | - if( ( $orderItem = $provider->updateSync( $request, $orderItem ) ) !== null ) |
|
| 159 | + if (($orderItem = $provider->updateSync($request, $orderItem)) !== null) |
|
| 160 | 160 | { |
| 161 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 162 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 161 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 162 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
| 163 | 163 | ) { |
| 164 | - $provider->query( $orderItem ); |
|
| 164 | + $provider->query($orderItem); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 31 | 31 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 32 | 32 | */ |
| 33 | - public function checkAttributes( $serviceId, array $attributes ); |
|
| 33 | + public function checkAttributes($serviceId, array $attributes); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Returns the service item for the given ID |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 40 | 40 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 41 | 41 | */ |
| 42 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
| 42 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Returns the service providers for the given type |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 50 | 50 | */ |
| 51 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ); |
|
| 51 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Processes the service for the given order, e.g. payment and delivery services |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return \Aimeos\MShop\Common\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 62 | 62 | * or null if no form data is required |
| 63 | 63 | */ |
| 64 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ); |
|
| 64 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param string $code Unique code of the service used for the current order |
| 73 | 73 | * @return \Psr\Http\Message\ResponseInterface Response object |
| 74 | 74 | */ |
| 75 | - public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code ); |
|
| 75 | + public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -83,5 +83,5 @@ discard block |
||
| 83 | 83 | * @param string $orderid ID of the order whose payment status should be updated |
| 84 | 84 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 85 | 85 | */ |
| 86 | - public function updateSync( ServerRequestInterface $request, $code, $orderid ); |
|
| 86 | + public function updateSync(ServerRequestInterface $request, $code, $orderid); |
|
| 87 | 87 | } |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 34 | 34 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 35 | 35 | */ |
| 36 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 36 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 37 | 37 | { |
| 38 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Frontend\\Service\\Iface', $controller ); |
|
| 38 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Frontend\\Service\\Iface', $controller); |
|
| 39 | 39 | |
| 40 | 40 | $this->controller = $controller; |
| 41 | 41 | |
| 42 | - parent::__construct( $context ); |
|
| 42 | + parent::__construct($context); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | * @return mixed Returns the value of the called method |
| 52 | 52 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 53 | 53 | */ |
| 54 | - public function __call( $name, array $param ) |
|
| 54 | + public function __call($name, array $param) |
|
| 55 | 55 | { |
| 56 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 56 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 65 | 65 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 66 | 66 | */ |
| 67 | - public function checkAttributes( $serviceId, array $attributes ) |
|
| 67 | + public function checkAttributes($serviceId, array $attributes) |
|
| 68 | 68 | { |
| 69 | - return $this->controller->checkAttributes( $serviceId, $attributes ); |
|
| 69 | + return $this->controller->checkAttributes($serviceId, $attributes); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 78 | 78 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 79 | 79 | */ |
| 80 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
| 80 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
| 81 | 81 | { |
| 82 | - return $this->controller->getProvider( $serviceId, $ref ); |
|
| 82 | + return $this->controller->getProvider($serviceId, $ref); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 91 | 91 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 92 | 92 | */ |
| 93 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
| 93 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
| 94 | 94 | { |
| 95 | - return $this->controller->getProviders( $type, $ref ); |
|
| 95 | + return $this->controller->getProviders($type, $ref); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * @return \Aimeos\MShop\Common\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 108 | 108 | * or null if no form data is required |
| 109 | 109 | */ |
| 110 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
| 110 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
| 111 | 111 | { |
| 112 | - return $this->controller->process( $orderItem, $serviceId, $urls, $params ); |
|
| 112 | + return $this->controller->process($orderItem, $serviceId, $urls, $params); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * @param string $code Unique code of the service used for the current order |
| 122 | 122 | * @return \Psr\Http\Message\ResponseInterface Response object |
| 123 | 123 | */ |
| 124 | - public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code ) |
|
| 124 | + public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code) |
|
| 125 | 125 | { |
| 126 | - return $this->controller->updatePush( $request, $response, $code ); |
|
| 126 | + return $this->controller->updatePush($request, $response, $code); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | * @param string $orderid ID of the order whose payment status should be updated |
| 136 | 136 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 137 | 137 | */ |
| 138 | - public function updateSync( ServerRequestInterface $request, $code, $orderid ) |
|
| 138 | + public function updateSync(ServerRequestInterface $request, $code, $orderid) |
|
| 139 | 139 | { |
| 140 | - return $this->controller->updateSync( $request, $code, $orderid ); |
|
| 140 | + return $this->controller->updateSync($request, $code, $orderid); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -19,122 +19,122 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function setUp() |
| 21 | 21 | { |
| 22 | - \Aimeos\MShop::cache( true ); |
|
| 22 | + \Aimeos\MShop::cache(true); |
|
| 23 | 23 | |
| 24 | 24 | $this->context = \TestHelperFrontend::getContext(); |
| 25 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context ); |
|
| 25 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | public static function setUpBeforeClass() |
| 30 | 30 | { |
| 31 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::create( \TestHelperFrontend::getContext() ); |
|
| 32 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
| 31 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::create(\TestHelperFrontend::getContext()); |
|
| 32 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
| 33 | 33 | self::$basket = $orderBaseMgr->createItem(); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | protected function tearDown() |
| 38 | 38 | { |
| 39 | - \Aimeos\MShop::cache( false ); |
|
| 40 | - unset( $this->object, $this->context ); |
|
| 39 | + \Aimeos\MShop::cache(false); |
|
| 40 | + unset($this->object, $this->context); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testCheckAttributes() |
| 45 | 45 | { |
| 46 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
| 47 | - $this->assertEquals( [], $attributes ); |
|
| 46 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
| 47 | + $this->assertEquals([], $attributes); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testGetProviders() |
| 52 | 52 | { |
| 53 | - $providers = $this->object->getProviders( 'delivery' ); |
|
| 54 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
| 53 | + $providers = $this->object->getProviders('delivery'); |
|
| 54 | + $this->assertGreaterThan(0, count($providers)); |
|
| 55 | 55 | |
| 56 | - foreach( $providers as $provider ) { |
|
| 57 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 56 | + foreach ($providers as $provider) { |
|
| 57 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testGetProvider() |
| 63 | 63 | { |
| 64 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
| 65 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 64 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
| 65 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testProcess() |
| 70 | 70 | { |
| 71 | 71 | $form = new \Aimeos\MShop\Common\Helper\Form\Standard(); |
| 72 | - $item = \Aimeos\MShop::create( $this->context, 'order' )->createItem(); |
|
| 73 | - $serviceId = \Aimeos\MShop::create( $this->context, 'service' )->findItem( 'unitcode' )->getId(); |
|
| 72 | + $item = \Aimeos\MShop::create($this->context, 'order')->createItem(); |
|
| 73 | + $serviceId = \Aimeos\MShop::create($this->context, 'service')->findItem('unitcode')->getId(); |
|
| 74 | 74 | |
| 75 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
| 75 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
| 76 | 76 | ->disableOriginalConstructor() |
| 77 | - ->setMethods( ['process'] ) |
|
| 77 | + ->setMethods(['process']) |
|
| 78 | 78 | ->getMock(); |
| 79 | 79 | |
| 80 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
| 81 | - ->setConstructorArgs( [$this->context] ) |
|
| 82 | - ->setMethods( ['getProvider'] ) |
|
| 80 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
| 81 | + ->setConstructorArgs([$this->context]) |
|
| 82 | + ->setMethods(['getProvider']) |
|
| 83 | 83 | ->getMock(); |
| 84 | 84 | |
| 85 | - \Aimeos\MShop::inject( 'service', $manager ); |
|
| 85 | + \Aimeos\MShop::inject('service', $manager); |
|
| 86 | 86 | |
| 87 | - $provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) ); |
|
| 88 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
| 87 | + $provider->expects($this->once())->method('process')->will($this->returnValue($form)); |
|
| 88 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | - $result = $this->object->process( $item, $serviceId, [], [] ); |
|
| 92 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Helper\Form\Iface::class, $result ); |
|
| 91 | + $result = $this->object->process($item, $serviceId, [], []); |
|
| 92 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Helper\Form\Iface::class, $result); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | public function testUpdatePush() |
| 97 | 97 | { |
| 98 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
| 99 | - $response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock(); |
|
| 98 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
| 99 | + $response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock(); |
|
| 100 | 100 | |
| 101 | - $response->expects( $this->once() )->method( 'withStatus' )->will( $this->returnValue( $response ) ); |
|
| 101 | + $response->expects($this->once())->method('withStatus')->will($this->returnValue($response)); |
|
| 102 | 102 | |
| 103 | - $this->assertInstanceOf( \Psr\Http\Message\ResponseInterface::class, $this->object->updatePush( $request, $response, 'unitcode' ) ); |
|
| 103 | + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $this->object->updatePush($request, $response, 'unitcode')); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | public function testUpdateSync() |
| 108 | 108 | { |
| 109 | - $item = \Aimeos\MShop::create( $this->context, 'order' )->createItem(); |
|
| 110 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
| 109 | + $item = \Aimeos\MShop::create($this->context, 'order')->createItem(); |
|
| 110 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
| 111 | 111 | |
| 112 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
| 113 | - ->setMethods( ['updateSync', 'query', 'isImplemented'] ) |
|
| 112 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
| 113 | + ->setMethods(['updateSync', 'query', 'isImplemented']) |
|
| 114 | 114 | ->disableOriginalConstructor() |
| 115 | 115 | ->getMock(); |
| 116 | 116 | |
| 117 | - $orderManager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 118 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 119 | - ->setMethods( ['getItem'] ) |
|
| 117 | + $orderManager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 118 | + ->setConstructorArgs(array($this->context)) |
|
| 119 | + ->setMethods(['getItem']) |
|
| 120 | 120 | ->getMock(); |
| 121 | 121 | |
| 122 | - $serviceManager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
| 123 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 124 | - ->setMethods( ['getProvider'] ) |
|
| 122 | + $serviceManager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
| 123 | + ->setConstructorArgs(array($this->context)) |
|
| 124 | + ->setMethods(['getProvider']) |
|
| 125 | 125 | ->getMock(); |
| 126 | 126 | |
| 127 | - \Aimeos\MShop::inject( 'order', $orderManager ); |
|
| 128 | - \Aimeos\MShop::inject( 'service', $serviceManager ); |
|
| 127 | + \Aimeos\MShop::inject('order', $orderManager); |
|
| 128 | + \Aimeos\MShop::inject('service', $serviceManager); |
|
| 129 | 129 | |
| 130 | 130 | |
| 131 | - $orderManager->expects( $this->once() )->method( 'getItem' )->will( $this->returnValue( $item ) ); |
|
| 132 | - $serviceManager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
| 133 | - $provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) ); |
|
| 134 | - $provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) ); |
|
| 135 | - $provider->expects( $this->once() )->method( 'query' ); |
|
| 131 | + $orderManager->expects($this->once())->method('getItem')->will($this->returnValue($item)); |
|
| 132 | + $serviceManager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
| 133 | + $provider->expects($this->once())->method('updateSync')->will($this->returnValue($item)); |
|
| 134 | + $provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true)); |
|
| 135 | + $provider->expects($this->once())->method('query'); |
|
| 136 | 136 | |
| 137 | - $this->object->updateSync( $request, 'unitcode', -1 ); |
|
| 137 | + $this->object->updateSync($request, 'unitcode', -1); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function getServiceItem() |
| 145 | 145 | { |
| 146 | - $manager = \Aimeos\MShop\Service\Manager\Factory::create( \TestHelperFrontend::getContext() ); |
|
| 147 | - return $manager->findItem( 'unitcode' ); |
|
| 146 | + $manager = \Aimeos\MShop\Service\Manager\Factory::create(\TestHelperFrontend::getContext()); |
|
| 147 | + return $manager->findItem('unitcode'); |
|
| 148 | 148 | } |
| 149 | 149 | } |
@@ -20,130 +20,130 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Standard::class ) |
|
| 23 | + $this->stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Standard::class) |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class ) |
|
| 28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
| 27 | + $this->object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class) |
|
| 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::class )->getMock(); |
|
| 41 | + $stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Iface::class)->getMock(); |
|
| 42 | 42 | |
| 43 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
| 43 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
| 44 | 44 | |
| 45 | - $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class ) |
|
| 46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 45 | + $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class) |
|
| 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::class ) |
|
| 53 | + $stub = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Standard::class) |
|
| 54 | 54 | ->disableOriginalConstructor() |
| 55 | - ->setMethods( ['invalid'] ) |
|
| 55 | + ->setMethods(['invalid']) |
|
| 56 | 56 | ->getMock(); |
| 57 | 57 | |
| 58 | - $object = $this->getMockBuilder( \Aimeos\Controller\Frontend\Service\Decorator\Base::class ) |
|
| 59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
| 58 | + $object = $this->getMockBuilder(\Aimeos\Controller\Frontend\Service\Decorator\Base::class) |
|
| 59 | + ->setConstructorArgs([$stub, $this->context]) |
|
| 60 | 60 | ->getMockForAbstractClass(); |
| 61 | 61 | |
| 62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
| 62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
| 63 | 63 | |
| 64 | - $this->assertTrue( $object->invalid() ); |
|
| 64 | + $this->assertTrue($object->invalid()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testCheckAttributes() |
| 69 | 69 | { |
| 70 | - $this->stub->expects( $this->once() )->method( 'checkAttributes' ) |
|
| 71 | - ->will( $this->returnValue( [] ) ); |
|
| 70 | + $this->stub->expects($this->once())->method('checkAttributes') |
|
| 71 | + ->will($this->returnValue([])); |
|
| 72 | 72 | |
| 73 | - $this->assertEquals( [], $this->object->checkAttributes( -1, [] ) ); |
|
| 73 | + $this->assertEquals([], $this->object->checkAttributes( -1, [] )); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testGetProvider() |
| 78 | 78 | { |
| 79 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
| 80 | - $provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ), 'delivery' ); |
|
| 79 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
| 80 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery'), 'delivery'); |
|
| 81 | 81 | |
| 82 | - $this->stub->expects( $this->once() )->method( 'getProvider' ) |
|
| 83 | - ->will( $this->returnValue( $provider ) ); |
|
| 82 | + $this->stub->expects($this->once())->method('getProvider') |
|
| 83 | + ->will($this->returnValue($provider)); |
|
| 84 | 84 | |
| 85 | - $this->assertSame( $provider, $this->object->getProvider( -1 ) ); |
|
| 85 | + $this->assertSame($provider, $this->object->getProvider( -1 )); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testGetProviders() |
| 90 | 90 | { |
| 91 | - $this->stub->expects( $this->once() )->method( 'getProviders' ) |
|
| 92 | - ->will( $this->returnValue( [] ) ); |
|
| 91 | + $this->stub->expects($this->once())->method('getProviders') |
|
| 92 | + ->will($this->returnValue([])); |
|
| 93 | 93 | |
| 94 | - $this->assertEquals( [], $this->object->getProviders( 'payment' ) ); |
|
| 94 | + $this->assertEquals([], $this->object->getProviders('payment')); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | public function testProcess() |
| 99 | 99 | { |
| 100 | - $item = \Aimeos\MShop::create( $this->context, 'order' )->createItem(); |
|
| 100 | + $item = \Aimeos\MShop::create($this->context, 'order')->createItem(); |
|
| 101 | 101 | |
| 102 | - $this->stub->expects( $this->once() )->method( 'process' ) |
|
| 103 | - ->will( $this->returnValue( new \Aimeos\MShop\Common\Helper\Form\Standard() ) ); |
|
| 102 | + $this->stub->expects($this->once())->method('process') |
|
| 103 | + ->will($this->returnValue(new \Aimeos\MShop\Common\Helper\Form\Standard())); |
|
| 104 | 104 | |
| 105 | - $this->assertInstanceOf( 'Aimeos\MShop\Common\Helper\Form\Iface', $this->object->process( $item, -1, [], [] ) ); |
|
| 105 | + $this->assertInstanceOf('Aimeos\MShop\Common\Helper\Form\Iface', $this->object->process($item, -1, [], [])); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testUpdatePush() |
| 110 | 110 | { |
| 111 | - $response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock(); |
|
| 112 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
| 111 | + $response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock(); |
|
| 112 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
| 113 | 113 | |
| 114 | - $this->stub->expects( $this->once() )->method( 'updatePush' ) |
|
| 115 | - ->will( $this->returnValue( $response ) ); |
|
| 114 | + $this->stub->expects($this->once())->method('updatePush') |
|
| 115 | + ->will($this->returnValue($response)); |
|
| 116 | 116 | |
| 117 | - $this->assertInstanceOf( \Psr\Http\Message\ResponseInterface::class, $this->object->updatePush( $request, $response, 'test' ) ); |
|
| 117 | + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $this->object->updatePush($request, $response, 'test')); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | public function testUpdateSync() |
| 122 | 122 | { |
| 123 | - $response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock(); |
|
| 124 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
| 125 | - $item = \Aimeos\MShop::create( $this->context, 'order' )->createItem(); |
|
| 123 | + $response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock(); |
|
| 124 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
| 125 | + $item = \Aimeos\MShop::create($this->context, 'order')->createItem(); |
|
| 126 | 126 | |
| 127 | - $this->stub->expects( $this->once() )->method( 'updateSync' ) |
|
| 128 | - ->will( $this->returnValue( $item ) ); |
|
| 127 | + $this->stub->expects($this->once())->method('updateSync') |
|
| 128 | + ->will($this->returnValue($item)); |
|
| 129 | 129 | |
| 130 | - $this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) ); |
|
| 130 | + $this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1)); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | public function testGetController() |
| 135 | 135 | { |
| 136 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 136 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 137 | 137 | |
| 138 | - $this->assertSame( $this->stub, $result ); |
|
| 138 | + $this->assertSame($this->stub, $result); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
| 142 | - protected function access( $name ) |
|
| 142 | + protected function access($name) |
|
| 143 | 143 | { |
| 144 | - $class = new \ReflectionClass( \Aimeos\Controller\Frontend\Service\Decorator\Base::class ); |
|
| 145 | - $method = $class->getMethod( $name ); |
|
| 146 | - $method->setAccessible( true ); |
|
| 144 | + $class = new \ReflectionClass(\Aimeos\Controller\Frontend\Service\Decorator\Base::class); |
|
| 145 | + $method = $class->getMethod($name); |
|
| 146 | + $method->setAccessible(true); |
|
| 147 | 147 | |
| 148 | 148 | return $method; |
| 149 | 149 | } |