@@ -25,15 +25,15 @@ |
||
25 | 25 | * @param InputInterface $input Input object |
26 | 26 | * @return \Aimeos\MShop\Locale\Item\Site\Interface[] List of site items |
27 | 27 | */ |
28 | - protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, InputInterface $input ) |
|
28 | + protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, InputInterface $input) |
|
29 | 29 | { |
30 | - $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'site' ); |
|
30 | + $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('site'); |
|
31 | 31 | $search = $manager->createSearch(); |
32 | 32 | |
33 | - if( ( $codes = (string) $input->getArgument( 'site' ) ) !== '' ) { |
|
34 | - $search->setConditions( $search->compare( '==', 'locale.site.code', explode( ' ', $codes ) ) ); |
|
33 | + if (($codes = (string) $input->getArgument('site')) !== '') { |
|
34 | + $search->setConditions($search->compare('==', 'locale.site.code', explode(' ', $codes))); |
|
35 | 35 | } |
36 | 36 | |
37 | - return $manager->searchItems( $search ); |
|
37 | + return $manager->searchItems($search); |
|
38 | 38 | } |
39 | 39 | } |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | protected function configure() |
25 | 25 | { |
26 | - $this->setName( 'aimeos:cache' ); |
|
27 | - $this->setDescription( 'Clears the content cache' ); |
|
28 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ); |
|
26 | + $this->setName('aimeos:cache'); |
|
27 | + $this->setDescription('Clears the content cache'); |
|
28 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -35,26 +35,26 @@ discard block |
||
35 | 35 | * @param InputInterface $input Input object |
36 | 36 | * @param OutputInterface $output Output object |
37 | 37 | */ |
38 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
38 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
39 | 39 | { |
40 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false ); |
|
41 | - $context->setEditor( 'aimeos:cache' ); |
|
40 | + $context = $this->getContainer()->get('aimeos_context')->get(false); |
|
41 | + $context->setEditor('aimeos:cache'); |
|
42 | 42 | |
43 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
43 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
44 | 44 | |
45 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
45 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
46 | 46 | { |
47 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
47 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
48 | 48 | |
49 | 49 | $lcontext = clone $context; |
50 | - $lcontext->setLocale( $localeItem ); |
|
50 | + $lcontext->setLocale($localeItem); |
|
51 | 51 | |
52 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
53 | - $lcontext->setCache( $cache ); |
|
52 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
53 | + $lcontext->setCache($cache); |
|
54 | 54 | |
55 | - $output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) ); |
|
55 | + $output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode())); |
|
56 | 56 | |
57 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
57 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | protected function configure() |
25 | 25 | { |
26 | 26 | $names = ''; |
27 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
28 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
29 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
27 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
28 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
29 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
30 | 30 | |
31 | - foreach( $controllers as $key => $controller ) { |
|
32 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
31 | + foreach ($controllers as $key => $controller) { |
|
32 | + $names .= str_pad($key, 30) . $controller->getName() . PHP_EOL; |
|
33 | 33 | } |
34 | 34 | |
35 | - $this->setName( 'aimeos:jobs' ); |
|
36 | - $this->setDescription( 'Executes the job controllers' ); |
|
37 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
38 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
39 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
35 | + $this->setName('aimeos:jobs'); |
|
36 | + $this->setDescription('Executes the job controllers'); |
|
37 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
38 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
39 | + $this->setHelp("Available jobs are:\n" . $names); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * @param InputInterface $input Input object |
47 | 47 | * @param OutputInterface $output Output object |
48 | 48 | */ |
49 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
49 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
50 | 50 | { |
51 | 51 | $context = $this->getContext(); |
52 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
52 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
53 | 53 | |
54 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
55 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
54 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
55 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
56 | 56 | |
57 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
57 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
58 | 58 | { |
59 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
60 | - $context->setLocale( $localeItem ); |
|
59 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
60 | + $context->setLocale($localeItem); |
|
61 | 61 | |
62 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
62 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
63 | 63 | |
64 | - foreach( $jobs as $jobname ) { |
|
65 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
64 | + foreach ($jobs as $jobname) { |
|
65 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | { |
78 | 78 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
79 | 79 | |
80 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
81 | - $ctx->setConfig( $conf ); |
|
80 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
81 | + $ctx->setConfig($conf); |
|
82 | 82 | |
83 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
84 | - $locale->setLanguageId( 'en' ); |
|
85 | - $ctx->setLocale( $locale ); |
|
83 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
84 | + $locale->setLanguageId('en'); |
|
85 | + $ctx->setLocale($locale); |
|
86 | 86 | |
87 | - $i18n = new \Aimeos\MW\Translation\Zend2( array(), 'gettext', 'en', array( 'disableNotices' => true ) ); |
|
88 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
87 | + $i18n = new \Aimeos\MW\Translation\Zend2(array(), 'gettext', 'en', array('disableNotices' => true)); |
|
88 | + $ctx->setI18n(array('en' => $i18n)); |
|
89 | 89 | |
90 | 90 | return $ctx; |
91 | 91 | } |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | protected function getContext() |
100 | 100 | { |
101 | 101 | $container = $this->getContainer(); |
102 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
102 | + $context = $container->get('aimeos_context')->get(false); |
|
103 | 103 | |
104 | - $tmplPaths = $container->get('aimeos')->get()->getCustomPaths( 'controller/jobs/layouts' ); |
|
105 | - $view = $container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths ); |
|
104 | + $tmplPaths = $container->get('aimeos')->get()->getCustomPaths('controller/jobs/layouts'); |
|
105 | + $view = $container->get('aimeos_view')->create($context->getConfig(), $tmplPaths); |
|
106 | 106 | |
107 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
108 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
109 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
107 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
108 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
109 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
110 | 110 | |
111 | - $context->setEditor( 'aimeos:jobs' ); |
|
112 | - $context->setView( $view ); |
|
113 | - $context->setI18n( $i18n ); |
|
111 | + $context->setEditor('aimeos:jobs'); |
|
112 | + $context->setView($view); |
|
113 | + $context->setI18n($i18n); |
|
114 | 114 | |
115 | 115 | return $context; |
116 | 116 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\JobsCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\JobsCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:jobs' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild' ) ); |
|
20 | + $command = $application->find('aimeos:jobs'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\CacheCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\CacheCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:cache' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) ); |
|
20 | + $command = $application->find('aimeos:cache'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getRoles() |
211 | 211 | { |
212 | - return array( 'ROLE_USER' ); |
|
212 | + return array('ROLE_USER'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function serialize() |
228 | 228 | { |
229 | - return serialize( array( |
|
229 | + return serialize(array( |
|
230 | 230 | $this->id, |
231 | 231 | $this->username, |
232 | 232 | $this->password, |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @see \Serializable::unserialize() |
239 | 239 | */ |
240 | - public function unserialize( $serialized ) |
|
240 | + public function unserialize($serialized) |
|
241 | 241 | { |
242 | 242 | list ( |
243 | 243 | $this->id, |
244 | 244 | $this->username, |
245 | 245 | $this->password, |
246 | - ) = unserialize( $serialized ); |
|
246 | + ) = unserialize($serialized); |
|
247 | 247 | } |
248 | 248 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getSalutation() |
211 | 211 | { |
212 | - return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
|
212 | + return (isset($this->salutation) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setSalutation($salutation) |
222 | 222 | { |
223 | - switch( $salutation ) |
|
223 | + switch ($salutation) |
|
224 | 224 | { |
225 | 225 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
226 | 226 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
230 | 230 | break; |
231 | 231 | default: |
232 | - throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
|
232 | + throw new \Exception(sprintf('Address salutation "%1$s" is unknown', $value)); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->salutation = (string) $salutation; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function setCountryId($countryid) |
443 | 443 | { |
444 | - $this->countryid = strtoupper( (string) $countryid ); |
|
444 | + $this->countryid = strtoupper((string) $countryid); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function setLanguageId($langid) |
465 | 465 | { |
466 | - $this->langid = strtolower( (string) $langid ); |
|
466 | + $this->langid = strtolower((string) $langid); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | { |
543 | 543 | $pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
544 | 544 | |
545 | - if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
|
546 | - throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
|
545 | + if ($website !== '' && preg_match($pattern, $website) !== 1) { |
|
546 | + throw new \Exception(sprintf('Invalid web site URL "%1$s"', $website)); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | $this->website = (string) $website; |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | * @param string $classname Name of the setup task class |
26 | 26 | * @return boolean True if class is found, false if not |
27 | 27 | */ |
28 | - public static function autoload( $classname ) |
|
28 | + public static function autoload($classname) |
|
29 | 29 | { |
30 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
30 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
31 | 31 | { |
32 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
33 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
32 | + $fileName = substr($classname, 21) . '.php'; |
|
33 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
34 | 34 | |
35 | - foreach( $paths as $path ) |
|
35 | + foreach ($paths as $path) |
|
36 | 36 | { |
37 | 37 | $file = $path . DIRECTORY_SEPARATOR . $fileName; |
38 | 38 | |
39 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
39 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
40 | 40 | return true; |
41 | 41 | } |
42 | 42 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | protected function configure() |
53 | 53 | { |
54 | - $this->setName( 'aimeos:setup'); |
|
55 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
56 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
57 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
58 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
54 | + $this->setName('aimeos:setup'); |
|
55 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
56 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
57 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
58 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,35 +65,35 @@ discard block |
||
65 | 65 | * @param InputInterface $input Input object |
66 | 66 | * @param OutputInterface $output Output object |
67 | 67 | */ |
68 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
68 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
69 | 69 | { |
70 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false ); |
|
71 | - $ctx->setEditor( 'aimeos:setup' ); |
|
70 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false); |
|
71 | + $ctx->setEditor('aimeos:setup'); |
|
72 | 72 | |
73 | 73 | $config = $ctx->getConfig(); |
74 | - $site = $input->getArgument( 'site' ); |
|
75 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
74 | + $site = $input->getArgument('site'); |
|
75 | + $tplsite = $input->getArgument('tplsite'); |
|
76 | 76 | |
77 | - $config->set( 'setup/site', $site ); |
|
78 | - $dbconfig = $this->getDbConfig( $config ); |
|
79 | - $this->setOptions( $config, $input ); |
|
77 | + $config->set('setup/site', $site); |
|
78 | + $dbconfig = $this->getDbConfig($config); |
|
79 | + $this->setOptions($config, $input); |
|
80 | 80 | |
81 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
81 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
82 | 82 | |
83 | 83 | $includePaths = $taskPaths; |
84 | 84 | $includePaths[] = get_include_path(); |
85 | 85 | |
86 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
87 | - throw new \Exception( 'Unable to extend include path' ); |
|
86 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
87 | + throw new \Exception('Unable to extend include path'); |
|
88 | 88 | } |
89 | 89 | |
90 | - spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true ); |
|
90 | + spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true); |
|
91 | 91 | |
92 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
92 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
93 | 93 | |
94 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
94 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
95 | 95 | |
96 | - $manager->run( 'mysql' ); |
|
96 | + $manager->run('mysql'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * @param \Aimeos\MW\Config\Iface $conf Config object |
104 | 104 | * @return array Multi-dimensional associative list of database configuration parameters |
105 | 105 | */ |
106 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
106 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
107 | 107 | { |
108 | - $dbconfig = $conf->get( 'resource', array() ); |
|
108 | + $dbconfig = $conf->get('resource', array()); |
|
109 | 109 | |
110 | - foreach( $dbconfig as $rname => $dbconf ) |
|
110 | + foreach ($dbconfig as $rname => $dbconf) |
|
111 | 111 | { |
112 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
113 | - unset( $dbconfig[$rname] ); |
|
112 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
113 | + unset($dbconfig[$rname]); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * @param array Associative list of database configurations |
127 | 127 | * @throws \RuntimeException If the format of the options is invalid |
128 | 128 | */ |
129 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
129 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
130 | 130 | { |
131 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
131 | + foreach ((array) $input->getOption('option') as $option) |
|
132 | 132 | { |
133 | - list( $name, $value ) = explode( ':', $option ); |
|
134 | - $conf->set( $name, $value ); |
|
133 | + list($name, $value) = explode(':', $option); |
|
134 | + $conf->set($name, $value); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -12,29 +12,29 @@ 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 | 17 | |
18 | - $client->request( 'OPTIONS', '/unittest/jsonadm/product' ); |
|
18 | + $client->request('OPTIONS', '/unittest/jsonadm/product'); |
|
19 | 19 | $response = $client->getResponse(); |
20 | 20 | |
21 | - $json = json_decode( $response->getContent(), true ); |
|
21 | + $json = json_decode($response->getContent(), true); |
|
22 | 22 | |
23 | - $this->assertNotNull( $json ); |
|
24 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
25 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
26 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
23 | + $this->assertNotNull($json); |
|
24 | + $this->assertEquals(200, $response->getStatusCode()); |
|
25 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
26 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
27 | 27 | |
28 | 28 | |
29 | - $client->request( 'OPTIONS', '/unittest/jsonadm' ); |
|
29 | + $client->request('OPTIONS', '/unittest/jsonadm'); |
|
30 | 30 | $response = $client->getResponse(); |
31 | 31 | |
32 | - $json = json_decode( $response->getContent(), true ); |
|
32 | + $json = json_decode($response->getContent(), true); |
|
33 | 33 | |
34 | - $this->assertNotNull( $json ); |
|
35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
36 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
37 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
34 | + $this->assertNotNull($json); |
|
35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
36 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
37 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,62 +43,62 @@ discard block |
||
43 | 43 | $client = static::createClient(array(), array( |
44 | 44 | 'PHP_AUTH_USER' => 'admin', |
45 | 45 | 'PHP_AUTH_PW' => 'adminpass', |
46 | - ) ); |
|
46 | + )); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}}'; |
50 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
50 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
51 | 51 | $response = $client->getResponse(); |
52 | 52 | |
53 | - $json = json_decode( $response->getContent(), true ); |
|
53 | + $json = json_decode($response->getContent(), true); |
|
54 | 54 | |
55 | - $this->assertNotNull( $json ); |
|
56 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
57 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
58 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
59 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
60 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
55 | + $this->assertNotNull($json); |
|
56 | + $this->assertEquals(201, $response->getStatusCode()); |
|
57 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
58 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.code']); |
|
59 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.label']); |
|
60 | + $this->assertEquals(1, $json['meta']['total']); |
|
61 | 61 | |
62 | 62 | $id = $json['data']['attributes']['product.stock.warehouse.id']; |
63 | 63 | |
64 | 64 | |
65 | 65 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony2"}}}'; |
66 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content ); |
|
66 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content); |
|
67 | 67 | $response = $client->getResponse(); |
68 | 68 | |
69 | - $json = json_decode( $response->getContent(), true ); |
|
69 | + $json = json_decode($response->getContent(), true); |
|
70 | 70 | |
71 | - $this->assertNotNull( $json ); |
|
72 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
73 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
74 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
75 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
76 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
77 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
71 | + $this->assertNotNull($json); |
|
72 | + $this->assertEquals(200, $response->getStatusCode()); |
|
73 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
74 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
75 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
76 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
77 | + $this->assertEquals(1, $json['meta']['total']); |
|
78 | 78 | |
79 | 79 | |
80 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
80 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
81 | 81 | $response = $client->getResponse(); |
82 | 82 | |
83 | - $json = json_decode( $response->getContent(), true ); |
|
83 | + $json = json_decode($response->getContent(), true); |
|
84 | 84 | |
85 | - $this->assertNotNull( $json ); |
|
86 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
87 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
88 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
89 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
90 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
91 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
85 | + $this->assertNotNull($json); |
|
86 | + $this->assertEquals(200, $response->getStatusCode()); |
|
87 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
88 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
89 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
90 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
91 | + $this->assertEquals(1, $json['meta']['total']); |
|
92 | 92 | |
93 | 93 | |
94 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
94 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
95 | 95 | $response = $client->getResponse(); |
96 | 96 | |
97 | - $json = json_decode( $response->getContent(), true ); |
|
97 | + $json = json_decode($response->getContent(), true); |
|
98 | 98 | |
99 | - $this->assertNotNull( $json ); |
|
100 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
101 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
99 | + $this->assertNotNull($json); |
|
100 | + $this->assertEquals(200, $response->getStatusCode()); |
|
101 | + $this->assertEquals(1, $json['meta']['total']); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -107,85 +107,85 @@ discard block |
||
107 | 107 | $client = static::createClient(array(), array( |
108 | 108 | 'PHP_AUTH_USER' => 'admin', |
109 | 109 | 'PHP_AUTH_PW' => 'adminpass', |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | $content = '{"data":[ |
114 | 114 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}, |
115 | 115 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony"}} |
116 | 116 | ]}'; |
117 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
117 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
118 | 118 | $response = $client->getResponse(); |
119 | 119 | |
120 | - $json = json_decode( $response->getContent(), true ); |
|
120 | + $json = json_decode($response->getContent(), true); |
|
121 | 121 | |
122 | - $this->assertNotNull( $json ); |
|
123 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
124 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
125 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
126 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
127 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
128 | - $this->assertEquals( 'symfony', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
129 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
122 | + $this->assertNotNull($json); |
|
123 | + $this->assertEquals(201, $response->getStatusCode()); |
|
124 | + $this->assertEquals(2, count($json['data'])); |
|
125 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
126 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
127 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
128 | + $this->assertEquals('symfony', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
129 | + $this->assertEquals(2, $json['meta']['total']); |
|
130 | 130 | |
131 | - $ids = array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id'] ); |
|
131 | + $ids = array($json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id']); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | $content = '{"data":[ |
135 | 135 | {"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
136 | 136 | {"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}} |
137 | 137 | ]}'; |
138 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
138 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
139 | 139 | $response = $client->getResponse(); |
140 | 140 | |
141 | - $json = json_decode( $response->getContent(), true ); |
|
142 | - |
|
143 | - $this->assertNotNull( $json ); |
|
144 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
145 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
146 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
147 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
148 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
149 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
150 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
151 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
152 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
153 | - |
|
154 | - |
|
155 | - $getParams = array( 'filter' => array( '&&' => array( |
|
156 | - array( '=~' => array( 'product.stock.warehouse.code' => 'symfony' ) ), |
|
157 | - array( '==' => array( 'product.stock.warehouse.label' => 'symfony2' ) ) |
|
158 | - ) ), |
|
159 | - 'sort' => 'product.stock.warehouse.code', 'page' => array( 'offset' => 0, 'limit' => 3 ) |
|
141 | + $json = json_decode($response->getContent(), true); |
|
142 | + |
|
143 | + $this->assertNotNull($json); |
|
144 | + $this->assertEquals(200, $response->getStatusCode()); |
|
145 | + $this->assertEquals(2, count($json['data'])); |
|
146 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
147 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
148 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
149 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
150 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
151 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
152 | + $this->assertEquals(2, $json['meta']['total']); |
|
153 | + |
|
154 | + |
|
155 | + $getParams = array('filter' => array('&&' => array( |
|
156 | + array('=~' => array('product.stock.warehouse.code' => 'symfony')), |
|
157 | + array('==' => array('product.stock.warehouse.label' => 'symfony2')) |
|
158 | + )), |
|
159 | + 'sort' => 'product.stock.warehouse.code', 'page' => array('offset' => 0, 'limit' => 3) |
|
160 | 160 | ); |
161 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse', $getParams ); |
|
161 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse', $getParams); |
|
162 | 162 | $response = $client->getResponse(); |
163 | 163 | |
164 | - $json = json_decode( $response->getContent(), true ); |
|
164 | + $json = json_decode($response->getContent(), true); |
|
165 | 165 | |
166 | - $this->assertNotNull( $json ); |
|
167 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
168 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
169 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.code'] ); |
|
170 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code'] ); |
|
171 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
172 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
173 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
174 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
175 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
166 | + $this->assertNotNull($json); |
|
167 | + $this->assertEquals(200, $response->getStatusCode()); |
|
168 | + $this->assertEquals(2, count($json['data'])); |
|
169 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.code']); |
|
170 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code']); |
|
171 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
172 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
173 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
174 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
175 | + $this->assertEquals(2, $json['meta']['total']); |
|
176 | 176 | |
177 | 177 | |
178 | 178 | $content = '{"data":[ |
179 | 179 | {"type":"product/stock/warehouse","id":' . $ids[0] . '}, |
180 | 180 | {"type":"product/stock/warehouse","id":' . $ids[1] . '} |
181 | 181 | ]}'; |
182 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
182 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
183 | 183 | $response = $client->getResponse(); |
184 | 184 | |
185 | - $json = json_decode( $response->getContent(), true ); |
|
185 | + $json = json_decode($response->getContent(), true); |
|
186 | 186 | |
187 | - $this->assertNotNull( $json ); |
|
188 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
189 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
187 | + $this->assertNotNull($json); |
|
188 | + $this->assertEquals(200, $response->getStatusCode()); |
|
189 | + $this->assertEquals(2, $json['meta']['total']); |
|
190 | 190 | } |
191 | 191 | } |