@@ -27,15 +27,15 @@ |
||
27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
28 | 28 | * @return array List of group codes the user is in |
29 | 29 | */ |
30 | - public function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
30 | + public function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
31 | 31 | { |
32 | 32 | $list = array(); |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
34 | 34 | |
35 | 35 | $search = $manager->createSearch(); |
36 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
36 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
37 | 37 | |
38 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
38 | + foreach ($manager->searchItems($search) as $item) { |
|
39 | 39 | $list[] = $item->getCode(); |
40 | 40 | } |
41 | 41 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param RequestStack $requestStack Current request stack |
33 | 33 | * @param Container $container Container object to access parameters |
34 | 34 | */ |
35 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
35 | + public function __construct(RequestStack $requestStack, Container $container) |
|
36 | 36 | { |
37 | 37 | $this->requestStack = $requestStack; |
38 | 38 | $this->container = $container; |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
46 | 46 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
47 | 47 | */ |
48 | - public function get( \Aimeos\MShop\Context\Item\Iface $context ) |
|
48 | + public function get(\Aimeos\MShop\Context\Item\Iface $context) |
|
49 | 49 | { |
50 | - if( $this->locale === null ) |
|
50 | + if ($this->locale === null) |
|
51 | 51 | { |
52 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
52 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
53 | 53 | $request = $this->requestStack->getMasterRequest(); |
54 | 54 | |
55 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
56 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
57 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
55 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
56 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
57 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
58 | 58 | |
59 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
60 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
59 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
60 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $this->locale; |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
73 | 73 | */ |
74 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
74 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
75 | 75 | { |
76 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
76 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
77 | 77 | |
78 | 78 | try |
79 | 79 | { |
80 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
81 | - $localeItem->setLanguageId( null ); |
|
82 | - $localeItem->setCurrencyId( null ); |
|
80 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
81 | + $localeItem->setLanguageId(null); |
|
82 | + $localeItem->setCurrencyId(null); |
|
83 | 83 | } |
84 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
84 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
85 | 85 | { |
86 | 86 | $localeItem = $localeManager->createItem(); |
87 | 87 | } |
@@ -80,8 +80,7 @@ |
||
80 | 80 | $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
81 | 81 | $localeItem->setLanguageId( null ); |
82 | 82 | $localeItem->setCurrencyId( null ); |
83 | - } |
|
84 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
83 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
85 | 84 | { |
86 | 85 | $localeItem = $localeManager->createItem(); |
87 | 86 | } |
@@ -30,63 +30,63 @@ 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' ), |
|
81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
82 | + 'urlTemplate' => urldecode($adminUrl), |
|
83 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
84 | 84 | 'version' => $aimeos->getVersion(), |
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | 'activeTab' => $tab, |
87 | 87 | ); |
88 | 88 | |
89 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
89 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | * @param Request $request Symfony request object |
97 | 97 | * @return Response JSON RPC message response |
98 | 98 | */ |
99 | - public function doAction( Request $request ) |
|
99 | + public function doAction(Request $request) |
|
100 | 100 | { |
101 | 101 | $csrfProvider = $this->get('security.csrf.token_manager'); |
102 | 102 | |
103 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
104 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
103 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
104 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
108 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
109 | - $context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) ); |
|
110 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, 'default' ) ); |
|
107 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
108 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
109 | + $context->setView($this->get('aimeos_view')->create($context, array())); |
|
110 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, 'default')); |
|
111 | 111 | |
112 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
112 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
113 | 113 | |
114 | - $response = $controller->process( $request->request->all(), $request->getContent() ); |
|
115 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
114 | + $response = $controller->process($request->request->all(), $request->getContent()); |
|
115 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -125,27 +125,27 @@ discard block |
||
125 | 125 | { |
126 | 126 | $contents = ''; |
127 | 127 | $jsFiles = array(); |
128 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
128 | + $aimeos = $this->get('aimeos')->get(); |
|
129 | 129 | |
130 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
130 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
131 | 131 | { |
132 | - foreach( $paths as $path ) |
|
132 | + foreach ($paths as $path) |
|
133 | 133 | { |
134 | - $jsbAbsPath = $base . '/' . $path; |
|
135 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
136 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
134 | + $jsbAbsPath = $base.'/'.$path; |
|
135 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
136 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - foreach( $jsFiles as $file ) |
|
140 | + foreach ($jsFiles as $file) |
|
141 | 141 | { |
142 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
142 | + if (($content = file_get_contents($file)) !== false) { |
|
143 | 143 | $contents .= $content; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $response = new Response( $contents ); |
|
148 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
147 | + $response = new Response($contents); |
|
148 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
149 | 149 | |
150 | 150 | return $response; |
151 | 151 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | { |
161 | 161 | $result = array(); |
162 | 162 | |
163 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
164 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
163 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
164 | + $result[] = array('id' => $id, 'label' => $id); |
|
165 | 165 | } |
166 | 166 | |
167 | - return json_encode( $result ); |
|
167 | + return json_encode($result); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
175 | 175 | * @return string JSON encoded configuration object |
176 | 176 | */ |
177 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
177 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
178 | 178 | { |
179 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
180 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
179 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
180 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -188,16 +188,16 @@ discard block |
||
188 | 188 | * @param string $lang ISO language code like "en" or "en_GB" |
189 | 189 | * @return string JSON encoded translation object |
190 | 190 | */ |
191 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
191 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
192 | 192 | { |
193 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
193 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
194 | 194 | |
195 | 195 | $content = array( |
196 | - 'admin' => $i18n->getAll( 'admin' ), |
|
197 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
196 | + 'admin' => $i18n->getAll('admin'), |
|
197 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
198 | 198 | ); |
199 | 199 | |
200 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
200 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | * @return string JSON encoded site item object |
210 | 210 | * @throws Exception If no site item was found for the code |
211 | 211 | */ |
212 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
212 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
213 | 213 | { |
214 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
214 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
215 | 215 | |
216 | 216 | $criteria = $manager->createSearch(); |
217 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
218 | - $items = $manager->searchItems( $criteria ); |
|
217 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
218 | + $items = $manager->searchItems($criteria); |
|
219 | 219 | |
220 | - if( ( $item = reset( $items ) ) === false ) { |
|
221 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
220 | + if (($item = reset($items)) === false) { |
|
221 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
222 | 222 | } |
223 | 223 | |
224 | - return json_encode( $item->toArray() ); |
|
224 | + return json_encode($item->toArray()); |
|
225 | 225 | } |
226 | 226 | } |
@@ -154,7 +154,7 @@ |
||
154 | 154 | /** |
155 | 155 | * Creates a list of all available translations. |
156 | 156 | * |
157 | - * @return array List of language IDs with labels |
|
157 | + * @return string List of language IDs with labels |
|
158 | 158 | */ |
159 | 159 | protected function getJsonLanguages() |
160 | 160 | { |
@@ -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,11 +186,11 @@ 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 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
191 | + $version = $this->get('aimeos')->getVersion(); |
|
192 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
193 | 193 | |
194 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
194 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
195 | 195 | } |
196 | 196 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
15 | + )); |
|
16 | 16 | |
17 | - $client->request( 'GET', '/unittest/jqadm/file/css' ); |
|
17 | + $client->request('GET', '/unittest/jqadm/file/css'); |
|
18 | 18 | |
19 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
20 | - $this->assertContains( '.aimeos', $client->getResponse()->getContent() ); |
|
19 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
20 | + $this->assertContains('.aimeos', $client->getResponse()->getContent()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | $client = static::createClient(array(), array( |
27 | 27 | 'PHP_AUTH_USER' => 'admin', |
28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | |
31 | - $client->request( 'GET', '/unittest/jqadm/file/js' ); |
|
31 | + $client->request('GET', '/unittest/jqadm/file/js'); |
|
32 | 32 | |
33 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
34 | - $this->assertContains( 'Aimeos = {', $client->getResponse()->getContent() ); |
|
33 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
34 | + $this->assertContains('Aimeos = {', $client->getResponse()->getContent()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | $client = static::createClient(array(), array( |
41 | 41 | 'PHP_AUTH_USER' => 'admin', |
42 | 42 | 'PHP_AUTH_PW' => 'adminpass', |
43 | - ) ); |
|
43 | + )); |
|
44 | 44 | |
45 | - $client->request( 'GET', '/unittest/jqadm/copy/product/0' ); |
|
45 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
46 | 46 | $response = $client->getResponse(); |
47 | 47 | |
48 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
49 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
48 | + $this->assertEquals(200, $response->getStatusCode()); |
|
49 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | $client = static::createClient(array(), array( |
56 | 56 | 'PHP_AUTH_USER' => 'admin', |
57 | 57 | 'PHP_AUTH_PW' => 'adminpass', |
58 | - ) ); |
|
58 | + )); |
|
59 | 59 | |
60 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
60 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
61 | 61 | $response = $client->getResponse(); |
62 | 62 | |
63 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
64 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
63 | + $this->assertEquals(200, $response->getStatusCode()); |
|
64 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $client = static::createClient(array(), array( |
71 | 71 | 'PHP_AUTH_USER' => 'admin', |
72 | 72 | 'PHP_AUTH_PW' => 'adminpass', |
73 | - ) ); |
|
73 | + )); |
|
74 | 74 | |
75 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
75 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
76 | 76 | $response = $client->getResponse(); |
77 | 77 | |
78 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
79 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
78 | + $this->assertEquals(200, $response->getStatusCode()); |
|
79 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $client = static::createClient(array(), array( |
86 | 86 | 'PHP_AUTH_USER' => 'admin', |
87 | 87 | 'PHP_AUTH_PW' => 'adminpass', |
88 | - ) ); |
|
88 | + )); |
|
89 | 89 | |
90 | - $client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
|
90 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
91 | 91 | $response = $client->getResponse(); |
92 | 92 | |
93 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
94 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
93 | + $this->assertEquals(200, $response->getStatusCode()); |
|
94 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | $client = static::createClient(array(), array( |
101 | 101 | 'PHP_AUTH_USER' => 'admin', |
102 | 102 | 'PHP_AUTH_PW' => 'adminpass', |
103 | - ) ); |
|
103 | + )); |
|
104 | 104 | |
105 | - $client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
|
105 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
106 | 106 | $response = $client->getResponse(); |
107 | 107 | |
108 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
109 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
108 | + $this->assertEquals(200, $response->getStatusCode()); |
|
109 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $client = static::createClient(array(), array( |
116 | 116 | 'PHP_AUTH_USER' => 'admin', |
117 | 117 | 'PHP_AUTH_PW' => 'adminpass', |
118 | - ) ); |
|
118 | + )); |
|
119 | 119 | |
120 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
120 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
121 | 121 | $response = $client->getResponse(); |
122 | 122 | |
123 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
124 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
123 | + $this->assertEquals(200, $response->getStatusCode()); |
|
124 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | $client = static::createClient(array(), array( |
131 | 131 | 'PHP_AUTH_USER' => 'admin', |
132 | 132 | 'PHP_AUTH_PW' => 'adminpass', |
133 | - ) ); |
|
133 | + )); |
|
134 | 134 | |
135 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
135 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
136 | 136 | $response = $client->getResponse(); |
137 | 137 | |
138 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
139 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
138 | + $this->assertEquals(200, $response->getStatusCode()); |
|
139 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
140 | 140 | } |
141 | 141 | } |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $names = ''; |
32 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
33 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
34 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
32 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
33 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
34 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
35 | 35 | |
36 | - foreach( $controllers as $key => $controller ) { |
|
37 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
36 | + foreach ($controllers as $key => $controller) { |
|
37 | + $names .= str_pad($key, 30).$controller->getName().PHP_EOL; |
|
38 | 38 | } |
39 | 39 | |
40 | - $this->setName( 'aimeos:jobs' ); |
|
41 | - $this->setDescription( 'Executes the job controllers' ); |
|
42 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
43 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
44 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
40 | + $this->setName('aimeos:jobs'); |
|
41 | + $this->setDescription('Executes the job controllers'); |
|
42 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
43 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
44 | + $this->setHelp("Available jobs are:\n".$names); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,26 +51,26 @@ discard block |
||
51 | 51 | * @param InputInterface $input Input object |
52 | 52 | * @param OutputInterface $output Output object |
53 | 53 | */ |
54 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
54 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
55 | 55 | { |
56 | 56 | $context = $this->getContext(); |
57 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
57 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
58 | 58 | |
59 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
60 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
59 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
60 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
62 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
63 | 63 | { |
64 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
65 | - $localeItem->setLanguageId( null ); |
|
66 | - $localeItem->setCurrencyId( null ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
65 | + $localeItem->setLanguageId(null); |
|
66 | + $localeItem->setCurrencyId(null); |
|
67 | 67 | |
68 | - $context->setLocale( $localeItem ); |
|
68 | + $context->setLocale($localeItem); |
|
69 | 69 | |
70 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
70 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
71 | 71 | |
72 | - foreach( $jobs as $jobname ) { |
|
73 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
72 | + foreach ($jobs as $jobname) { |
|
73 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | { |
86 | 86 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
87 | 87 | |
88 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
89 | - $ctx->setConfig( $conf ); |
|
88 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
89 | + $ctx->setConfig($conf); |
|
90 | 90 | |
91 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
92 | - $locale->setLanguageId( 'en' ); |
|
93 | - $ctx->setLocale( $locale ); |
|
91 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
92 | + $locale->setLanguageId('en'); |
|
93 | + $ctx->setLocale($locale); |
|
94 | 94 | |
95 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
96 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
95 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
96 | + $ctx->setI18n(array('en' => $i18n)); |
|
97 | 97 | |
98 | 98 | return $ctx; |
99 | 99 | } |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | { |
109 | 109 | $container = $this->getContainer(); |
110 | 110 | $aimeos = $container->get('aimeos')->get(); |
111 | - $context = $container->get( 'aimeos_context' )->get( false, 'command' ); |
|
111 | + $context = $container->get('aimeos_context')->get(false, 'command'); |
|
112 | 112 | |
113 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
114 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
115 | - $view = $container->get('aimeos_view')->create( $context, $tmplPaths ); |
|
113 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
114 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
115 | + $view = $container->get('aimeos_view')->create($context, $tmplPaths); |
|
116 | 116 | |
117 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
118 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
119 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
117 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
118 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
119 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
120 | 120 | |
121 | - $context->setEditor( 'aimeos:jobs' ); |
|
122 | - $context->setView( $view ); |
|
123 | - $context->setI18n( $i18n ); |
|
121 | + $context->setEditor('aimeos:jobs'); |
|
122 | + $context->setView($view); |
|
123 | + $context->setI18n($i18n); |
|
124 | 124 | |
125 | 125 | return $context; |
126 | 126 | } |
@@ -29,26 +29,26 @@ |
||
29 | 29 | public function getConfigTreeBuilder() |
30 | 30 | { |
31 | 31 | $treeBuilder = new TreeBuilder(); |
32 | - $rootNode = $treeBuilder->root( 'aimeos_shop' ); |
|
32 | + $rootNode = $treeBuilder->root('aimeos_shop'); |
|
33 | 33 | |
34 | 34 | $rootNode |
35 | 35 | ->children() |
36 | - ->booleanNode('disable_sites')->defaultValue( true )->end() |
|
37 | - ->booleanNode('apc_enable')->defaultValue( false )->end() |
|
38 | - ->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end() |
|
36 | + ->booleanNode('disable_sites')->defaultValue(true)->end() |
|
37 | + ->booleanNode('apc_enable')->defaultValue(false)->end() |
|
38 | + ->scalarNode('apc_prefix')->defaultValue('sf2:')->end() |
|
39 | 39 | ->scalarNode('extdir')->end() |
40 | 40 | ->scalarNode('uploaddir')->end() |
41 | - ->variableNode('admin')->defaultValue( array() )->end() |
|
42 | - ->variableNode('client')->defaultValue( array() )->end() |
|
43 | - ->variableNode('controller')->defaultValue( array() )->end() |
|
44 | - ->variableNode('i18n')->defaultValue( array() )->end() |
|
45 | - ->variableNode('madmin')->defaultValue( array() )->end() |
|
46 | - ->variableNode('mshop')->defaultValue( array() )->end() |
|
47 | - ->variableNode('resource')->defaultValue( array() )->end() |
|
48 | - ->variableNode('page')->defaultValue( array() )->end() |
|
49 | - ->variableNode('backend')->defaultValue( array() )->end() |
|
50 | - ->variableNode('frontend')->defaultValue( array() )->end() |
|
51 | - ->variableNode('command')->defaultValue( array() )->end() |
|
41 | + ->variableNode('admin')->defaultValue(array())->end() |
|
42 | + ->variableNode('client')->defaultValue(array())->end() |
|
43 | + ->variableNode('controller')->defaultValue(array())->end() |
|
44 | + ->variableNode('i18n')->defaultValue(array())->end() |
|
45 | + ->variableNode('madmin')->defaultValue(array())->end() |
|
46 | + ->variableNode('mshop')->defaultValue(array())->end() |
|
47 | + ->variableNode('resource')->defaultValue(array())->end() |
|
48 | + ->variableNode('page')->defaultValue(array())->end() |
|
49 | + ->variableNode('backend')->defaultValue(array())->end() |
|
50 | + ->variableNode('frontend')->defaultValue(array())->end() |
|
51 | + ->variableNode('command')->defaultValue(array())->end() |
|
52 | 52 | ->end() |
53 | 53 | ; |
54 | 54 |
@@ -10,302 +10,302 @@ |
||
10 | 10 | public function testCount() |
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | - $client->request( 'GET', '/unittest/de/EUR/count' ); |
|
13 | + $client->request('GET', '/unittest/de/EUR/count'); |
|
14 | 14 | $content = $client->getResponse()->getContent(); |
15 | 15 | |
16 | - $this->assertContains( '".catalog-filter-count li.cat-item"', $content ); |
|
17 | - $this->assertContains( '".catalog-filter-attribute .attribute-lists li.attr-item"', $content ); |
|
16 | + $this->assertContains('".catalog-filter-count li.cat-item"', $content); |
|
17 | + $this->assertContains('".catalog-filter-attribute .attribute-lists li.attr-item"', $content); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
21 | 21 | public function testFilterSearch() |
22 | 22 | { |
23 | 23 | $client = static::createClient(); |
24 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
24 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
25 | 25 | |
26 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-search' )->count() ); |
|
26 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-search')->count()); |
|
27 | 27 | |
28 | - $form = $crawler->filter( '.catalog-filter-search button' )->form(); |
|
28 | + $form = $crawler->filter('.catalog-filter-search button')->form(); |
|
29 | 29 | $form['f_search'] = 'Unit'; |
30 | - $crawler = $client->submit( $form ); |
|
30 | + $crawler = $client->submit($form); |
|
31 | 31 | |
32 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Test Selection")' )->count() ); |
|
33 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Empty Selection")' )->count() ); |
|
34 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->count() ); |
|
32 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Test Selection")')->count()); |
|
33 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Empty Selection")')->count()); |
|
34 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->count()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testFilterTree() |
39 | 39 | { |
40 | 40 | $client = static::createClient(); |
41 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
41 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
42 | 42 | |
43 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-tree' )->count() ); |
|
43 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-tree')->count()); |
|
44 | 44 | |
45 | - $link = $crawler->filter( '.catalog-filter-tree a.cat-item' )->link(); |
|
46 | - $crawler = $client->click( $link ); |
|
45 | + $link = $crawler->filter('.catalog-filter-tree a.cat-item')->link(); |
|
46 | + $crawler = $client->click($link); |
|
47 | 47 | |
48 | - $link = $crawler->filter( '.catalog-filter-tree .categories a.cat-item' )->link(); |
|
49 | - $crawler = $client->click( $link ); |
|
48 | + $link = $crawler->filter('.catalog-filter-tree .categories a.cat-item')->link(); |
|
49 | + $crawler = $client->click($link); |
|
50 | 50 | |
51 | - $link = $crawler->filter( '.catalog-filter-tree .coffee a.cat-item' )->link(); |
|
52 | - $crawler = $client->click( $link ); |
|
51 | + $link = $crawler->filter('.catalog-filter-tree .coffee a.cat-item')->link(); |
|
52 | + $crawler = $client->click($link); |
|
53 | 53 | |
54 | - $this->assertEquals( 3, $crawler->filter( '.catalog-stage-breadcrumb li' )->count() ); |
|
55 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-promo .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
54 | + $this->assertEquals(3, $crawler->filter('.catalog-stage-breadcrumb li')->count()); |
|
55 | + $this->assertEquals(1, $crawler->filter('.catalog-list-promo .product a:contains("Cafe Noire Expresso")')->count()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | 59 | public function testFilterAttribute() |
60 | 60 | { |
61 | 61 | $client = static::createClient(); |
62 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
62 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
63 | 63 | |
64 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-attribute' )->count() ); |
|
64 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-attribute')->count()); |
|
65 | 65 | |
66 | - $nodes = $crawler->filter( '.catalog-filter-attribute .attr-size span:contains("XS")' ); |
|
67 | - $id = $nodes->parents()->filter( '.attr-item' )->attr( 'data-id'); |
|
66 | + $nodes = $crawler->filter('.catalog-filter-attribute .attr-size span:contains("XS")'); |
|
67 | + $id = $nodes->parents()->filter('.attr-item')->attr('data-id'); |
|
68 | 68 | |
69 | - $form = $crawler->filter( '.catalog-filter .btn-action' )->form(); |
|
69 | + $form = $crawler->filter('.catalog-filter .btn-action')->form(); |
|
70 | 70 | $values = $form->getPhpValues(); |
71 | - $values['f_attrid'] = array( $id ); |
|
72 | - $crawler = $client->request( $form->getMethod(), $form->getUri(), $values, $form->getPhpFiles() ); |
|
71 | + $values['f_attrid'] = array($id); |
|
72 | + $crawler = $client->request($form->getMethod(), $form->getUri(), $values, $form->getPhpFiles()); |
|
73 | 73 | |
74 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
75 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Cappuccino")' )->count() ); |
|
74 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->count()); |
|
75 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Cappuccino")')->count()); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | public function testStageBreadcrumb() |
80 | 80 | { |
81 | 81 | $client = static::createClient(); |
82 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
82 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
83 | 83 | |
84 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
85 | - $crawler = $client->click( $link ); |
|
84 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
85 | + $crawler = $client->click($link); |
|
86 | 86 | |
87 | - $this->assertEquals( 1, $crawler->filter( '.catalog-stage-breadcrumb li' )->count() ); |
|
87 | + $this->assertEquals(1, $crawler->filter('.catalog-stage-breadcrumb li')->count()); |
|
88 | 88 | |
89 | - $link = $crawler->filter( '.catalog-stage-breadcrumb a' )->link(); |
|
90 | - $crawler = $client->click( $link ); |
|
89 | + $link = $crawler->filter('.catalog-stage-breadcrumb a')->link(); |
|
90 | + $crawler = $client->click($link); |
|
91 | 91 | |
92 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list' )->count() ); |
|
93 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
94 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Cappuccino")' )->count() ); |
|
92 | + $this->assertEquals(1, $crawler->filter('.catalog-list')->count()); |
|
93 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->count()); |
|
94 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Cappuccino")')->count()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testStageNavigator() |
99 | 99 | { |
100 | 100 | $client = static::createClient(); |
101 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
101 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
102 | 102 | |
103 | - $link = $crawler->filter( '.catalog-list .pagination .option-name' )->link(); |
|
104 | - $crawler = $client->click( $link ); |
|
103 | + $link = $crawler->filter('.catalog-list .pagination .option-name')->link(); |
|
104 | + $crawler = $client->click($link); |
|
105 | 105 | |
106 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
107 | - $crawler = $client->click( $link ); |
|
106 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
107 | + $crawler = $client->click($link); |
|
108 | 108 | |
109 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
110 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Bundle")' )->count() ); |
|
109 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
110 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Bundle")')->count()); |
|
111 | 111 | |
112 | - $link = $crawler->filter( '.catalog-stage-navigator a.next' )->link(); |
|
113 | - $crawler = $client->click( $link ); |
|
112 | + $link = $crawler->filter('.catalog-stage-navigator a.next')->link(); |
|
113 | + $crawler = $client->click($link); |
|
114 | 114 | |
115 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
116 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Empty Selection")' )->count() ); |
|
115 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
116 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Empty Selection")')->count()); |
|
117 | 117 | |
118 | - $link = $crawler->filter( '.catalog-stage-navigator a.prev' )->link(); |
|
119 | - $crawler = $client->click( $link ); |
|
118 | + $link = $crawler->filter('.catalog-stage-navigator a.prev')->link(); |
|
119 | + $crawler = $client->click($link); |
|
120 | 120 | |
121 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
122 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Bundle")' )->count() ); |
|
121 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
122 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Bundle")')->count()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | public function testListSortationName() |
127 | 127 | { |
128 | 128 | $client = static::createClient(); |
129 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
129 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
130 | 130 | |
131 | - $link = $crawler->filter( '.catalog-list .pagination .option-name' )->link(); |
|
132 | - $crawler = $client->click( $link ); |
|
131 | + $link = $crawler->filter('.catalog-list .pagination .option-name')->link(); |
|
132 | + $crawler = $client->click($link); |
|
133 | 133 | |
134 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
135 | - $this->assertEquals( 1, $products->eq( 1 )->filter( 'h2:contains("Unittest: Bundle")' )->count() ); |
|
136 | - $this->assertEquals( 1, $products->eq( 2 )->filter( 'h2:contains("Unittest: Empty Selection")' )->count() ); |
|
134 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
135 | + $this->assertEquals(1, $products->eq(1)->filter('h2:contains("Unittest: Bundle")')->count()); |
|
136 | + $this->assertEquals(1, $products->eq(2)->filter('h2:contains("Unittest: Empty Selection")')->count()); |
|
137 | 137 | |
138 | - $link = $crawler->filter( '.catalog-list .pagination .option-name' )->link(); |
|
139 | - $crawler = $client->click( $link ); |
|
138 | + $link = $crawler->filter('.catalog-list .pagination .option-name')->link(); |
|
139 | + $crawler = $client->click($link); |
|
140 | 140 | |
141 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
141 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
142 | 142 | $count = $products->count(); |
143 | 143 | |
144 | - $this->assertGreaterThan( 2, $count ); |
|
145 | - $this->assertEquals( 1, $products->eq( $count - 3 )->filter( 'h2:contains("Unittest: Empty Selection")' )->count() ); |
|
146 | - $this->assertEquals( 1, $products->eq( $count - 2 )->filter( 'h2:contains("Unittest: Bundle")' )->count() ); |
|
144 | + $this->assertGreaterThan(2, $count); |
|
145 | + $this->assertEquals(1, $products->eq($count - 3)->filter('h2:contains("Unittest: Empty Selection")')->count()); |
|
146 | + $this->assertEquals(1, $products->eq($count - 2)->filter('h2:contains("Unittest: Bundle")')->count()); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | public function testListSortationPrice() |
151 | 151 | { |
152 | 152 | $client = static::createClient(); |
153 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
153 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
154 | 154 | |
155 | - $link = $crawler->filter( '.catalog-list .pagination .option-price' )->link(); |
|
156 | - $crawler = $client->click( $link ); |
|
155 | + $link = $crawler->filter('.catalog-list .pagination .option-price')->link(); |
|
156 | + $crawler = $client->click($link); |
|
157 | 157 | |
158 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
158 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
159 | 159 | $count = $products->count(); |
160 | 160 | |
161 | - $this->assertGreaterThan( 2, $count ); |
|
162 | - $this->assertEquals( 1, $products->eq( $count - 2 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
163 | - $this->assertEquals( 1, $products->eq( $count - 1 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
161 | + $this->assertGreaterThan(2, $count); |
|
162 | + $this->assertEquals(1, $products->eq($count - 2)->filter('.value:contains("600.00 €")')->count()); |
|
163 | + $this->assertEquals(1, $products->eq($count - 1)->filter('.value:contains("600.00 €")')->count()); |
|
164 | 164 | |
165 | - $link = $crawler->filter( '.catalog-list .pagination .option-price' )->link(); |
|
166 | - $crawler = $client->click( $link ); |
|
165 | + $link = $crawler->filter('.catalog-list .pagination .option-price')->link(); |
|
166 | + $crawler = $client->click($link); |
|
167 | 167 | |
168 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
169 | - $this->assertEquals( 1, $products->eq( 0 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
170 | - $this->assertEquals( 1, $products->eq( 1 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
168 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
169 | + $this->assertEquals(1, $products->eq(0)->filter('.value:contains("600.00 €")')->count()); |
|
170 | + $this->assertEquals(1, $products->eq(1)->filter('.value:contains("600.00 €")')->count()); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | 174 | public function testDetailPinned() |
175 | 175 | { |
176 | 176 | $client = static::createClient(); |
177 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
177 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
178 | 178 | |
179 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
180 | - $crawler = $client->click( $link ); |
|
179 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
180 | + $crawler = $client->click($link); |
|
181 | 181 | |
182 | - $link = $crawler->filter( '.catalog-detail a.actions-button-pin' )->link(); |
|
183 | - $crawler = $client->click( $link ); |
|
182 | + $link = $crawler->filter('.catalog-detail a.actions-button-pin')->link(); |
|
183 | + $crawler = $client->click($link); |
|
184 | 184 | |
185 | - $this->assertEquals( 1, $crawler->filter( '.catalog-session-pinned .pinned-item' )->count() ); |
|
185 | + $this->assertEquals(1, $crawler->filter('.catalog-session-pinned .pinned-item')->count()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
189 | 189 | public function testDetailLastSeen() |
190 | 190 | { |
191 | 191 | $client = static::createClient(); |
192 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
192 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
193 | 193 | |
194 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
195 | - $crawler = $client->click( $link ); |
|
194 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
195 | + $crawler = $client->click($link); |
|
196 | 196 | |
197 | - $this->assertEquals( 1, $crawler->filter( '.catalog-session-seen .seen-item' )->count() ); |
|
197 | + $this->assertEquals(1, $crawler->filter('.catalog-session-seen .seen-item')->count()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
201 | 201 | public function testSuggest() |
202 | 202 | { |
203 | 203 | $client = static::createClient(); |
204 | - $client->request( 'GET', '/unittest/de/EUR/suggest', array( 'f_search' => 'unit' ) ); |
|
204 | + $client->request('GET', '/unittest/de/EUR/suggest', array('f_search' => 'unit')); |
|
205 | 205 | $content = $client->getResponse()->getContent(); |
206 | 206 | |
207 | - $this->assertStringStartsWith( '[{', $content ); |
|
207 | + $this->assertStringStartsWith('[{', $content); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | public function testStock() |
212 | 212 | { |
213 | 213 | $client = static::createClient(); |
214 | - $client->request( 'GET', '/unittest/de/EUR/stock' ); |
|
214 | + $client->request('GET', '/unittest/de/EUR/stock'); |
|
215 | 215 | $content = $client->getResponse()->getContent(); |
216 | 216 | |
217 | - $this->assertContains( '.aimeos .product .stock', $content ); |
|
218 | - $this->assertContains( '.aimeos .catalog-detail-basket', $content ); |
|
217 | + $this->assertContains('.aimeos .product .stock', $content); |
|
218 | + $this->assertContains('.aimeos .catalog-detail-basket', $content); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
222 | 222 | public function testCountComponent() |
223 | 223 | { |
224 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
225 | - ->setMethods( array( 'getOutput' ) ) |
|
224 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
225 | + ->setMethods(array('getOutput')) |
|
226 | 226 | ->disableOriginalConstructor() |
227 | 227 | ->getMock(); |
228 | 228 | |
229 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
229 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
230 | 230 | |
231 | - $this->assertEquals( 'test', $mock->countComponentAction() ); |
|
231 | + $this->assertEquals('test', $mock->countComponentAction()); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
235 | 235 | public function testDetailComponent() |
236 | 236 | { |
237 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
238 | - ->setMethods( array( 'getOutput' ) ) |
|
237 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
238 | + ->setMethods(array('getOutput')) |
|
239 | 239 | ->disableOriginalConstructor() |
240 | 240 | ->getMock(); |
241 | 241 | |
242 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
242 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
243 | 243 | |
244 | - $this->assertEquals( 'test', $mock->detailComponentAction() ); |
|
244 | + $this->assertEquals('test', $mock->detailComponentAction()); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
248 | 248 | public function testFilterComponent() |
249 | 249 | { |
250 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
251 | - ->setMethods( array( 'getOutput' ) ) |
|
250 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
251 | + ->setMethods(array('getOutput')) |
|
252 | 252 | ->disableOriginalConstructor() |
253 | 253 | ->getMock(); |
254 | 254 | |
255 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
255 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
256 | 256 | |
257 | - $this->assertEquals( 'test', $mock->filterComponentAction() ); |
|
257 | + $this->assertEquals('test', $mock->filterComponentAction()); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | 261 | public function testListComponent() |
262 | 262 | { |
263 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
264 | - ->setMethods( array( 'getOutput' ) ) |
|
263 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
264 | + ->setMethods(array('getOutput')) |
|
265 | 265 | ->disableOriginalConstructor() |
266 | 266 | ->getMock(); |
267 | 267 | |
268 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
268 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
269 | 269 | |
270 | - $this->assertEquals( 'test', $mock->listComponentAction() ); |
|
270 | + $this->assertEquals('test', $mock->listComponentAction()); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
274 | 274 | public function testSessionComponent() |
275 | 275 | { |
276 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
277 | - ->setMethods( array( 'getOutput' ) ) |
|
276 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
277 | + ->setMethods(array('getOutput')) |
|
278 | 278 | ->disableOriginalConstructor() |
279 | 279 | ->getMock(); |
280 | 280 | |
281 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
281 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
282 | 282 | |
283 | - $this->assertEquals( 'test', $mock->sessionComponentAction() ); |
|
283 | + $this->assertEquals('test', $mock->sessionComponentAction()); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | 287 | public function testStageComponent() |
288 | 288 | { |
289 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
290 | - ->setMethods( array( 'getOutput' ) ) |
|
289 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
290 | + ->setMethods(array('getOutput')) |
|
291 | 291 | ->disableOriginalConstructor() |
292 | 292 | ->getMock(); |
293 | 293 | |
294 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
294 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
295 | 295 | |
296 | - $this->assertEquals( 'test', $mock->stageComponentAction() ); |
|
296 | + $this->assertEquals('test', $mock->stageComponentAction()); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
300 | 300 | public function testStockComponent() |
301 | 301 | { |
302 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\CatalogController' ) |
|
303 | - ->setMethods( array( 'getOutput' ) ) |
|
302 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\CatalogController') |
|
303 | + ->setMethods(array('getOutput')) |
|
304 | 304 | ->disableOriginalConstructor() |
305 | 305 | ->getMock(); |
306 | 306 | |
307 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
307 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
308 | 308 | |
309 | - $this->assertEquals( 'test', $mock->stockComponentAction() ); |
|
309 | + $this->assertEquals('test', $mock->stockComponentAction()); |
|
310 | 310 | } |
311 | 311 | } |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function configure() |
31 | 31 | { |
32 | - $this->setName( 'aimeos:setup'); |
|
33 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
34 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
35 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
36 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
37 | - $this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' ); |
|
38 | - $this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null ); |
|
32 | + $this->setName('aimeos:setup'); |
|
33 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
34 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
35 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
36 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
37 | + $this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate'); |
|
38 | + $this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -45,41 +45,41 @@ discard block |
||
45 | 45 | * @param InputInterface $input Input object |
46 | 46 | * @param OutputInterface $output Output object |
47 | 47 | */ |
48 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
48 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
49 | 49 | { |
50 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
51 | - $ctx->setEditor( 'aimeos:setup' ); |
|
50 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
51 | + $ctx->setEditor('aimeos:setup'); |
|
52 | 52 | |
53 | 53 | $config = $ctx->getConfig(); |
54 | - $site = $input->getArgument( 'site' ); |
|
55 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
54 | + $site = $input->getArgument('site'); |
|
55 | + $tplsite = $input->getArgument('tplsite'); |
|
56 | 56 | |
57 | - $config->set( 'setup/site', $site ); |
|
58 | - $dbconfig = $this->getDbConfig( $config ); |
|
59 | - $this->setOptions( $config, $input ); |
|
57 | + $config->set('setup/site', $site); |
|
58 | + $dbconfig = $this->getDbConfig($config); |
|
59 | + $this->setOptions($config, $input); |
|
60 | 60 | |
61 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
62 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
61 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
62 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
63 | 63 | |
64 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
64 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
65 | 65 | |
66 | - if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) { |
|
67 | - $task = reset( $task ); |
|
66 | + if (($task = $input->getOption('task')) && is_array($task)) { |
|
67 | + $task = reset($task); |
|
68 | 68 | } |
69 | 69 | |
70 | - switch( $input->getOption( 'action' ) ) |
|
70 | + switch ($input->getOption('action')) |
|
71 | 71 | { |
72 | 72 | case 'migrate': |
73 | - $manager->migrate( $task ); |
|
73 | + $manager->migrate($task); |
|
74 | 74 | break; |
75 | 75 | case 'rollback': |
76 | - $manager->rollback( $task ); |
|
76 | + $manager->rollback($task); |
|
77 | 77 | break; |
78 | 78 | case 'clean': |
79 | - $manager->clean( $task ); |
|
79 | + $manager->clean($task); |
|
80 | 80 | break; |
81 | 81 | default: |
82 | - throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) ); |
|
82 | + throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action'))); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * @param \Aimeos\MW\Config\Iface $conf Config object |
91 | 91 | * @return array Multi-dimensional associative list of database configuration parameters |
92 | 92 | */ |
93 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
93 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
94 | 94 | { |
95 | - $dbconfig = $conf->get( 'resource', array() ); |
|
95 | + $dbconfig = $conf->get('resource', array()); |
|
96 | 96 | |
97 | - foreach( $dbconfig as $rname => $dbconf ) |
|
97 | + foreach ($dbconfig as $rname => $dbconf) |
|
98 | 98 | { |
99 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
100 | - unset( $dbconfig[$rname] ); |
|
99 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
100 | + unset($dbconfig[$rname]); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * @param array Associative list of database configurations |
114 | 114 | * @throws \RuntimeException If the format of the options is invalid |
115 | 115 | */ |
116 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
116 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
117 | 117 | { |
118 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
118 | + foreach ((array) $input->getOption('option') as $option) |
|
119 | 119 | { |
120 | - list( $name, $value ) = explode( ':', $option ); |
|
121 | - $conf->set( str_replace( '\\', '/', $name ), $value ); |
|
120 | + list($name, $value) = explode(':', $option); |
|
121 | + $conf->set(str_replace('\\', '/', $name), $value); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |