@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->context = \TestHelperJadm::getContext(); |
| 23 | 23 | $this->view = $this->context->getView(); |
| 24 | 24 | |
| 25 | - $this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard( $this->context, $this->view, $templatePaths, 'service/config' ); |
|
| 25 | + $this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard($this->context, $this->view, $templatePaths, 'service/config'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -32,24 +32,24 @@ discard block |
||
| 32 | 32 | 'id' => 'DirectDebit,Category', |
| 33 | 33 | 'type' => 'payment', |
| 34 | 34 | ); |
| 35 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 36 | - $this->view->addHelper( 'param', $helper ); |
|
| 35 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 36 | + $this->view->addHelper('param', $helper); |
|
| 37 | 37 | |
| 38 | - $response = $this->object->get( $this->view->request(), $this->view->response() ); |
|
| 39 | - $result = json_decode( (string) $response->getBody(), true ); |
|
| 38 | + $response = $this->object->get($this->view->request(), $this->view->response()); |
|
| 39 | + $result = json_decode((string) $response->getBody(), true); |
|
| 40 | 40 | |
| 41 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 42 | - $this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) ); |
|
| 41 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 42 | + $this->assertEquals(1, count($response->getHeader('Content-Type'))); |
|
| 43 | 43 | |
| 44 | - $this->assertEquals( 6, $result['meta']['total'] ); |
|
| 45 | - $this->assertInternalType( 'array', $result['data'] ); |
|
| 46 | - $this->assertEquals( 'payment.url-success', $result['data'][0]['id'] ); |
|
| 47 | - $this->assertEquals( 'payment.url-failure', $result['data'][1]['id'] ); |
|
| 48 | - $this->assertEquals( 'payment.url-cancel', $result['data'][2]['id'] ); |
|
| 49 | - $this->assertEquals( 'payment.url-update', $result['data'][3]['id'] ); |
|
| 50 | - $this->assertEquals( 'category.include', $result['data'][4]['id'] ); |
|
| 51 | - $this->assertEquals( 'category.exclude', $result['data'][5]['id'] ); |
|
| 44 | + $this->assertEquals(6, $result['meta']['total']); |
|
| 45 | + $this->assertInternalType('array', $result['data']); |
|
| 46 | + $this->assertEquals('payment.url-success', $result['data'][0]['id']); |
|
| 47 | + $this->assertEquals('payment.url-failure', $result['data'][1]['id']); |
|
| 48 | + $this->assertEquals('payment.url-cancel', $result['data'][2]['id']); |
|
| 49 | + $this->assertEquals('payment.url-update', $result['data'][3]['id']); |
|
| 50 | + $this->assertEquals('category.include', $result['data'][4]['id']); |
|
| 51 | + $this->assertEquals('category.exclude', $result['data'][5]['id']); |
|
| 52 | 52 | |
| 53 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 53 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -110,30 +110,30 @@ discard block |
||
| 110 | 110 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 111 | 111 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 112 | 112 | */ |
| 113 | - public function get( ServerRequestInterface $request, ResponseInterface $response ) |
|
| 113 | + public function get(ServerRequestInterface $request, ResponseInterface $response) |
|
| 114 | 114 | { |
| 115 | 115 | $view = $this->getView(); |
| 116 | 116 | |
| 117 | 117 | try |
| 118 | 118 | { |
| 119 | - $response = $this->getItems( $view, $request, $response ); |
|
| 119 | + $response = $this->getItems($view, $request, $response); |
|
| 120 | 120 | $status = 200; |
| 121 | 121 | } |
| 122 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 122 | + catch (\Aimeos\MShop\Exception $e) |
|
| 123 | 123 | { |
| 124 | 124 | $status = 404; |
| 125 | - $view->errors = array( array( |
|
| 126 | - 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 125 | + $view->errors = array(array( |
|
| 126 | + 'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()), |
|
| 127 | 127 | 'detail' => $e->getTraceAsString(), |
| 128 | - ) ); |
|
| 128 | + )); |
|
| 129 | 129 | } |
| 130 | - catch( \Exception $e ) |
|
| 130 | + catch (\Exception $e) |
|
| 131 | 131 | { |
| 132 | 132 | $status = 500; |
| 133 | - $view->errors = array( array( |
|
| 133 | + $view->errors = array(array( |
|
| 134 | 134 | 'title' => $e->getMessage(), |
| 135 | 135 | 'detail' => $e->getTraceAsString(), |
| 136 | - ) ); |
|
| 136 | + )); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** admin/jsonadm/service/config/template-get |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | $tplconf = 'admin/jsonadm/service/config/template-get'; |
| 159 | 159 | $default = 'config-default.php'; |
| 160 | 160 | |
| 161 | - $body = $view->render( $view->config( $tplconf, $default ) ); |
|
| 161 | + $body = $view->render($view->config($tplconf, $default)); |
|
| 162 | 162 | |
| 163 | - return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' ) |
|
| 164 | - ->withBody( $view->response()->createStreamFromString( $body ) ) |
|
| 165 | - ->withStatus( $status ); |
|
| 163 | + return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"') |
|
| 164 | + ->withBody($view->response()->createStreamFromString($body)) |
|
| 165 | + ->withStatus($status); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 175 | 175 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 176 | 176 | */ |
| 177 | - protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) |
|
| 177 | + protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response) |
|
| 178 | 178 | { |
| 179 | - if( ( $id = $view->param( 'id' ) ) == null ) { |
|
| 180 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
|
| 179 | + if (($id = $view->param('id')) == null) { |
|
| 180 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 183 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 184 | 184 | |
| 185 | 185 | // @todo Pass type as second parameter to getProvider() |
| 186 | 186 | $values = [ |
| 187 | - 'service.type' => $view->param( 'type', 'payment' ), |
|
| 187 | + 'service.type' => $view->param('type', 'payment'), |
|
| 188 | 188 | 'service.provider' => $id, |
| 189 | 189 | ]; |
| 190 | - $item = new \Aimeos\MShop\Service\Item\Standard( $values ); |
|
| 190 | + $item = new \Aimeos\MShop\Service\Item\Standard($values); |
|
| 191 | 191 | |
| 192 | - $view->configItems = $manager->getProvider( $item )->getConfigBE(); |
|
| 192 | + $view->configItems = $manager->getProvider($item)->getConfigBE(); |
|
| 193 | 193 | |
| 194 | 194 | return $response; |
| 195 | 195 | } |
@@ -110,30 +110,30 @@ discard block |
||
| 110 | 110 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 111 | 111 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 112 | 112 | */ |
| 113 | - public function get( ServerRequestInterface $request, ResponseInterface $response ) |
|
| 113 | + public function get(ServerRequestInterface $request, ResponseInterface $response) |
|
| 114 | 114 | { |
| 115 | 115 | $view = $this->getView(); |
| 116 | 116 | |
| 117 | 117 | try |
| 118 | 118 | { |
| 119 | - $response = $this->getItems( $view, $request, $response ); |
|
| 119 | + $response = $this->getItems($view, $request, $response); |
|
| 120 | 120 | $status = 200; |
| 121 | 121 | } |
| 122 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 122 | + catch (\Aimeos\MShop\Exception $e) |
|
| 123 | 123 | { |
| 124 | 124 | $status = 404; |
| 125 | - $view->errors = array( array( |
|
| 126 | - 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 125 | + $view->errors = array(array( |
|
| 126 | + 'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()), |
|
| 127 | 127 | 'detail' => $e->getTraceAsString(), |
| 128 | - ) ); |
|
| 128 | + )); |
|
| 129 | 129 | } |
| 130 | - catch( \Exception $e ) |
|
| 130 | + catch (\Exception $e) |
|
| 131 | 131 | { |
| 132 | 132 | $status = 500; |
| 133 | - $view->errors = array( array( |
|
| 133 | + $view->errors = array(array( |
|
| 134 | 134 | 'title' => $e->getMessage(), |
| 135 | 135 | 'detail' => $e->getTraceAsString(), |
| 136 | - ) ); |
|
| 136 | + )); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** admin/jsonadm/coupon/config/template-get |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | $tplconf = 'admin/jsonadm/coupon/config/template-get'; |
| 159 | 159 | $default = 'config-default.php'; |
| 160 | 160 | |
| 161 | - $body = $view->render( $view->config( $tplconf, $default ) ); |
|
| 161 | + $body = $view->render($view->config($tplconf, $default)); |
|
| 162 | 162 | |
| 163 | - return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' ) |
|
| 164 | - ->withBody( $view->response()->createStreamFromString( $body ) ) |
|
| 165 | - ->withStatus( $status ); |
|
| 163 | + return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"') |
|
| 164 | + ->withBody($view->response()->createStreamFromString($body)) |
|
| 165 | + ->withStatus($status); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 175 | 175 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 176 | 176 | */ |
| 177 | - protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response ) |
|
| 177 | + protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response) |
|
| 178 | 178 | { |
| 179 | - if( ( $id = $view->param( 'id' ) ) == null ) { |
|
| 180 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
|
| 179 | + if (($id = $view->param('id')) == null) { |
|
| 180 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
| 183 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
| 184 | 184 | |
| 185 | 185 | $item = $manager->createItem(); |
| 186 | - $item->setProvider( $id ); |
|
| 186 | + $item->setProvider($id); |
|
| 187 | 187 | |
| 188 | - $view->configItems = $manager->getProvider( $item, null )->getConfigBE(); |
|
| 188 | + $view->configItems = $manager->getProvider($item, null)->getConfigBE(); |
|
| 189 | 189 | |
| 190 | 190 | return $response; |
| 191 | 191 | } |