@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $client = static::createClient(); |
| 13 | 13 | |
| 14 | - $client->request( 'GET', '/admin' ); |
|
| 14 | + $client->request('GET', '/admin'); |
|
| 15 | 15 | $response = $client->getResponse(); |
| 16 | 16 | |
| 17 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 18 | - $this->assertContains( '<form class="login"', $response->getContent() ); |
|
| 17 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 18 | + $this->assertContains('<form class="login"', $response->getContent()); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | $client = static::createClient(array(), array( |
| 25 | 25 | 'PHP_AUTH_USER' => 'admin', |
| 26 | 26 | 'PHP_AUTH_PW' => 'adminpass', |
| 27 | - ) ); |
|
| 27 | + )); |
|
| 28 | 28 | |
| 29 | - $client->request( 'GET', '/admin' ); |
|
| 29 | + $client->request('GET', '/admin'); |
|
| 30 | 30 | $response = $client->getResponse(); |
| 31 | 31 | |
| 32 | - $this->assertEquals( 302, $response->getStatusCode() ); |
|
| 33 | - $this->assertContains( '/default/jqadm/search/dashboard?lang=en', $response->getContent() ); |
|
| 32 | + $this->assertEquals(302, $response->getStatusCode()); |
|
| 33 | + $this->assertContains('/default/jqadm/search/dashboard?lang=en', $response->getContent()); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function indexAction() |
| 31 | 31 | { |
| 32 | - if( $this->isAdmin() ) |
|
| 32 | + if ($this->isAdmin()) |
|
| 33 | 33 | { |
| 34 | - $params = array( 'site' => 'default', 'resource' => 'dashboard', 'lang' => 'en' ); |
|
| 35 | - return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) ); |
|
| 34 | + $params = array('site' => 'default', 'resource' => 'dashboard', 'lang' => 'en'); |
|
| 35 | + return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $param = array( 'error' => '', 'username' => '' ); |
|
| 38 | + $param = array('error' => '', 'username' => ''); |
|
| 39 | 39 | |
| 40 | - if( $this->has( 'security.authentication_utils' ) ) |
|
| 40 | + if ($this->has('security.authentication_utils')) |
|
| 41 | 41 | { |
| 42 | - $auth = $this->get( 'security.authentication_utils' ); |
|
| 42 | + $auth = $this->get('security.authentication_utils'); |
|
| 43 | 43 | |
| 44 | 44 | $param['error'] = $auth->getLastAuthenticationError(); |
| 45 | 45 | $param['username'] = $auth->getLastUsername(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param ); |
|
| 48 | + return $this->render('AimeosShopBundle:Admin:index.html.twig', $param); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function isAdmin() |
| 58 | 58 | { |
| 59 | - if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() |
|
| 60 | - && $this->get( 'security.authorization_checker' )->isGranted( 'ROLE_ADMIN' ) |
|
| 61 | - || $this->has( 'security.context' ) && $this->get( 'security.context' )->getToken() |
|
| 62 | - && $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' ) |
|
| 59 | + if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken() |
|
| 60 | + && $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') |
|
| 61 | + || $this->has('security.context') && $this->get('security.context')->getToken() |
|
| 62 | + && $this->get('security.context')->isGranted('ROLE_ADMIN') |
|
| 63 | 63 | ) { |
| 64 | 64 | return true; |
| 65 | 65 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param RequestStack $requestStack Current request stack |
| 33 | 33 | * @param Container $container Container object to access parameters |
| 34 | 34 | */ |
| 35 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
| 35 | + public function __construct(RequestStack $requestStack, Container $container) |
|
| 36 | 36 | { |
| 37 | 37 | $this->requestStack = $requestStack; |
| 38 | 38 | $this->container = $container; |
@@ -47,62 +47,62 @@ discard block |
||
| 47 | 47 | * @param string|null $locale Code of the current language or null for no translation |
| 48 | 48 | * @return \Aimeos\MW\View\Iface View object |
| 49 | 49 | */ |
| 50 | - public function create( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null ) |
|
| 50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null) |
|
| 51 | 51 | { |
| 52 | 52 | $params = $fixed = array(); |
| 53 | 53 | $config = $context->getConfig(); |
| 54 | 54 | $request = $this->requestStack->getMasterRequest(); |
| 55 | 55 | |
| 56 | - if( $locale !== null ) |
|
| 56 | + if ($locale !== null) |
|
| 57 | 57 | { |
| 58 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
| 58 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
| 59 | 59 | $fixed = $this->getFixedParams(); |
| 60 | 60 | |
| 61 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
| 61 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
| 62 | 62 | $translation = $i18n[$locale]; |
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 66 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
| 70 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
| 71 | 71 | |
| 72 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 73 | - $view->addHelper( 'translate', $helper ); |
|
| 72 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 73 | + $view->addHelper('translate', $helper); |
|
| 74 | 74 | |
| 75 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
| 76 | - $view->addHelper( 'url', $helper ); |
|
| 75 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
| 76 | + $view->addHelper('url', $helper); |
|
| 77 | 77 | |
| 78 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
| 79 | - $view->addHelper( 'param', $helper ); |
|
| 78 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
| 79 | + $view->addHelper('param', $helper); |
|
| 80 | 80 | |
| 81 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
| 82 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 83 | - $view->addHelper( 'config', $helper ); |
|
| 81 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
| 82 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 83 | + $view->addHelper('config', $helper); |
|
| 84 | 84 | |
| 85 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
| 86 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
| 87 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
| 88 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
| 89 | - $view->addHelper( 'number', $helper ); |
|
| 85 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
| 86 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
| 87 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
| 88 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
| 89 | + $view->addHelper('number', $helper); |
|
| 90 | 90 | |
| 91 | - if( $request !== null ) |
|
| 91 | + if ($request !== null) |
|
| 92 | 92 | { |
| 93 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
| 94 | - $view->addHelper( 'request', $helper ); |
|
| 93 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
| 94 | + $view->addHelper('request', $helper); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
| 98 | - $view->addHelper( 'response', $helper ); |
|
| 97 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
| 98 | + $view->addHelper('response', $helper); |
|
| 99 | 99 | |
| 100 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
| 101 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
| 102 | - $view->addHelper( 'csrf', $helper ); |
|
| 100 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
| 101 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
| 102 | + $view->addHelper('csrf', $helper); |
|
| 103 | 103 | |
| 104 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $this->getGroups( $context ) ); |
|
| 105 | - $view->addHelper( 'access', $helper ); |
|
| 104 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $this->getGroups($context)); |
|
| 105 | + $view->addHelper('access', $helper); |
|
| 106 | 106 | |
| 107 | 107 | return $view; |
| 108 | 108 | } |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | $urlparams = array(); |
| 119 | 119 | $attr = $this->requestStack->getMasterRequest()->attributes; |
| 120 | 120 | |
| 121 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
| 121 | + if (($site = $attr->get('site')) !== null) { |
|
| 122 | 122 | $urlparams['site'] = $site; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
| 125 | + if (($lang = $attr->get('locale')) !== null) { |
|
| 126 | 126 | $urlparams['locale'] = $lang; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
| 129 | + if (($currency = $attr->get('currency')) !== null) { |
|
| 130 | 130 | $urlparams['currency'] = $currency; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 141 | 141 | * @return \Closure Function which returns the user group codes |
| 142 | 142 | */ |
| 143 | - protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 143 | + protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 144 | 144 | { |
| 145 | - return function() use ( $context ) |
|
| 145 | + return function() use ($context) |
|
| 146 | 146 | { |
| 147 | 147 | $list = array(); |
| 148 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 148 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 149 | 149 | |
| 150 | 150 | $search = $manager->createSearch(); |
| 151 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
| 151 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
| 152 | 152 | |
| 153 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 153 | + foreach ($manager->searchItems($search) as $item) { |
|
| 154 | 154 | $list[] = $item->getCode(); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -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 | } |