@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * {@inheritDoc} |
33 | 33 | */ |
34 | - public function load( array $configs, ContainerBuilder $container ) |
|
34 | + public function load(array $configs, ContainerBuilder $container) |
|
35 | 35 | { |
36 | 36 | $configuration = new Configuration(); |
37 | - $config = $this->processConfiguration( $configuration, $configs ); |
|
37 | + $config = $this->processConfiguration($configuration, $configs); |
|
38 | 38 | |
39 | - foreach( $configs as $list ) { |
|
40 | - $config = array_replace_recursive( $config, $list ); |
|
39 | + foreach ($configs as $list) { |
|
40 | + $config = array_replace_recursive($config, $list); |
|
41 | 41 | } |
42 | 42 | |
43 | - foreach( $config as $key => $value ) { |
|
44 | - $container->setParameter( 'aimeos_shop.' . $key, $value ); |
|
43 | + foreach ($config as $key => $value) { |
|
44 | + $container->setParameter('aimeos_shop.'.$key, $value); |
|
45 | 45 | } |
46 | 46 | |
47 | - $loader = new Loader\YamlFileLoader( $container, new FileLocator( dirname( __DIR__ ) . '/Resources/config' ) ); |
|
48 | - $loader->load( 'services.yml' ); |
|
47 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config')); |
|
48 | + $loader->load('services.yml'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param ContainerBuilder $container ContainerBuilder object |
56 | 56 | */ |
57 | - public function prepend( ContainerBuilder $container ) |
|
57 | + public function prepend(ContainerBuilder $container) |
|
58 | 58 | { |
59 | - $configFile = dirname( __DIR__ ) . '/Resources/config/aimeos_shop.yml'; |
|
60 | - $config = Yaml::parse( file_get_contents( $configFile ) ); |
|
59 | + $configFile = dirname(__DIR__).'/Resources/config/aimeos_shop.yml'; |
|
60 | + $config = Yaml::parse(file_get_contents($configFile)); |
|
61 | 61 | |
62 | - $container->prependExtensionConfig( 'aimeos_shop', $config ); |
|
63 | - $container->addResource( new FileResource( $configFile ) ); |
|
62 | + $container->prependExtensionConfig('aimeos_shop', $config); |
|
63 | + $container->addResource(new FileResource($configFile)); |
|
64 | 64 | } |
65 | 65 | } |
@@ -3,24 +3,24 @@ discard block |
||
3 | 3 | use Doctrine\Common\Annotations\AnnotationRegistry; |
4 | 4 | |
5 | 5 | |
6 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
6 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
7 | 7 | |
8 | 8 | // if the bundle is within a symfony project, try to reuse the project's autoload |
9 | 9 | $files = array( |
10 | - __DIR__ . '/../vendor/autoload.php', |
|
11 | - __DIR__ . '/../../vendor/autoload.php', |
|
10 | + __DIR__.'/../vendor/autoload.php', |
|
11 | + __DIR__.'/../../vendor/autoload.php', |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | $autoload = false; |
15 | -foreach( $files as $file ) |
|
15 | +foreach ($files as $file) |
|
16 | 16 | { |
17 | - if( is_file( $file ) ) { |
|
17 | + if (is_file($file)) { |
|
18 | 18 | $autoload = require $file; |
19 | 19 | break; |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if( !$autoload ) |
|
23 | +if (!$autoload) |
|
24 | 24 | { |
25 | 25 | exit( |
26 | 26 | "Unable to find autoload.php file, please use composer to load dependencies: |
@@ -30,4 +30,4 @@ discard block |
||
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | -AnnotationRegistry::registerLoader( array( $autoload, 'loadClass' ) ); |
|
33 | +AnnotationRegistry::registerLoader(array($autoload, 'loadClass')); |
@@ -30,64 +30,64 @@ discard block |
||
30 | 30 | * @param Request $request Symfony request object |
31 | 31 | * @return Response Generated output for the admin interface |
32 | 32 | */ |
33 | - public function indexAction( Request $request ) |
|
33 | + public function indexAction(Request $request) |
|
34 | 34 | { |
35 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
36 | - $lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) ); |
|
37 | - $tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) ); |
|
35 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
36 | + $lang = $request->attributes->get('lang', $request->query->get('lang', 'en')); |
|
37 | + $tab = $request->attributes->get('tab', $request->query->get('tab', 0)); |
|
38 | 38 | |
39 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
40 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
39 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
40 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
41 | 41 | |
42 | - $aimeos = $this->get( 'aimeos' ); |
|
42 | + $aimeos = $this->get('aimeos'); |
|
43 | 43 | $bootstrap = $aimeos->get(); |
44 | 44 | |
45 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
46 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
45 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
46 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
47 | 47 | $cssFiles = array(); |
48 | 48 | |
49 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
49 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
50 | 50 | { |
51 | - foreach( $paths as $path ) |
|
51 | + foreach ($paths as $path) |
|
52 | 52 | { |
53 | - $jsbAbsPath = $base . '/' . $path; |
|
53 | + $jsbAbsPath = $base.'/'.$path; |
|
54 | 54 | |
55 | - if( !is_file( $jsbAbsPath ) ) { |
|
56 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
55 | + if (!is_file($jsbAbsPath)) { |
|
56 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
57 | 57 | } |
58 | 58 | |
59 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
60 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
59 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
60 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
65 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
64 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
65 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
66 | 66 | |
67 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
68 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
67 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
68 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
69 | 69 | |
70 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
70 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
71 | 71 | |
72 | 72 | $vars = array( |
73 | 73 | 'lang' => $lang, |
74 | 74 | 'cssFiles' => $cssFiles, |
75 | 75 | 'languages' => $this->getJsonLanguages(), |
76 | - 'config' => $this->getJsonClientConfig( $context ), |
|
77 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
78 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
76 | + 'config' => $this->getJsonClientConfig($context), |
|
77 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
78 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
79 | 79 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
80 | 80 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
81 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
82 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
83 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
84 | - 'extensions' => implode( ',', $bootstrap->getExtensions() ), |
|
81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
82 | + 'urlTemplate' => urldecode($adminUrl), |
|
83 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
84 | + 'extensions' => implode(',', $bootstrap->getExtensions()), |
|
85 | 85 | 'version' => $aimeos->getVersion(), |
86 | 86 | 'jqadmurl' => $jqadmUrl, |
87 | 87 | 'activeTab' => $tab, |
88 | 88 | ); |
89 | 89 | |
90 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
90 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | * @param Request $request Symfony request object |
98 | 98 | * @return Response JSON RPC message response |
99 | 99 | */ |
100 | - public function doAction( Request $request ) |
|
100 | + public function doAction(Request $request) |
|
101 | 101 | { |
102 | 102 | $csrfProvider = $this->get('security.csrf.token_manager'); |
103 | 103 | |
104 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
105 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
104 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
105 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
106 | 106 | } |
107 | 107 | |
108 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
109 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
110 | - $context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) ); |
|
111 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, 'default' ) ); |
|
108 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
109 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
110 | + $context->setView($this->get('aimeos_view')->create($context, array())); |
|
111 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, 'default')); |
|
112 | 112 | |
113 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
113 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
114 | 114 | |
115 | - $response = $controller->process( $request->request->all(), $request->getContent() ); |
|
116 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
115 | + $response = $controller->process($request->request->all(), $request->getContent()); |
|
116 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -126,27 +126,27 @@ discard block |
||
126 | 126 | { |
127 | 127 | $contents = ''; |
128 | 128 | $jsFiles = array(); |
129 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
129 | + $aimeos = $this->get('aimeos')->get(); |
|
130 | 130 | |
131 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
131 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
132 | 132 | { |
133 | - foreach( $paths as $path ) |
|
133 | + foreach ($paths as $path) |
|
134 | 134 | { |
135 | - $jsbAbsPath = $base . '/' . $path; |
|
136 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
137 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
135 | + $jsbAbsPath = $base.'/'.$path; |
|
136 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
137 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - foreach( $jsFiles as $file ) |
|
141 | + foreach ($jsFiles as $file) |
|
142 | 142 | { |
143 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
143 | + if (($content = file_get_contents($file)) !== false) { |
|
144 | 144 | $contents .= $content; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - $response = new Response( $contents ); |
|
149 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
148 | + $response = new Response($contents); |
|
149 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
150 | 150 | |
151 | 151 | return $response; |
152 | 152 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | { |
162 | 162 | $result = array(); |
163 | 163 | |
164 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
165 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
164 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
165 | + $result[] = array('id' => $id, 'label' => $id); |
|
166 | 166 | } |
167 | 167 | |
168 | - return json_encode( $result ); |
|
168 | + return json_encode($result); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
176 | 176 | * @return string JSON encoded configuration object |
177 | 177 | */ |
178 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
178 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
179 | 179 | { |
180 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
181 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
180 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
181 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -189,16 +189,16 @@ discard block |
||
189 | 189 | * @param string $lang ISO language code like "en" or "en_GB" |
190 | 190 | * @return string JSON encoded translation object |
191 | 191 | */ |
192 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
192 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
193 | 193 | { |
194 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
194 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
195 | 195 | |
196 | 196 | $content = array( |
197 | - 'admin' => $i18n->getAll( 'admin' ), |
|
198 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
197 | + 'admin' => $i18n->getAll('admin'), |
|
198 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
199 | 199 | ); |
200 | 200 | |
201 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
201 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | * @return string JSON encoded site item object |
211 | 211 | * @throws Exception If no site item was found for the code |
212 | 212 | */ |
213 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
213 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
214 | 214 | { |
215 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
215 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
216 | 216 | |
217 | 217 | $criteria = $manager->createSearch(); |
218 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
219 | - $items = $manager->searchItems( $criteria ); |
|
218 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
219 | + $items = $manager->searchItems($criteria); |
|
220 | 220 | |
221 | - if( ( $item = reset( $items ) ) === false ) { |
|
222 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
221 | + if (($item = reset($items)) === false) { |
|
222 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
223 | 223 | } |
224 | 224 | |
225 | - return json_encode( $item->toArray() ); |
|
225 | + return json_encode($item->toArray()); |
|
226 | 226 | } |
227 | 227 | } |
@@ -29,35 +29,35 @@ discard block |
||
29 | 29 | * @param $type File type, i.e. "css" or "js" |
30 | 30 | * @return Response Response object |
31 | 31 | */ |
32 | - public function fileAction( $type ) |
|
32 | + public function fileAction($type) |
|
33 | 33 | { |
34 | 34 | $contents = ''; |
35 | 35 | $files = array(); |
36 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
36 | + $aimeos = $this->get('aimeos')->get(); |
|
37 | 37 | |
38 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
38 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
39 | 39 | { |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $jsbAbsPath = $base . '/' . $path; |
|
43 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
44 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
42 | + $jsbAbsPath = $base.'/'.$path; |
|
43 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
44 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - foreach( $files as $file ) |
|
48 | + foreach ($files as $file) |
|
49 | 49 | { |
50 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
50 | + if (($content = file_get_contents($file)) !== false) { |
|
51 | 51 | $contents .= $content; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $response = new Response( $contents ); |
|
55 | + $response = new Response($contents); |
|
56 | 56 | |
57 | - if( $type === 'js' ) { |
|
58 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
59 | - } elseif( $type === 'css' ) { |
|
60 | - $response->headers->set( 'Content-Type', 'text/css' ); |
|
57 | + if ($type === 'js') { |
|
58 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
59 | + } elseif ($type === 'css') { |
|
60 | + $response->headers->set('Content-Type', 'text/css'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $response; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @param string $site Unique site code |
73 | 73 | * @return Response Generated output |
74 | 74 | */ |
75 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
75 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
76 | 76 | { |
77 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
78 | - return $this->getHtml( $cntl->copy() ); |
|
77 | + $cntl = $this->createClient($request, $site, $resource); |
|
78 | + return $this->getHtml($cntl->copy()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param string $site Unique site code |
88 | 88 | * @return Response Generated output |
89 | 89 | */ |
90 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
90 | + public function createAction(Request $request, $resource, $site = 'default') |
|
91 | 91 | { |
92 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
93 | - return $this->getHtml( $cntl->create() ); |
|
92 | + $cntl = $this->createClient($request, $site, $resource); |
|
93 | + return $this->getHtml($cntl->create()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @param string $site Unique site code |
103 | 103 | * @return Response Generated output |
104 | 104 | */ |
105 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
105 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
106 | 106 | { |
107 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
108 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
107 | + $cntl = $this->createClient($request, $site, $resource); |
|
108 | + return $this->getHtml($cntl->delete().$cntl->search()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string $site Unique site code |
118 | 118 | * @return Response Generated output |
119 | 119 | */ |
120 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
120 | + public function getAction(Request $request, $resource, $site = 'default') |
|
121 | 121 | { |
122 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
123 | - return $this->getHtml( $cntl->get() ); |
|
122 | + $cntl = $this->createClient($request, $site, $resource); |
|
123 | + return $this->getHtml($cntl->get()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param string $site Unique site code |
133 | 133 | * @return Response Generated output |
134 | 134 | */ |
135 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
135 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
136 | 136 | { |
137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
138 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
137 | + $cntl = $this->createClient($request, $site, $resource); |
|
138 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param string $site Unique site code |
148 | 148 | * @return Response Generated output |
149 | 149 | */ |
150 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
150 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
151 | 151 | { |
152 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
153 | - return $this->getHtml( $cntl->search() ); |
|
152 | + $cntl = $this->createClient($request, $site, $resource); |
|
153 | + return $this->getHtml($cntl->search()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,21 +162,21 @@ discard block |
||
162 | 162 | * @param string $resource Resource location, e.g. "product" |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
164 | 164 | */ |
165 | - protected function createClient( Request $request, $site, $resource ) |
|
165 | + protected function createClient(Request $request, $site, $resource) |
|
166 | 166 | { |
167 | - $lang = $request->get( 'lang', 'en' ); |
|
167 | + $lang = $request->get('lang', 'en'); |
|
168 | 168 | |
169 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
170 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
169 | + $aimeos = $this->get('aimeos')->get(); |
|
170 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
171 | 171 | |
172 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
173 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
174 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
172 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
173 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
174 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
175 | 175 | |
176 | - $view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang ); |
|
177 | - $context->setView( $view ); |
|
176 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
177 | + $context->setView($view); |
|
178 | 178 | |
179 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
179 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | * @param string $content Content from admin client |
187 | 187 | * @return Response View for rendering the output |
188 | 188 | */ |
189 | - protected function getHtml( $content ) |
|
189 | + protected function getHtml($content) |
|
190 | 190 | { |
191 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
192 | - $extnames = implode( ',', $this->get( 'aimeos' )->get()->getExtensions() ); |
|
193 | - $content = str_replace( ['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content ); |
|
191 | + $version = $this->get('aimeos')->getVersion(); |
|
192 | + $extnames = implode(',', $this->get('aimeos')->get()->getExtensions()); |
|
193 | + $content = str_replace(['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content); |
|
194 | 194 | |
195 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
195 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
196 | 196 | } |
197 | 197 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param string Related resource location, e.g. "address" |
32 | 32 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( ServerRequestInterface $request, $resource, $related = '' ) |
|
34 | + public function deleteAction(ServerRequestInterface $request, $resource, $related = '') |
|
35 | 35 | { |
36 | - return $this->createClient( $resource, $related )->delete( $request, new Response() ); |
|
36 | + return $this->createClient($resource, $related)->delete($request, new Response()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @param string Related resource location, e.g. "address" |
46 | 46 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
47 | 47 | */ |
48 | - public function getAction( ServerRequestInterface $request, $resource, $related = '' ) |
|
48 | + public function getAction(ServerRequestInterface $request, $resource, $related = '') |
|
49 | 49 | { |
50 | - return $this->createClient( $resource, $related )->get( $request, new Response() ); |
|
50 | + return $this->createClient($resource, $related)->get($request, new Response()); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @param string Related resource location, e.g. "address" |
60 | 60 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
61 | 61 | */ |
62 | - public function patchAction( ServerRequestInterface $request, $resource, $related = '' ) |
|
62 | + public function patchAction(ServerRequestInterface $request, $resource, $related = '') |
|
63 | 63 | { |
64 | - return $this->createClient( $resource, $related )->patch( $request, new Response() ); |
|
64 | + return $this->createClient($resource, $related)->patch($request, new Response()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @param string Related resource location, e.g. "address" |
74 | 74 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
75 | 75 | */ |
76 | - public function postAction( ServerRequestInterface $request, $resource, $related = '' ) |
|
76 | + public function postAction(ServerRequestInterface $request, $resource, $related = '') |
|
77 | 77 | { |
78 | - return $this->createClient( $resource, $related )->post( $request, new Response() ); |
|
78 | + return $this->createClient($resource, $related)->post($request, new Response()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @param string Related resource location, e.g. "address" |
88 | 88 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
89 | 89 | */ |
90 | - public function putAction( ServerRequestInterface $request, $resource, $related = '' ) |
|
90 | + public function putAction(ServerRequestInterface $request, $resource, $related = '') |
|
91 | 91 | { |
92 | - return $this->createClient( $resource, $related )->put( $request, new Response() ); |
|
92 | + return $this->createClient($resource, $related)->put($request, new Response()); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string Related resource location, e.g. "address" |
102 | 102 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
103 | 103 | */ |
104 | - public function optionsAction( ServerRequestInterface $request, $resource = '', $related = '' ) |
|
104 | + public function optionsAction(ServerRequestInterface $request, $resource = '', $related = '') |
|
105 | 105 | { |
106 | - return $this->createClient( $resource, $related )->options( $request, new Response() ); |
|
106 | + return $this->createClient($resource, $related)->options($request, new Response()); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @param string Related resource location, e.g. "address" |
115 | 115 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
116 | 116 | */ |
117 | - protected function createClient( $resource, $related ) |
|
117 | + protected function createClient($resource, $related) |
|
118 | 118 | { |
119 | - $tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/jsonapi/templates' ); |
|
120 | - $context = $this->container->get( 'aimeos_context' )->get(); |
|
119 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/jsonapi/templates'); |
|
120 | + $context = $this->container->get('aimeos_context')->get(); |
|
121 | 121 | $langid = $context->getLocale()->getLanguageId(); |
122 | 122 | |
123 | - $view = $this->container->get( 'aimeos_view' )->create( $context, $tmplPaths, $langid ); |
|
124 | - $context->setView( $view ); |
|
123 | + $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); |
|
124 | + $context->setView($view); |
|
125 | 125 | |
126 | - return \Aimeos\Client\JsonApi\Factory::createClient( $context, $tmplPaths, $resource . '/' . $related ); |
|
126 | + return \Aimeos\Client\JsonApi\Factory::createClient($context, $tmplPaths, $resource.'/'.$related); |
|
127 | 127 | } |
128 | 128 | } |
@@ -10,60 +10,60 @@ discard block |
||
10 | 10 | public function testOptionsAction() |
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
13 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
14 | 14 | $response = $client->getResponse(); |
15 | 15 | |
16 | - $json = json_decode( $response->getContent(), true ); |
|
16 | + $json = json_decode($response->getContent(), true); |
|
17 | 17 | |
18 | - $this->assertNotNull( $json ); |
|
19 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
20 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
21 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
18 | + $this->assertNotNull($json); |
|
19 | + $this->assertEquals(200, $response->getStatusCode()); |
|
20 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
21 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | public function testGetAttributeAction() |
26 | 26 | { |
27 | 27 | $client = static::createClient(); |
28 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/attribute', [] ); |
|
28 | + $client->request('GET', '/unittest/de/EUR/jsonapi/attribute', []); |
|
29 | 29 | $response = $client->getResponse(); |
30 | 30 | |
31 | - $json = json_decode( $response->getContent(), true ); |
|
31 | + $json = json_decode($response->getContent(), true); |
|
32 | 32 | |
33 | - $this->assertNotNull( $json ); |
|
34 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
35 | - $this->assertEquals( 24, $json['meta']['total'] ); |
|
36 | - $this->assertEquals( 24, count( $json['data'] ) ); |
|
33 | + $this->assertNotNull($json); |
|
34 | + $this->assertEquals(200, $response->getStatusCode()); |
|
35 | + $this->assertEquals(24, $json['meta']['total']); |
|
36 | + $this->assertEquals(24, count($json['data'])); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testGetCatalogAction() |
41 | 41 | { |
42 | 42 | $client = static::createClient(); |
43 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/catalog', [] ); |
|
43 | + $client->request('GET', '/unittest/de/EUR/jsonapi/catalog', []); |
|
44 | 44 | $response = $client->getResponse(); |
45 | 45 | |
46 | - $json = json_decode( $response->getContent(), true ); |
|
46 | + $json = json_decode($response->getContent(), true); |
|
47 | 47 | |
48 | - $this->assertNotNull( $json ); |
|
49 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
50 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
51 | - $this->assertEquals( 4, count( $json['data'] ) ); |
|
48 | + $this->assertNotNull($json); |
|
49 | + $this->assertEquals(200, $response->getStatusCode()); |
|
50 | + $this->assertEquals(1, $json['meta']['total']); |
|
51 | + $this->assertEquals(4, count($json['data'])); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testGetLocaleAction() |
56 | 56 | { |
57 | 57 | $client = static::createClient(); |
58 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/locale', [] ); |
|
58 | + $client->request('GET', '/unittest/de/EUR/jsonapi/locale', []); |
|
59 | 59 | $response = $client->getResponse(); |
60 | 60 | |
61 | - $json = json_decode( $response->getContent(), true ); |
|
61 | + $json = json_decode($response->getContent(), true); |
|
62 | 62 | |
63 | - $this->assertNotNull( $json ); |
|
64 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
65 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
66 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
63 | + $this->assertNotNull($json); |
|
64 | + $this->assertEquals(200, $response->getStatusCode()); |
|
65 | + $this->assertEquals(1, $json['meta']['total']); |
|
66 | + $this->assertEquals(1, count($json['data'])); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -72,60 +72,60 @@ discard block |
||
72 | 72 | $client = static::createClient(); |
73 | 73 | |
74 | 74 | $params = ['filter' => ['f_search' => 'Cafe Noire Cap', 'f_listtype' => 'unittype19']]; |
75 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/product', $params ); |
|
75 | + $client->request('GET', '/unittest/de/EUR/jsonapi/product', $params); |
|
76 | 76 | $response = $client->getResponse(); |
77 | 77 | |
78 | - $json = json_decode( $response->getContent(), true ); |
|
78 | + $json = json_decode($response->getContent(), true); |
|
79 | 79 | |
80 | - $this->assertNotNull( $json ); |
|
81 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
82 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
83 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
84 | - $this->assertArrayHasKey( 'id', $json['data'][0] ); |
|
85 | - $this->assertEquals( 'CNC', $json['data'][0]['attributes']['product.code'] ); |
|
80 | + $this->assertNotNull($json); |
|
81 | + $this->assertEquals(200, $response->getStatusCode()); |
|
82 | + $this->assertEquals(1, $json['meta']['total']); |
|
83 | + $this->assertEquals(1, count($json['data'])); |
|
84 | + $this->assertArrayHasKey('id', $json['data'][0]); |
|
85 | + $this->assertEquals('CNC', $json['data'][0]['attributes']['product.code']); |
|
86 | 86 | |
87 | 87 | $id = $json['data'][0]['id']; |
88 | 88 | |
89 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/product/' . $id ); |
|
89 | + $client->request('GET', '/unittest/de/EUR/jsonapi/product/'.$id); |
|
90 | 90 | $response = $client->getResponse(); |
91 | 91 | |
92 | - $json = json_decode( $response->getContent(), true ); |
|
92 | + $json = json_decode($response->getContent(), true); |
|
93 | 93 | |
94 | - $this->assertNotNull( $json ); |
|
95 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
96 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
97 | - $this->assertArrayHasKey( 'id', $json['data'] ); |
|
98 | - $this->assertEquals( 'CNC', $json['data']['attributes']['product.code'] ); |
|
94 | + $this->assertNotNull($json); |
|
95 | + $this->assertEquals(200, $response->getStatusCode()); |
|
96 | + $this->assertEquals(1, $json['meta']['total']); |
|
97 | + $this->assertArrayHasKey('id', $json['data']); |
|
98 | + $this->assertEquals('CNC', $json['data']['attributes']['product.code']); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | 102 | public function testGetServiceAction() |
103 | 103 | { |
104 | 104 | $client = static::createClient(); |
105 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/service', [] ); |
|
105 | + $client->request('GET', '/unittest/de/EUR/jsonapi/service', []); |
|
106 | 106 | $response = $client->getResponse(); |
107 | 107 | |
108 | - $json = json_decode( $response->getContent(), true ); |
|
108 | + $json = json_decode($response->getContent(), true); |
|
109 | 109 | |
110 | - $this->assertNotNull( $json ); |
|
111 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
112 | - $this->assertEquals( 4, $json['meta']['total'] ); |
|
113 | - $this->assertEquals( 4, count( $json['data'] ) ); |
|
110 | + $this->assertNotNull($json); |
|
111 | + $this->assertEquals(200, $response->getStatusCode()); |
|
112 | + $this->assertEquals(4, $json['meta']['total']); |
|
113 | + $this->assertEquals(4, count($json['data'])); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | 117 | public function testGetStockAction() |
118 | 118 | { |
119 | 119 | $client = static::createClient(); |
120 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/stock', ['filter' => ['s_prodcode' => ['CNC', 'CNE']]] ); |
|
120 | + $client->request('GET', '/unittest/de/EUR/jsonapi/stock', ['filter' => ['s_prodcode' => ['CNC', 'CNE']]]); |
|
121 | 121 | $response = $client->getResponse(); |
122 | 122 | |
123 | - $json = json_decode( $response->getContent(), true ); |
|
123 | + $json = json_decode($response->getContent(), true); |
|
124 | 124 | |
125 | - $this->assertNotNull( $json ); |
|
126 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
127 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
128 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
125 | + $this->assertNotNull($json); |
|
126 | + $this->assertEquals(200, $response->getStatusCode()); |
|
127 | + $this->assertEquals(2, $json['meta']['total']); |
|
128 | + $this->assertEquals(2, count($json['data'])); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -133,24 +133,24 @@ discard block |
||
133 | 133 | { |
134 | 134 | $client = static::createClient(); |
135 | 135 | |
136 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
137 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
138 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
136 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
137 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
138 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
139 | 139 | |
140 | 140 | // catalog root |
141 | - $client->request( 'GET', $json['meta']['resources']['catalog'], ['include' => 'catalog'] ); |
|
142 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
143 | - $this->assertEquals( 'categories', $json['included'][0]['attributes']['catalog.code'] ); |
|
141 | + $client->request('GET', $json['meta']['resources']['catalog'], ['include' => 'catalog']); |
|
142 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
143 | + $this->assertEquals('categories', $json['included'][0]['attributes']['catalog.code']); |
|
144 | 144 | |
145 | 145 | // "categories" category |
146 | - $client->request( 'GET', $json['included'][0]['links']['self']['href'], ['include' => 'catalog'] ); |
|
147 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
148 | - $this->assertEquals( 'cafe', $json['included'][0]['attributes']['catalog.code'] ); |
|
146 | + $client->request('GET', $json['included'][0]['links']['self']['href'], ['include' => 'catalog']); |
|
147 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
148 | + $this->assertEquals('cafe', $json['included'][0]['attributes']['catalog.code']); |
|
149 | 149 | |
150 | 150 | // product list for "cafe" category |
151 | - $client->request( 'GET', $json['included'][0]['links']['product']['href'] ); |
|
152 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
153 | - $this->assertEquals( 'CNE', $json['data'][0]['attributes']['product.code'] ); |
|
151 | + $client->request('GET', $json['included'][0]['links']['product']['href']); |
|
152 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
153 | + $this->assertEquals('CNE', $json['data'][0]['attributes']['product.code']); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -158,26 +158,26 @@ discard block |
||
158 | 158 | { |
159 | 159 | $client = static::createClient(); |
160 | 160 | |
161 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
162 | - $options = json_decode( $client->getResponse()->getContent(), true ); |
|
163 | - $this->assertGreaterThan( 8, count( $options['meta']['resources'] ) ); |
|
161 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
162 | + $options = json_decode($client->getResponse()->getContent(), true); |
|
163 | + $this->assertGreaterThan(8, count($options['meta']['resources'])); |
|
164 | 164 | |
165 | 165 | // all available attrbutes |
166 | - $client->request( 'GET', $options['meta']['resources']['attribute'] ); |
|
167 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
166 | + $client->request('GET', $options['meta']['resources']['attribute']); |
|
167 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
168 | 168 | |
169 | - foreach( $json['data'] as $entry ) |
|
169 | + foreach ($json['data'] as $entry) |
|
170 | 170 | { |
171 | - if( $entry['attributes']['attribute.code'] === 'xl' ) |
|
171 | + if ($entry['attributes']['attribute.code'] === 'xl') |
|
172 | 172 | { |
173 | 173 | // products with attrbute "xl" |
174 | - $client->request( 'GET', $options['meta']['resources']['product'], ['filter' => ['f_attrid' => $entry['id']]] ); |
|
174 | + $client->request('GET', $options['meta']['resources']['product'], ['filter' => ['f_attrid' => $entry['id']]]); |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
180 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
179 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
180 | + $this->assertEquals(2, $json['meta']['total']); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | { |
186 | 186 | $client = static::createClient(); |
187 | 187 | |
188 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
189 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
190 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
188 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
189 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
190 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
191 | 191 | |
192 | 192 | // product list for full text search |
193 | - $client->request( 'GET', $json['meta']['resources']['product'], ['filter' => ['f_search' => 'selection']] ); |
|
194 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
195 | - $this->assertEquals( 3, count( $json['data'] ) ); |
|
193 | + $client->request('GET', $json['meta']['resources']['product'], ['filter' => ['f_search' => 'selection']]); |
|
194 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
195 | + $this->assertEquals(3, count($json['data'])); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | { |
201 | 201 | $client = static::createClient(); |
202 | 202 | |
203 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
204 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
205 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
203 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
204 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
205 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
206 | 206 | |
207 | 207 | // get empty basket |
208 | - $client->request( 'GET', $json['meta']['resources']['basket'] ); |
|
209 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
210 | - $this->assertEquals( 'basket', $json['data']['type'] ); |
|
208 | + $client->request('GET', $json['meta']['resources']['basket']); |
|
209 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
210 | + $this->assertEquals('basket', $json['data']['type']); |
|
211 | 211 | |
212 | 212 | $content = '{"data": {"id": "delivery", "attributes": {"order.base.address.firstname": "test"}}}'; |
213 | - $client->request( 'POST', $json['links']['basket/address']['href'], [], [], [], $content ); |
|
214 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
215 | - $this->assertEquals( 'basket/address', $json['included'][0]['type'] ); |
|
213 | + $client->request('POST', $json['links']['basket/address']['href'], [], [], [], $content); |
|
214 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
215 | + $this->assertEquals('basket/address', $json['included'][0]['type']); |
|
216 | 216 | |
217 | - $client->request( 'DELETE', $json['included'][0]['links']['self']['href'] ); |
|
218 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
219 | - $this->assertEquals( 0, count( $json['included'] ) ); |
|
217 | + $client->request('DELETE', $json['included'][0]['links']['self']['href']); |
|
218 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
219 | + $this->assertEquals(0, count($json['included'])); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -224,31 +224,31 @@ discard block |
||
224 | 224 | { |
225 | 225 | $client = static::createClient(); |
226 | 226 | |
227 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
228 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
229 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
227 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
228 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
229 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
230 | 230 | |
231 | 231 | // product for code "CNC" |
232 | - $client->request( 'GET', $json['meta']['resources']['product'], ['filter' => ['==' => ['product.code' => 'CNC']]] ); |
|
233 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
234 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
232 | + $client->request('GET', $json['meta']['resources']['product'], ['filter' => ['==' => ['product.code' => 'CNC']]]); |
|
233 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
234 | + $this->assertEquals(1, count($json['data'])); |
|
235 | 235 | |
236 | 236 | // add product "CNC" as prerequisite |
237 | - $content = '{"data": {"attributes": {"product.id": ' . $json['data'][0]['id'] . '}}}'; |
|
238 | - $client->request( 'POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content ); |
|
239 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
240 | - $this->assertEquals( 'basket/product', $json['included'][0]['type'] ); |
|
237 | + $content = '{"data": {"attributes": {"product.id": '.$json['data'][0]['id'].'}}}'; |
|
238 | + $client->request('POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content); |
|
239 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
240 | + $this->assertEquals('basket/product', $json['included'][0]['type']); |
|
241 | 241 | |
242 | 242 | // add coupon "GHIJ" |
243 | 243 | $content = '{"data": {"id": "GHIJ"}}'; |
244 | - $client->request( 'POST', $json['links']['basket/coupon']['href'], [], [], [], $content ); |
|
245 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
246 | - $this->assertEquals( 'basket/coupon', $json['included'][2]['type'] ); |
|
244 | + $client->request('POST', $json['links']['basket/coupon']['href'], [], [], [], $content); |
|
245 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
246 | + $this->assertEquals('basket/coupon', $json['included'][2]['type']); |
|
247 | 247 | |
248 | 248 | // remove coupon "GHIJ" again |
249 | - $client->request( 'DELETE', $json['included'][2]['links']['self']['href'] ); |
|
250 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
251 | - $this->assertEquals( 1, count( $json['included'] ) ); |
|
249 | + $client->request('DELETE', $json['included'][2]['links']['self']['href']); |
|
250 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
251 | + $this->assertEquals(1, count($json['included'])); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -256,28 +256,28 @@ discard block |
||
256 | 256 | { |
257 | 257 | $client = static::createClient(); |
258 | 258 | |
259 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
260 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
261 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
259 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
260 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
261 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
262 | 262 | |
263 | 263 | // product for code "CNC" |
264 | - $client->request( 'GET', $json['meta']['resources']['product'], ['filter' => ['f_search' => 'ABCD']] ); |
|
265 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
266 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
264 | + $client->request('GET', $json['meta']['resources']['product'], ['filter' => ['f_search' => 'ABCD']]); |
|
265 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
266 | + $this->assertEquals(1, count($json['data'])); |
|
267 | 267 | |
268 | - $content = '{"data": {"attributes": {"product.id": ' . $json['data'][0]['id'] . '}}}'; |
|
269 | - $client->request( 'POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content ); |
|
270 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
271 | - $this->assertEquals( 'basket/product', $json['included'][0]['type'] ); |
|
268 | + $content = '{"data": {"attributes": {"product.id": '.$json['data'][0]['id'].'}}}'; |
|
269 | + $client->request('POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content); |
|
270 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
271 | + $this->assertEquals('basket/product', $json['included'][0]['type']); |
|
272 | 272 | |
273 | 273 | $content = '{"data": {"attributes": {"quantity": 2}}}'; |
274 | - $client->request( 'PATCH', $json['included'][0]['links']['self']['href'], [], [], [], $content ); |
|
275 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
276 | - $this->assertEquals( 2, $json['included'][0]['attributes']['order.base.product.quantity'] ); |
|
274 | + $client->request('PATCH', $json['included'][0]['links']['self']['href'], [], [], [], $content); |
|
275 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
276 | + $this->assertEquals(2, $json['included'][0]['attributes']['order.base.product.quantity']); |
|
277 | 277 | |
278 | - $client->request( 'DELETE', $json['included'][0]['links']['self']['href'] ); |
|
279 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
280 | - $this->assertEquals( 0, count( $json['included'] ) ); |
|
278 | + $client->request('DELETE', $json['included'][0]['links']['self']['href']); |
|
279 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
280 | + $this->assertEquals(0, count($json['included'])); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | { |
286 | 286 | $client = static::createClient(); |
287 | 287 | |
288 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
289 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
290 | - $this->assertGreaterThan( 8, count( $json['meta']['resources'] ) ); |
|
288 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
289 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
290 | + $this->assertGreaterThan(8, count($json['meta']['resources'])); |
|
291 | 291 | |
292 | 292 | // payment services |
293 | - $client->request( 'GET', $json['meta']['resources']['service'], ['filter' => ['cs_type' => 'payment']] ); |
|
294 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
295 | - $this->assertEquals( 3, count( $json['data'] ) ); |
|
293 | + $client->request('GET', $json['meta']['resources']['service'], ['filter' => ['cs_type' => 'payment']]); |
|
294 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
295 | + $this->assertEquals(3, count($json['data'])); |
|
296 | 296 | |
297 | 297 | $content = ['data' => ['id' => 'payment', 'attributes' => [ |
298 | 298 | 'service.id' => $json['data'][1]['id'], |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | 'directdebit.bankcode' => 'ABCDEFGH', |
302 | 302 | 'directdebit.bankname' => 'test bank', |
303 | 303 | ]]]; |
304 | - $client->request( 'POST', $json['data'][1]['links']['basket/service']['href'], [], [], [], json_encode( $content ) ); |
|
305 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
306 | - $this->assertEquals( 'basket/service', $json['included'][0]['type'] ); |
|
307 | - $this->assertEquals( 'directdebit-test', $json['included'][0]['attributes']['order.base.service.code'] ); |
|
308 | - $this->assertEquals( 5, count( $json['included'][0]['attributes']['attribute'] ) ); |
|
309 | - |
|
310 | - $client->request( 'DELETE', $json['included'][0]['links']['self']['href'] ); |
|
311 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
312 | - $this->assertEquals( 0, count( $json['included'] ) ); |
|
304 | + $client->request('POST', $json['data'][1]['links']['basket/service']['href'], [], [], [], json_encode($content)); |
|
305 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
306 | + $this->assertEquals('basket/service', $json['included'][0]['type']); |
|
307 | + $this->assertEquals('directdebit-test', $json['included'][0]['attributes']['order.base.service.code']); |
|
308 | + $this->assertEquals(5, count($json['included'][0]['attributes']['attribute'])); |
|
309 | + |
|
310 | + $client->request('DELETE', $json['included'][0]['links']['self']['href']); |
|
311 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
312 | + $this->assertEquals(0, count($json['included'])); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -318,17 +318,17 @@ discard block |
||
318 | 318 | $client = static::createClient(array(), array( |
319 | 319 | 'PHP_AUTH_USER' => 'UTC001', |
320 | 320 | 'PHP_AUTH_PW' => 'unittest', |
321 | - ) ); |
|
321 | + )); |
|
322 | 322 | |
323 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/customer', [] ); |
|
323 | + $client->request('GET', '/unittest/de/EUR/jsonapi/customer', []); |
|
324 | 324 | $response = $client->getResponse(); |
325 | 325 | |
326 | - $json = json_decode( $response->getContent(), true ); |
|
326 | + $json = json_decode($response->getContent(), true); |
|
327 | 327 | |
328 | - $this->assertNotNull( $json ); |
|
329 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
330 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
331 | - $this->assertEquals( 4, count( $json['data'] ) ); |
|
328 | + $this->assertNotNull($json); |
|
329 | + $this->assertEquals(200, $response->getStatusCode()); |
|
330 | + $this->assertEquals(1, $json['meta']['total']); |
|
331 | + $this->assertEquals(4, count($json['data'])); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,22 +337,22 @@ discard block |
||
337 | 337 | $client = static::createClient(array(), array( |
338 | 338 | 'PHP_AUTH_USER' => 'UTC001', |
339 | 339 | 'PHP_AUTH_PW' => 'unittest', |
340 | - ) ); |
|
340 | + )); |
|
341 | 341 | |
342 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/customer', [] ); |
|
342 | + $client->request('GET', '/unittest/de/EUR/jsonapi/customer', []); |
|
343 | 343 | $response = $client->getResponse(); |
344 | 344 | |
345 | - $json = json_decode( $response->getContent(), true ); |
|
345 | + $json = json_decode($response->getContent(), true); |
|
346 | 346 | |
347 | - $client->request( 'GET', $json['links']['customer/address']['href'], [] ); |
|
347 | + $client->request('GET', $json['links']['customer/address']['href'], []); |
|
348 | 348 | $response = $client->getResponse(); |
349 | 349 | |
350 | - $json = json_decode( $response->getContent(), true ); |
|
350 | + $json = json_decode($response->getContent(), true); |
|
351 | 351 | |
352 | - $this->assertNotNull( $json ); |
|
353 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
354 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
355 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
352 | + $this->assertNotNull($json); |
|
353 | + $this->assertEquals(200, $response->getStatusCode()); |
|
354 | + $this->assertEquals(1, $json['meta']['total']); |
|
355 | + $this->assertEquals(1, count($json['data'])); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
@@ -361,17 +361,17 @@ discard block |
||
361 | 361 | $client = static::createClient(array(), array( |
362 | 362 | 'PHP_AUTH_USER' => 'UTC001', |
363 | 363 | 'PHP_AUTH_PW' => 'unittest', |
364 | - ) ); |
|
364 | + )); |
|
365 | 365 | |
366 | - $client->request( 'GET', '/unittest/de/EUR/jsonapi/order', [] ); |
|
366 | + $client->request('GET', '/unittest/de/EUR/jsonapi/order', []); |
|
367 | 367 | $response = $client->getResponse(); |
368 | 368 | |
369 | - $json = json_decode( $response->getContent(), true ); |
|
369 | + $json = json_decode($response->getContent(), true); |
|
370 | 370 | |
371 | - $this->assertNotNull( $json ); |
|
372 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
373 | - $this->assertEquals( 4, $json['meta']['total'] ); |
|
374 | - $this->assertEquals( 4, count( $json['data'] ) ); |
|
371 | + $this->assertNotNull($json); |
|
372 | + $this->assertEquals(200, $response->getStatusCode()); |
|
373 | + $this->assertEquals(4, $json['meta']['total']); |
|
374 | + $this->assertEquals(4, count($json['data'])); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | |
@@ -379,63 +379,63 @@ discard block |
||
379 | 379 | { |
380 | 380 | $client = static::createClient(); |
381 | 381 | |
382 | - $client->request( 'OPTIONS', '/unittest/de/EUR/jsonapi' ); |
|
383 | - $optJson = json_decode( $client->getResponse()->getContent(), true ); |
|
384 | - $this->assertGreaterThan( 8, count( $optJson['meta']['resources'] ) ); |
|
382 | + $client->request('OPTIONS', '/unittest/de/EUR/jsonapi'); |
|
383 | + $optJson = json_decode($client->getResponse()->getContent(), true); |
|
384 | + $this->assertGreaterThan(8, count($optJson['meta']['resources'])); |
|
385 | 385 | |
386 | 386 | // product for code "CNC" |
387 | - $client->request( 'GET', $optJson['meta']['resources']['product'], ['filter' => ['==' => ['product.code' => 'CNC']]] ); |
|
388 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
389 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
387 | + $client->request('GET', $optJson['meta']['resources']['product'], ['filter' => ['==' => ['product.code' => 'CNC']]]); |
|
388 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
389 | + $this->assertEquals(1, count($json['data'])); |
|
390 | 390 | |
391 | 391 | // add product "CNC" |
392 | - $content = '{"data": {"attributes": {"product.id": ' . $json['data'][0]['id'] . '}}}'; |
|
393 | - $client->request( 'POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content ); |
|
394 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
395 | - $this->assertEquals( 'basket/product', $json['included'][0]['type'] ); |
|
392 | + $content = '{"data": {"attributes": {"product.id": '.$json['data'][0]['id'].'}}}'; |
|
393 | + $client->request('POST', $json['data'][0]['links']['basket/product']['href'], [], [], [], $content); |
|
394 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
395 | + $this->assertEquals('basket/product', $json['included'][0]['type']); |
|
396 | 396 | |
397 | 397 | // delivery services |
398 | - $client->request( 'GET', $optJson['meta']['resources']['service'], ['filter' => ['cs_type' => 'delivery']] ); |
|
399 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
400 | - $this->assertEquals( 1, count( $json['data'] ) ); |
|
398 | + $client->request('GET', $optJson['meta']['resources']['service'], ['filter' => ['cs_type' => 'delivery']]); |
|
399 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
400 | + $this->assertEquals(1, count($json['data'])); |
|
401 | 401 | |
402 | 402 | // add delivery service |
403 | - $content = '{"data": {"id": "delivery", "attributes": {"service.id": ' . $json['data'][0]['id'] . '}}}'; |
|
404 | - $client->request( 'POST', $json['data'][0]['links']['basket/service']['href'], [], [], [], $content ); |
|
405 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
406 | - $this->assertEquals( 'basket/service', $json['included'][1]['type'] ); |
|
403 | + $content = '{"data": {"id": "delivery", "attributes": {"service.id": '.$json['data'][0]['id'].'}}}'; |
|
404 | + $client->request('POST', $json['data'][0]['links']['basket/service']['href'], [], [], [], $content); |
|
405 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
406 | + $this->assertEquals('basket/service', $json['included'][1]['type']); |
|
407 | 407 | |
408 | 408 | // payment services |
409 | - $client->request( 'GET', $optJson['meta']['resources']['service'], ['filter' => ['cs_type' => 'payment']] ); |
|
410 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
411 | - $this->assertEquals( 3, count( $json['data'] ) ); |
|
409 | + $client->request('GET', $optJson['meta']['resources']['service'], ['filter' => ['cs_type' => 'payment']]); |
|
410 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
411 | + $this->assertEquals(3, count($json['data'])); |
|
412 | 412 | |
413 | 413 | // add payment service |
414 | - $content = '{"data": {"id": "payment", "attributes": {"service.id": ' . $json['data'][0]['id'] . '}}}'; |
|
415 | - $client->request( 'POST', $json['data'][0]['links']['basket/service']['href'], [], [], [], $content ); |
|
416 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
417 | - $this->assertEquals( 'basket/service', $json['included'][2]['type'] ); |
|
414 | + $content = '{"data": {"id": "payment", "attributes": {"service.id": '.$json['data'][0]['id'].'}}}'; |
|
415 | + $client->request('POST', $json['data'][0]['links']['basket/service']['href'], [], [], [], $content); |
|
416 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
417 | + $this->assertEquals('basket/service', $json['included'][2]['type']); |
|
418 | 418 | |
419 | 419 | // add address |
420 | 420 | $content = '{"data": {"id": "payment", "attributes": {"order.base.address.firstname": "test"}}}'; |
421 | - $client->request( 'POST', $json['links']['basket/address']['href'], [], [], [], $content ); |
|
422 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
423 | - $this->assertEquals( 'basket/address', $json['included'][3]['type'] ); |
|
421 | + $client->request('POST', $json['links']['basket/address']['href'], [], [], [], $content); |
|
422 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
423 | + $this->assertEquals('basket/address', $json['included'][3]['type']); |
|
424 | 424 | |
425 | 425 | // store basket |
426 | - $client->request( 'POST', $json['links']['self']['href'] ); |
|
427 | - $basketJson = json_decode( $client->getResponse()->getContent(), true ); |
|
428 | - $this->assertEquals( true, ctype_digit( $basketJson['data']['id'] ) ); |
|
426 | + $client->request('POST', $json['links']['self']['href']); |
|
427 | + $basketJson = json_decode($client->getResponse()->getContent(), true); |
|
428 | + $this->assertEquals(true, ctype_digit($basketJson['data']['id'])); |
|
429 | 429 | |
430 | 430 | // add order |
431 | - $content = '{"data": {"attributes": {"order.baseid": ' . $basketJson['data']['id'] . '}}}'; |
|
432 | - $client->request( 'POST', $basketJson['links']['order']['href'], [], [], [], $content ); |
|
433 | - $json = json_decode( $client->getResponse()->getContent(), true ); |
|
434 | - $this->assertEquals( true, ctype_digit( $json['data']['id'] ) ); |
|
431 | + $content = '{"data": {"attributes": {"order.baseid": '.$basketJson['data']['id'].'}}}'; |
|
432 | + $client->request('POST', $basketJson['links']['order']['href'], [], [], [], $content); |
|
433 | + $json = json_decode($client->getResponse()->getContent(), true); |
|
434 | + $this->assertEquals(true, ctype_digit($json['data']['id'])); |
|
435 | 435 | |
436 | 436 | |
437 | 437 | // delete created order |
438 | - $context = static::$kernel->getContainer()->get( 'aimeos_context' )->get(); |
|
439 | - \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->deleteItem( $basketJson['data']['id'] ); |
|
438 | + $context = static::$kernel->getContainer()->get('aimeos_context')->get(); |
|
439 | + \Aimeos\MShop\Factory::createManager($context, 'order/base')->deleteItem($basketJson['data']['id']); |
|
440 | 440 | } |
441 | 441 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * {@inheritdoc} |
30 | 30 | */ |
31 | - public function registerContainerConfiguration( LoaderInterface $loader ) |
|
31 | + public function registerContainerConfiguration(LoaderInterface $loader) |
|
32 | 32 | { |
33 | - $loader->load( __DIR__ . '/config/config.yml' ); |
|
33 | + $loader->load(__DIR__.'/config/config.yml'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getCacheDir() |
41 | 41 | { |
42 | - return sys_get_temp_dir() . '/aimeos-symfony/cache'; |
|
42 | + return sys_get_temp_dir().'/aimeos-symfony/cache'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getLogDir() |
50 | 50 | { |
51 | - return sys_get_temp_dir() . '/aimeos-symfony/logs'; |
|
51 | + return sys_get_temp_dir().'/aimeos-symfony/logs'; |
|
52 | 52 | } |
53 | 53 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Container $container Container object to access parameters |
31 | 31 | */ |
32 | - public function __construct( Container $container ) |
|
32 | + public function __construct(Container $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Interface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths(); |
|
46 | + $i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths(); |
|
47 | 47 | |
48 | - foreach( $languageIds as $langid ) |
|
48 | + foreach ($languageIds as $langid) |
|
49 | 49 | { |
50 | - if( !isset( $this->i18n[$langid] ) ) |
|
50 | + if (!isset($this->i18n[$langid])) |
|
51 | 51 | { |
52 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
52 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
53 | 53 | |
54 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
55 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
54 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
55 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
56 | 56 | |
57 | - if( function_exists( 'apcu_store' ) === true && $apc === true ) { |
|
58 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix ); |
|
57 | + if (function_exists('apcu_store') === true && $apc === true) { |
|
58 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix); |
|
59 | 59 | } |
60 | 60 | |
61 | - $translations = $this->container->getParameter( 'aimeos_shop.i18n' ); |
|
61 | + $translations = $this->container->getParameter('aimeos_shop.i18n'); |
|
62 | 62 | |
63 | - if( isset( $translations[$langid] ) ) { |
|
64 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] ); |
|
63 | + if (isset($translations[$langid])) { |
|
64 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->i18n[$langid] = $i18n; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,33 +40,33 @@ discard block |
||
40 | 40 | * @param string $type Configuration type ("frontend" or "backend") |
41 | 41 | * @return \Aimeos\MW\Config\Iface Config object |
42 | 42 | */ |
43 | - public function get( $type = 'frontend' ) |
|
43 | + public function get($type = 'frontend') |
|
44 | 44 | { |
45 | 45 | $configPaths = $this->container->get('aimeos')->get()->getConfigPaths(); |
46 | 46 | |
47 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths ); |
|
47 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $configPaths); |
|
48 | 48 | |
49 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
50 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
49 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
50 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
51 | 51 | |
52 | - if( function_exists( 'apcu_store' ) === true && $apc === true ) { |
|
53 | - $conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix ); |
|
52 | + if (function_exists('apcu_store') === true && $apc === true) { |
|
53 | + $conf = new \Aimeos\MW\Config\Decorator\APC($conf, $prefix); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $local = array( |
57 | - 'admin' => $this->container->getParameter( 'aimeos_shop.admin' ), |
|
58 | - 'client' => $this->container->getParameter( 'aimeos_shop.client' ), |
|
59 | - 'controller' => $this->container->getParameter( 'aimeos_shop.controller' ), |
|
60 | - 'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ), |
|
61 | - 'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ), |
|
62 | - 'resource' => $this->container->getParameter( 'aimeos_shop.resource' ), |
|
57 | + 'admin' => $this->container->getParameter('aimeos_shop.admin'), |
|
58 | + 'client' => $this->container->getParameter('aimeos_shop.client'), |
|
59 | + 'controller' => $this->container->getParameter('aimeos_shop.controller'), |
|
60 | + 'madmin' => $this->container->getParameter('aimeos_shop.madmin'), |
|
61 | + 'mshop' => $this->container->getParameter('aimeos_shop.mshop'), |
|
62 | + 'resource' => $this->container->getParameter('aimeos_shop.resource'), |
|
63 | 63 | ); |
64 | 64 | |
65 | - $config = new \Aimeos\MW\Config\Decorator\Memory( $conf, $local ); |
|
66 | - $settings = $this->container->getParameter( 'aimeos_shop.' . $type ); |
|
65 | + $config = new \Aimeos\MW\Config\Decorator\Memory($conf, $local); |
|
66 | + $settings = $this->container->getParameter('aimeos_shop.'.$type); |
|
67 | 67 | |
68 | - if( $settings !== array() ) { |
|
69 | - $config = new \Aimeos\MW\Config\Decorator\Memory( $config, $settings ); |
|
68 | + if ($settings !== array()) { |
|
69 | + $config = new \Aimeos\MW\Config\Decorator\Memory($config, $settings); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $config; |