@@ -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,23 +51,23 @@ 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(), 'en', '', false ); |
|
65 | - $context->setLocale( $localeItem ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
65 | + $context->setLocale($localeItem); |
|
66 | 66 | |
67 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
67 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
68 | 68 | |
69 | - foreach( $jobs as $jobname ) { |
|
70 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
69 | + foreach ($jobs as $jobname) { |
|
70 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
84 | 84 | |
85 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
86 | - $ctx->setConfig( $conf ); |
|
85 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
86 | + $ctx->setConfig($conf); |
|
87 | 87 | |
88 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
89 | - $locale->setLanguageId( 'en' ); |
|
90 | - $ctx->setLocale( $locale ); |
|
88 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
89 | + $locale->setLanguageId('en'); |
|
90 | + $ctx->setLocale($locale); |
|
91 | 91 | |
92 | - $i18n = new \Aimeos\MW\Translation\Zend2( array(), 'gettext', 'en', array( 'disableNotices' => true ) ); |
|
93 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
92 | + $i18n = new \Aimeos\MW\Translation\Zend2(array(), 'gettext', 'en', array('disableNotices' => true)); |
|
93 | + $ctx->setI18n(array('en' => $i18n)); |
|
94 | 94 | |
95 | 95 | return $ctx; |
96 | 96 | } |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | { |
106 | 106 | $container = $this->getContainer(); |
107 | 107 | $aimeos = $container->get('aimeos')->get(); |
108 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
108 | + $context = $container->get('aimeos_context')->get(false); |
|
109 | 109 | |
110 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
111 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
112 | - $view = $container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths ); |
|
110 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
111 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
112 | + $view = $container->get('aimeos_view')->create($context->getConfig(), $tmplPaths); |
|
113 | 113 | |
114 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
115 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
116 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
114 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
115 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
116 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
117 | 117 | |
118 | - $context->setEditor( 'aimeos:jobs' ); |
|
119 | - $context->setView( $view ); |
|
120 | - $context->setI18n( $i18n ); |
|
118 | + $context->setEditor('aimeos:jobs'); |
|
119 | + $context->setView($view); |
|
120 | + $context->setI18n($i18n); |
|
121 | 121 | |
122 | 122 | return $context; |
123 | 123 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * @param string $site Unique site code |
31 | 31 | * @return Response Generated output |
32 | 32 | */ |
33 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
33 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
34 | 34 | { |
35 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
36 | - return $this->getHtml( $cntl->copy() ); |
|
35 | + $cntl = $this->createClient($request, $site, $resource); |
|
36 | + return $this->getHtml($cntl->copy()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * @param string $site Unique site code |
46 | 46 | * @return Response Generated output |
47 | 47 | */ |
48 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
48 | + public function createAction(Request $request, $resource, $site = 'default') |
|
49 | 49 | { |
50 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
51 | - return $this->getHtml( $cntl->create() ); |
|
50 | + $cntl = $this->createClient($request, $site, $resource); |
|
51 | + return $this->getHtml($cntl->create()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * @param string $site Unique site code |
61 | 61 | * @return Response Generated output |
62 | 62 | */ |
63 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
63 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
64 | 64 | { |
65 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
66 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
65 | + $cntl = $this->createClient($request, $site, $resource); |
|
66 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @param string $site Unique site code |
76 | 76 | * @return Response Generated output |
77 | 77 | */ |
78 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
78 | + public function getAction(Request $request, $resource, $site = 'default') |
|
79 | 79 | { |
80 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
81 | - return $this->getHtml( $cntl->get() ); |
|
80 | + $cntl = $this->createClient($request, $site, $resource); |
|
81 | + return $this->getHtml($cntl->get()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param string $site Unique site code |
91 | 91 | * @return Response Generated output |
92 | 92 | */ |
93 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
93 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
94 | 94 | { |
95 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
96 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
95 | + $cntl = $this->createClient($request, $site, $resource); |
|
96 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | * @param string $site Unique site code |
106 | 106 | * @return Response Generated output |
107 | 107 | */ |
108 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
108 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
109 | 109 | { |
110 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
111 | - return $this->getHtml( $cntl->search() ); |
|
110 | + $cntl = $this->createClient($request, $site, $resource); |
|
111 | + return $this->getHtml($cntl->search()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | * @param string $resource Resource location, e.g. "product" |
121 | 121 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
122 | 122 | */ |
123 | - protected function createClient( Request $request, $site, $resource ) |
|
123 | + protected function createClient(Request $request, $site, $resource) |
|
124 | 124 | { |
125 | - $lang = $request->get( 'lang', 'en' ); |
|
125 | + $lang = $request->get('lang', 'en'); |
|
126 | 126 | |
127 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
128 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
127 | + $aimeos = $this->get('aimeos')->get(); |
|
128 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
129 | 129 | |
130 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
131 | - $context = $this->setLocale( $context, $site, $lang ); |
|
130 | + $context = $this->get('aimeos_context')->get(false); |
|
131 | + $context = $this->setLocale($context, $site, $lang); |
|
132 | 132 | |
133 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
134 | - $context->setView( $view ); |
|
133 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
134 | + $context->setView($view); |
|
135 | 135 | |
136 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
136 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * @param string $content Content from admin client |
144 | 144 | * @return Response View for rendering the output |
145 | 145 | */ |
146 | - protected function getHtml( $content ) |
|
146 | + protected function getHtml($content) |
|
147 | 147 | { |
148 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
149 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
148 | + $version = $this->get('aimeos')->getVersion(); |
|
149 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
150 | 150 | |
151 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
151 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
161 | 161 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
162 | 162 | */ |
163 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
163 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
164 | 164 | { |
165 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
165 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
166 | 166 | |
167 | 167 | try |
168 | 168 | { |
169 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
170 | - $localeItem->setLanguageId( null ); |
|
171 | - $localeItem->setCurrencyId( null ); |
|
169 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
170 | + $localeItem->setLanguageId(null); |
|
171 | + $localeItem->setCurrencyId(null); |
|
172 | 172 | } |
173 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
173 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
174 | 174 | { |
175 | 175 | $localeItem = $localeManager->createItem(); |
176 | 176 | } |
177 | 177 | |
178 | - $context->setLocale( $localeItem ); |
|
179 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
178 | + $context->setLocale($localeItem); |
|
179 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
180 | 180 | |
181 | 181 | return $context; |
182 | 182 | } |
@@ -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 | - ) ); |
|
16 | - $crawler = $client->request( 'GET', '/unittest/extadm/de/0' ); |
|
15 | + )); |
|
16 | + $crawler = $client->request('GET', '/unittest/extadm/de/0'); |
|
17 | 17 | |
18 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
19 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() ); |
|
20 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
18 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
19 | + $this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count()); |
|
20 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,17 +26,17 @@ 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 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
31 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
32 | 32 | |
33 | - $client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
33 | + $client->request('POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
34 | 34 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
35 | 35 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
36 | 36 | ); |
37 | 37 | |
38 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
39 | - $this->assertStringStartsWith( '{', $client->getResponse()->getContent() ); |
|
38 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
39 | + $this->assertStringStartsWith('{', $client->getResponse()->getContent()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $client = static::createClient(array(), array( |
46 | 46 | 'PHP_AUTH_USER' => 'admin', |
47 | 47 | 'PHP_AUTH_PW' => 'adminpass', |
48 | - ) ); |
|
48 | + )); |
|
49 | 49 | |
50 | - $client->request( 'GET', '/unittest/extadm/file' ); |
|
50 | + $client->request('GET', '/unittest/extadm/file'); |
|
51 | 51 | |
52 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
53 | - $this->assertContains( 'Ext.', $client->getResponse()->getContent() ); |
|
52 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
53 | + $this->assertContains('Ext.', $client->getResponse()->getContent()); |
|
54 | 54 | } |
55 | 55 | } |