@@ -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 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function configure() |
30 | 30 | { |
31 | - $this->setName( 'aimeos:cache' ); |
|
32 | - $this->setDescription( 'Clears the content cache' ); |
|
33 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ); |
|
31 | + $this->setName('aimeos:cache'); |
|
32 | + $this->setDescription('Clears the content cache'); |
|
33 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -40,26 +40,26 @@ discard block |
||
40 | 40 | * @param InputInterface $input Input object |
41 | 41 | * @param OutputInterface $output Output object |
42 | 42 | */ |
43 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
43 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
44 | 44 | { |
45 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
46 | - $context->setEditor( 'aimeos:cache' ); |
|
45 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
46 | + $context->setEditor('aimeos:cache'); |
|
47 | 47 | |
48 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
48 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
49 | 49 | |
50 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
50 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
51 | 51 | { |
52 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
52 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
53 | 53 | |
54 | 54 | $lcontext = clone $context; |
55 | - $lcontext->setLocale( $localeItem ); |
|
55 | + $lcontext->setLocale($localeItem); |
|
56 | 56 | |
57 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
58 | - $lcontext->setCache( $cache ); |
|
57 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
58 | + $lcontext->setCache($cache); |
|
59 | 59 | |
60 | - $output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) ); |
|
60 | + $output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode())); |
|
61 | 61 | |
62 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
62 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -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 | } |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | 13 | |
14 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
14 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
15 | 15 | |
16 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
17 | - $crawler = $client->click( $link ); |
|
16 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
17 | + $crawler = $client->click($link); |
|
18 | 18 | |
19 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
20 | - $crawler = $client->submit( $form ); |
|
19 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
20 | + $crawler = $client->submit($form); |
|
21 | 21 | |
22 | - $this->assertEquals( 1, $crawler->filter( '.basket-standard' )->count() ); |
|
23 | - $this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() ); |
|
24 | - $this->assertEquals( 1, $crawler->filter( '.basket .product .quantity .value' )->attr('value') ); |
|
22 | + $this->assertEquals(1, $crawler->filter('.basket-standard')->count()); |
|
23 | + $this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count()); |
|
24 | + $this->assertEquals(1, $crawler->filter('.basket .product .quantity .value')->attr('value')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | { |
30 | 30 | $client = static::createClient(); |
31 | 31 | |
32 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
32 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
33 | 33 | |
34 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
35 | - $crawler = $client->click( $link ); |
|
34 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
35 | + $crawler = $client->click($link); |
|
36 | 36 | |
37 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
37 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
38 | 38 | $form['b_prod[0][quantity]'] = 2; |
39 | - $crawler = $client->submit( $form ); |
|
39 | + $crawler = $client->submit($form); |
|
40 | 40 | |
41 | - $this->assertEquals( 1, $crawler->filter( '.basket-standard' )->count() ); |
|
42 | - $this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() ); |
|
43 | - $this->assertEquals( 2, $crawler->filter( '.basket .product .quantity .value' )->attr('value') ); |
|
41 | + $this->assertEquals(1, $crawler->filter('.basket-standard')->count()); |
|
42 | + $this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count()); |
|
43 | + $this->assertEquals(2, $crawler->filter('.basket .product .quantity .value')->attr('value')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | { |
49 | 49 | $client = static::createClient(); |
50 | 50 | |
51 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
51 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
52 | 52 | |
53 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
54 | - $crawler = $client->click( $link ); |
|
53 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
54 | + $crawler = $client->click($link); |
|
55 | 55 | |
56 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
57 | - $crawler = $client->submit( $form ); |
|
56 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
57 | + $crawler = $client->submit($form); |
|
58 | 58 | |
59 | - $this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() ); |
|
60 | - $this->assertEquals( 1, $crawler->filter( '.basket .product .quantity .value' )->attr('value') ); |
|
59 | + $this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count()); |
|
60 | + $this->assertEquals(1, $crawler->filter('.basket .product .quantity .value')->attr('value')); |
|
61 | 61 | |
62 | 62 | |
63 | - $link = $crawler->filter( '.basket-standard .btn-back' )->link(); |
|
64 | - $crawler = $client->click( $link ); |
|
63 | + $link = $crawler->filter('.basket-standard .btn-back')->link(); |
|
64 | + $crawler = $client->click($link); |
|
65 | 65 | |
66 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
67 | - $crawler = $client->submit( $form ); |
|
66 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
67 | + $crawler = $client->submit($form); |
|
68 | 68 | |
69 | - $this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() ); |
|
70 | - $this->assertEquals( 2, $crawler->filter( '.basket .product .quantity .value' )->attr('value') ); |
|
69 | + $this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count()); |
|
70 | + $this->assertEquals(2, $crawler->filter('.basket .product .quantity .value')->attr('value')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | { |
76 | 76 | $client = static::createClient(); |
77 | 77 | |
78 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
78 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
79 | 79 | |
80 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
81 | - $crawler = $client->click( $link ); |
|
80 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
81 | + $crawler = $client->click($link); |
|
82 | 82 | |
83 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
84 | - $crawler = $client->submit( $form ); |
|
83 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
84 | + $crawler = $client->submit($form); |
|
85 | 85 | |
86 | 86 | |
87 | - $link = $crawler->filter( '.basket-standard .product .action .change' )->link(); |
|
88 | - $crawler = $client->click( $link ); |
|
87 | + $link = $crawler->filter('.basket-standard .product .action .change')->link(); |
|
88 | + $crawler = $client->click($link); |
|
89 | 89 | |
90 | - $this->assertEquals( 0, $crawler->filter( '.basket-standard .product' )->count() ); |
|
90 | + $this->assertEquals(0, $crawler->filter('.basket-standard .product')->count()); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -95,25 +95,25 @@ discard block |
||
95 | 95 | { |
96 | 96 | $client = static::createClient(); |
97 | 97 | |
98 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
98 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
99 | 99 | |
100 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
101 | - $crawler = $client->click( $link ); |
|
100 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
101 | + $crawler = $client->click($link); |
|
102 | 102 | |
103 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
104 | - $crawler = $client->submit( $form ); |
|
103 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
104 | + $crawler = $client->submit($form); |
|
105 | 105 | |
106 | 106 | |
107 | - $link = $crawler->filter( '.basket-standard .product .quantity .change' )->link(); |
|
108 | - $crawler = $client->click( $link ); |
|
107 | + $link = $crawler->filter('.basket-standard .product .quantity .change')->link(); |
|
108 | + $crawler = $client->click($link); |
|
109 | 109 | |
110 | - $this->assertEquals( 2, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) ); |
|
110 | + $this->assertEquals(2, $crawler->filter('.basket-standard .product .quantity .value')->attr('value')); |
|
111 | 111 | |
112 | 112 | |
113 | - $link = $crawler->filter( '.basket-standard .product .quantity .change' )->eq( 0 )->link(); |
|
114 | - $crawler = $client->click( $link ); |
|
113 | + $link = $crawler->filter('.basket-standard .product .quantity .change')->eq(0)->link(); |
|
114 | + $crawler = $client->click($link); |
|
115 | 115 | |
116 | - $this->assertEquals( 1, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) ); |
|
116 | + $this->assertEquals(1, $crawler->filter('.basket-standard .product .quantity .value')->attr('value')); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | { |
122 | 122 | $client = static::createClient(); |
123 | 123 | |
124 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
124 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
125 | 125 | |
126 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
127 | - $crawler = $client->click( $link ); |
|
126 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
127 | + $crawler = $client->click($link); |
|
128 | 128 | |
129 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
130 | - $crawler = $client->submit( $form ); |
|
129 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
130 | + $crawler = $client->submit($form); |
|
131 | 131 | |
132 | 132 | |
133 | - $form = $crawler->filter( '.basket-standard .btn-update' )->form(); |
|
133 | + $form = $crawler->filter('.basket-standard .btn-update')->form(); |
|
134 | 134 | $form['b_prod[0][quantity]'] = 3; |
135 | - $crawler = $client->submit( $form ); |
|
135 | + $crawler = $client->submit($form); |
|
136 | 136 | |
137 | - $this->assertEquals( 3, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) ); |
|
137 | + $this->assertEquals(3, $crawler->filter('.basket-standard .product .quantity .value')->attr('value')); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -142,26 +142,26 @@ discard block |
||
142 | 142 | { |
143 | 143 | $client = static::createClient(); |
144 | 144 | |
145 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
145 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
146 | 146 | |
147 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
148 | - $crawler = $client->click( $link ); |
|
147 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
148 | + $crawler = $client->click($link); |
|
149 | 149 | |
150 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
151 | - $crawler = $client->submit( $form ); |
|
150 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
151 | + $crawler = $client->submit($form); |
|
152 | 152 | |
153 | 153 | |
154 | - $form = $crawler->filter( '.basket-standard-coupon .coupon-new button' )->form(); |
|
154 | + $form = $crawler->filter('.basket-standard-coupon .coupon-new button')->form(); |
|
155 | 155 | $form['b_coupon'] = '90AB'; |
156 | - $crawler = $client->submit( $form ); |
|
156 | + $crawler = $client->submit($form); |
|
157 | 157 | |
158 | - $this->assertEquals( 1, $crawler->filter( '.basket-standard .product:contains("Geldwerter Nachlass")' )->count() ); |
|
158 | + $this->assertEquals(1, $crawler->filter('.basket-standard .product:contains("Geldwerter Nachlass")')->count()); |
|
159 | 159 | |
160 | 160 | |
161 | - $link = $crawler->filter( '.basket-standard-coupon .change' )->link(); |
|
162 | - $crawler = $client->click( $link ); |
|
161 | + $link = $crawler->filter('.basket-standard-coupon .change')->link(); |
|
162 | + $crawler = $client->click($link); |
|
163 | 163 | |
164 | - $this->assertEquals( 1, $crawler->filter( '.basket-standard .product' )->count() ); |
|
164 | + $this->assertEquals(1, $crawler->filter('.basket-standard .product')->count()); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | { |
170 | 170 | $client = static::createClient(); |
171 | 171 | |
172 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
172 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
173 | 173 | |
174 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
175 | - $crawler = $client->click( $link ); |
|
174 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
175 | + $crawler = $client->click($link); |
|
176 | 176 | |
177 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
178 | - $crawler = $client->submit( $form ); |
|
177 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
178 | + $crawler = $client->submit($form); |
|
179 | 179 | |
180 | - $this->assertEquals( 1, $crawler->filter( '.basket-related-bought .product' )->count() ); |
|
180 | + $this->assertEquals(1, $crawler->filter('.basket-related-bought .product')->count()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -185,56 +185,56 @@ discard block |
||
185 | 185 | { |
186 | 186 | $client = static::createClient(); |
187 | 187 | |
188 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
188 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
189 | 189 | |
190 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
191 | - $crawler = $client->click( $link ); |
|
190 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
191 | + $crawler = $client->click($link); |
|
192 | 192 | |
193 | - $form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form(); |
|
194 | - $crawler = $client->submit( $form ); |
|
193 | + $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form(); |
|
194 | + $crawler = $client->submit($form); |
|
195 | 195 | |
196 | - $link = $crawler->filter( '.basket-standard .btn-back' )->link(); |
|
197 | - $crawler = $client->click( $link ); |
|
196 | + $link = $crawler->filter('.basket-standard .btn-back')->link(); |
|
197 | + $crawler = $client->click($link); |
|
198 | 198 | |
199 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail .product:contains("Unittest: Bundle")' )->count() ); |
|
199 | + $this->assertEquals(1, $crawler->filter('.catalog-detail .product:contains("Unittest: Bundle")')->count()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
203 | 203 | public function testMiniComponent() |
204 | 204 | { |
205 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' ) |
|
206 | - ->setMethods( array( 'getOutput' ) ) |
|
205 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController') |
|
206 | + ->setMethods(array('getOutput')) |
|
207 | 207 | ->disableOriginalConstructor() |
208 | 208 | ->getMock(); |
209 | 209 | |
210 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
210 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
211 | 211 | |
212 | - $this->assertEquals( 'test', $mock->miniComponentAction() ); |
|
212 | + $this->assertEquals('test', $mock->miniComponentAction()); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
216 | 216 | public function testRelatedComponent() |
217 | 217 | { |
218 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' ) |
|
219 | - ->setMethods( array( 'getOutput' ) ) |
|
218 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController') |
|
219 | + ->setMethods(array('getOutput')) |
|
220 | 220 | ->disableOriginalConstructor() |
221 | 221 | ->getMock(); |
222 | 222 | |
223 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
223 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
224 | 224 | |
225 | - $this->assertEquals( 'test', $mock->relatedComponentAction() ); |
|
225 | + $this->assertEquals('test', $mock->relatedComponentAction()); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
229 | 229 | public function testStandardComponent() |
230 | 230 | { |
231 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' ) |
|
232 | - ->setMethods( array( 'getOutput' ) ) |
|
231 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController') |
|
232 | + ->setMethods(array('getOutput')) |
|
233 | 233 | ->disableOriginalConstructor() |
234 | 234 | ->getMock(); |
235 | 235 | |
236 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
236 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
237 | 237 | |
238 | - $this->assertEquals( 'test', $mock->standardComponentAction() ); |
|
238 | + $this->assertEquals('test', $mock->standardComponentAction()); |
|
239 | 239 | } |
240 | 240 | } |
@@ -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":"stock/type","attributes":{"stock.type.code":"symfony","stock.type.label":"symfony"}}}'; |
50 | - $client->request( 'POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content ); |
|
50 | + $client->request('POST', '/unittest/jsonadm/stock/type', 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( 'stock.type.id', $json['data']['attributes'] ); |
|
58 | - $this->assertEquals( 'symfony', $json['data']['attributes']['stock.type.code'] ); |
|
59 | - $this->assertEquals( 'symfony', $json['data']['attributes']['stock.type.label'] ); |
|
60 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
55 | + $this->assertNotNull($json); |
|
56 | + $this->assertEquals(201, $response->getStatusCode()); |
|
57 | + $this->assertArrayHasKey('stock.type.id', $json['data']['attributes']); |
|
58 | + $this->assertEquals('symfony', $json['data']['attributes']['stock.type.code']); |
|
59 | + $this->assertEquals('symfony', $json['data']['attributes']['stock.type.label']); |
|
60 | + $this->assertEquals(1, $json['meta']['total']); |
|
61 | 61 | |
62 | 62 | $id = $json['data']['attributes']['stock.type.id']; |
63 | 63 | |
64 | 64 | |
65 | 65 | $content = '{"data":{"type":"stock/type","attributes":{"stock.type.code":"symfony2","stock.type.label":"symfony2"}}}'; |
66 | - $client->request( 'PATCH', '/unittest/jsonadm/stock/type/' . $id, array(), array(), array(), $content ); |
|
66 | + $client->request('PATCH', '/unittest/jsonadm/stock/type/'.$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( 'stock.type.id', $json['data']['attributes'] ); |
|
74 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.code'] ); |
|
75 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.label'] ); |
|
76 | - $this->assertEquals( $id, $json['data']['attributes']['stock.type.id'] ); |
|
77 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
71 | + $this->assertNotNull($json); |
|
72 | + $this->assertEquals(200, $response->getStatusCode()); |
|
73 | + $this->assertArrayHasKey('stock.type.id', $json['data']['attributes']); |
|
74 | + $this->assertEquals('symfony2', $json['data']['attributes']['stock.type.code']); |
|
75 | + $this->assertEquals('symfony2', $json['data']['attributes']['stock.type.label']); |
|
76 | + $this->assertEquals($id, $json['data']['attributes']['stock.type.id']); |
|
77 | + $this->assertEquals(1, $json['meta']['total']); |
|
78 | 78 | |
79 | 79 | |
80 | - $client->request( 'GET', '/unittest/jsonadm/stock/type/' . $id ); |
|
80 | + $client->request('GET', '/unittest/jsonadm/stock/type/'.$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( 'stock.type.id', $json['data']['attributes'] ); |
|
88 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.code'] ); |
|
89 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.label'] ); |
|
90 | - $this->assertEquals( $id, $json['data']['attributes']['stock.type.id'] ); |
|
91 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
85 | + $this->assertNotNull($json); |
|
86 | + $this->assertEquals(200, $response->getStatusCode()); |
|
87 | + $this->assertArrayHasKey('stock.type.id', $json['data']['attributes']); |
|
88 | + $this->assertEquals('symfony2', $json['data']['attributes']['stock.type.code']); |
|
89 | + $this->assertEquals('symfony2', $json['data']['attributes']['stock.type.label']); |
|
90 | + $this->assertEquals($id, $json['data']['attributes']['stock.type.id']); |
|
91 | + $this->assertEquals(1, $json['meta']['total']); |
|
92 | 92 | |
93 | 93 | |
94 | - $client->request( 'DELETE', '/unittest/jsonadm/stock/type/' . $id ); |
|
94 | + $client->request('DELETE', '/unittest/jsonadm/stock/type/'.$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":"stock/type","attributes":{"stock.type.code":"symfony","stock.type.label":"symfony"}}, |
115 | 115 | {"type":"stock/type","attributes":{"stock.type.code":"symfony2","stock.type.label":"symfony"}} |
116 | 116 | ]}'; |
117 | - $client->request( 'POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content ); |
|
117 | + $client->request('POST', '/unittest/jsonadm/stock/type', 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( 'stock.type.id', $json['data'][0]['attributes'] ); |
|
126 | - $this->assertArrayHasKey( 'stock.type.id', $json['data'][1]['attributes'] ); |
|
127 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['stock.type.label'] ); |
|
128 | - $this->assertEquals( 'symfony', $json['data'][1]['attributes']['stock.type.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('stock.type.id', $json['data'][0]['attributes']); |
|
126 | + $this->assertArrayHasKey('stock.type.id', $json['data'][1]['attributes']); |
|
127 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['stock.type.label']); |
|
128 | + $this->assertEquals('symfony', $json['data'][1]['attributes']['stock.type.label']); |
|
129 | + $this->assertEquals(2, $json['meta']['total']); |
|
130 | 130 | |
131 | - $ids = array( $json['data'][0]['attributes']['stock.type.id'], $json['data'][1]['attributes']['stock.type.id'] ); |
|
131 | + $ids = array($json['data'][0]['attributes']['stock.type.id'], $json['data'][1]['attributes']['stock.type.id']); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | $content = '{"data":[ |
135 | - {"type":"stock/type","id":' . $ids[0] . ',"attributes":{"stock.type.label":"symfony2"}}, |
|
136 | - {"type":"stock/type","id":' . $ids[1] . ',"attributes":{"stock.type.label":"symfony2"}} |
|
135 | + {"type":"stock/type","id":' . $ids[0].',"attributes":{"stock.type.label":"symfony2"}}, |
|
136 | + {"type":"stock/type","id":' . $ids[1].',"attributes":{"stock.type.label":"symfony2"}} |
|
137 | 137 | ]}'; |
138 | - $client->request( 'PATCH', '/unittest/jsonadm/stock/type', array(), array(), array(), $content ); |
|
138 | + $client->request('PATCH', '/unittest/jsonadm/stock/type', 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( 'stock.type.id', $json['data'][0]['attributes'] ); |
|
147 | - $this->assertArrayHasKey( 'stock.type.id', $json['data'][1]['attributes'] ); |
|
148 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['stock.type.label'] ); |
|
149 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.label'] ); |
|
150 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['stock.type.id'], $ids ) ); |
|
151 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['stock.type.id'], $ids ) ); |
|
152 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
153 | - |
|
154 | - |
|
155 | - $getParams = array( 'filter' => array( '&&' => array( |
|
156 | - array( '=~' => array( 'stock.type.code' => 'symfony' ) ), |
|
157 | - array( '==' => array( 'stock.type.label' => 'symfony2' ) ) |
|
158 | - ) ), |
|
159 | - 'sort' => 'stock.type.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('stock.type.id', $json['data'][0]['attributes']); |
|
147 | + $this->assertArrayHasKey('stock.type.id', $json['data'][1]['attributes']); |
|
148 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['stock.type.label']); |
|
149 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.label']); |
|
150 | + $this->assertTrue(in_array($json['data'][0]['attributes']['stock.type.id'], $ids)); |
|
151 | + $this->assertTrue(in_array($json['data'][1]['attributes']['stock.type.id'], $ids)); |
|
152 | + $this->assertEquals(2, $json['meta']['total']); |
|
153 | + |
|
154 | + |
|
155 | + $getParams = array('filter' => array('&&' => array( |
|
156 | + array('=~' => array('stock.type.code' => 'symfony')), |
|
157 | + array('==' => array('stock.type.label' => 'symfony2')) |
|
158 | + )), |
|
159 | + 'sort' => 'stock.type.code', 'page' => array('offset' => 0, 'limit' => 3) |
|
160 | 160 | ); |
161 | - $client->request( 'GET', '/unittest/jsonadm/stock/type', $getParams ); |
|
161 | + $client->request('GET', '/unittest/jsonadm/stock/type', $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']['stock.type.code'] ); |
|
170 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.code'] ); |
|
171 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['stock.type.label'] ); |
|
172 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.label'] ); |
|
173 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['stock.type.id'], $ids ) ); |
|
174 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['stock.type.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']['stock.type.code']); |
|
170 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.code']); |
|
171 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['stock.type.label']); |
|
172 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.label']); |
|
173 | + $this->assertTrue(in_array($json['data'][0]['attributes']['stock.type.id'], $ids)); |
|
174 | + $this->assertTrue(in_array($json['data'][1]['attributes']['stock.type.id'], $ids)); |
|
175 | + $this->assertEquals(2, $json['meta']['total']); |
|
176 | 176 | |
177 | 177 | |
178 | 178 | $content = '{"data":[ |
179 | - {"type":"stock/type","id":' . $ids[0] . '}, |
|
180 | - {"type":"stock/type","id":' . $ids[1] . '} |
|
179 | + {"type":"stock/type","id":' . $ids[0].'}, |
|
180 | + {"type":"stock/type","id":' . $ids[1].'} |
|
181 | 181 | ]}'; |
182 | - $client->request( 'DELETE', '/unittest/jsonadm/stock/type', array(), array(), array(), $content ); |
|
182 | + $client->request('DELETE', '/unittest/jsonadm/stock/type', 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 | } |