@@ -28,29 +28,29 @@ |
||
| 28 | 28 | * @param string $clientName Html client name |
| 29 | 29 | * @return Response Response object containing the generated output |
| 30 | 30 | */ |
| 31 | - protected function getOutput( $clientName ) |
|
| 31 | + protected function getOutput($clientName) |
|
| 32 | 32 | { |
| 33 | - $tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/html/templates' ); |
|
| 34 | - $context = $this->container->get( 'aimeos_context' )->get(); |
|
| 33 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); |
|
| 34 | + $context = $this->container->get('aimeos_context')->get(); |
|
| 35 | 35 | $langid = $context->getLocale()->getLanguageId(); |
| 36 | 36 | |
| 37 | - $view = $this->container->get( 'aimeos_view' )->create( $context, $tmplPaths, $langid ); |
|
| 38 | - $context->setView( $view ); |
|
| 37 | + $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); |
|
| 38 | + $context->setView($view); |
|
| 39 | 39 | |
| 40 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
| 41 | - $client->setView( $view ); |
|
| 40 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
| 41 | + $client->setView($view); |
|
| 42 | 42 | $client->process(); |
| 43 | 43 | |
| 44 | - $twig = $this->container->get( 'twig' ); |
|
| 44 | + $twig = $this->container->get('twig'); |
|
| 45 | 45 | $vars = $twig->getGlobals(); |
| 46 | 46 | |
| 47 | - if( !isset( $vars['aiheader'] ) ) { |
|
| 47 | + if (!isset($vars['aiheader'])) { |
|
| 48 | 48 | $vars['aiheader'] = array(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $vars['aiheader'][$clientName] = (string) $client->getHeader(); |
| 52 | - $twig->addGlobal( 'aiheader', $vars['aiheader'] ); |
|
| 52 | + $twig->addGlobal('aiheader', $vars['aiheader']); |
|
| 53 | 53 | |
| 54 | - return new Response( (string) $client->getBody() ); |
|
| 54 | + return new Response((string) $client->getBody()); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -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 | } |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function indexAction() |
| 30 | 30 | { |
| 31 | - $params = $this->get( 'aimeos_page' )->getSections( 'account-index' ); |
|
| 32 | - return $this->render( 'AimeosShopBundle:Account:index.html.twig', $params ); |
|
| 31 | + $params = $this->get('aimeos_page')->getSections('account-index'); |
|
| 32 | + return $this->render('AimeosShopBundle:Account:index.html.twig', $params); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | $context = $this->container->get('aimeos_context')->get(); |
| 44 | 44 | $langid = $context->getLocale()->getLanguageId(); |
| 45 | 45 | |
| 46 | - $view = $this->container->get('aimeos_view')->create( $context, array(), $langid ); |
|
| 47 | - $context->setView( $view ); |
|
| 46 | + $view = $this->container->get('aimeos_view')->create($context, array(), $langid); |
|
| 47 | + $context->setView($view); |
|
| 48 | 48 | |
| 49 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' ); |
|
| 50 | - $client->setView( $view ); |
|
| 49 | + $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); |
|
| 50 | + $client->setView($view); |
|
| 51 | 51 | $client->process(); |
| 52 | 52 | |
| 53 | 53 | $response = $view->response(); |
| 54 | - return new Response( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() ); |
|
| 54 | + return new Response((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders()); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function favoriteComponentAction() |
| 64 | 64 | { |
| 65 | - return $this->getOutput( 'account/favorite' ); |
|
| 65 | + return $this->getOutput('account/favorite'); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function historyComponentAction() |
| 75 | 75 | { |
| 76 | - return $this->getOutput( 'account/history' ); |
|
| 76 | + return $this->getOutput('account/history'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function profileComponentAction() |
| 86 | 86 | { |
| 87 | - return $this->getOutput( 'account/profile' ); |
|
| 87 | + return $this->getOutput('account/profile'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -95,6 +95,6 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function watchComponentAction() |
| 97 | 97 | { |
| 98 | - return $this->getOutput( 'account/watch' ); |
|
| 98 | + return $this->getOutput('account/watch'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
@@ -10,69 +10,69 @@ |
||
| 10 | 10 | public function testAccount() |
| 11 | 11 | { |
| 12 | 12 | $client = static::createClient(); |
| 13 | - $client->request( 'GET', '/unittest/de/EUR/myaccount' ); |
|
| 13 | + $client->request('GET', '/unittest/de/EUR/myaccount'); |
|
| 14 | 14 | |
| 15 | - $this->assertContains( 'aimeos account-profile', $client->getResponse()->getContent() ); |
|
| 16 | - $this->assertContains( 'aimeos account-history', $client->getResponse()->getContent() ); |
|
| 17 | - $this->assertContains( 'aimeos account-favorite', $client->getResponse()->getContent() ); |
|
| 18 | - $this->assertContains( 'aimeos account-watch', $client->getResponse()->getContent() ); |
|
| 15 | + $this->assertContains('aimeos account-profile', $client->getResponse()->getContent()); |
|
| 16 | + $this->assertContains('aimeos account-history', $client->getResponse()->getContent()); |
|
| 17 | + $this->assertContains('aimeos account-favorite', $client->getResponse()->getContent()); |
|
| 18 | + $this->assertContains('aimeos account-watch', $client->getResponse()->getContent()); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | public function testDownload() |
| 23 | 23 | { |
| 24 | 24 | $client = static::createClient(); |
| 25 | - $client->request( 'GET', '/unittest/de/EUR/myaccount/download/0' ); |
|
| 25 | + $client->request('GET', '/unittest/de/EUR/myaccount/download/0'); |
|
| 26 | 26 | |
| 27 | - $this->assertEquals( 401, $client->getResponse()->getStatusCode() ); |
|
| 27 | + $this->assertEquals(401, $client->getResponse()->getStatusCode()); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testFavoriteComponent() |
| 32 | 32 | { |
| 33 | 33 | $client = static::createClient(); |
| 34 | - $client->request( 'GET', '/unittest/de/EUR/test/favoritecomponent' ); |
|
| 34 | + $client->request('GET', '/unittest/de/EUR/test/favoritecomponent'); |
|
| 35 | 35 | |
| 36 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 37 | - $this->assertContains( 'aimeos account-favorite', $client->getResponse()->getContent() ); |
|
| 36 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 37 | + $this->assertContains('aimeos account-favorite', $client->getResponse()->getContent()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | public function testHistoryComponent() |
| 42 | 42 | { |
| 43 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' ) |
|
| 44 | - ->setMethods( array( 'getOutput' ) ) |
|
| 43 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController') |
|
| 44 | + ->setMethods(array('getOutput')) |
|
| 45 | 45 | ->disableOriginalConstructor() |
| 46 | 46 | ->getMock(); |
| 47 | 47 | |
| 48 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
| 48 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
| 49 | 49 | |
| 50 | - $this->assertEquals( 'test', $mock->historyComponentAction() ); |
|
| 50 | + $this->assertEquals('test', $mock->historyComponentAction()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testProfileComponent() |
| 55 | 55 | { |
| 56 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' ) |
|
| 57 | - ->setMethods( array( 'getOutput' ) ) |
|
| 56 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController') |
|
| 57 | + ->setMethods(array('getOutput')) |
|
| 58 | 58 | ->disableOriginalConstructor() |
| 59 | 59 | ->getMock(); |
| 60 | 60 | |
| 61 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
| 61 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
| 62 | 62 | |
| 63 | - $this->assertEquals( 'test', $mock->profileComponentAction() ); |
|
| 63 | + $this->assertEquals('test', $mock->profileComponentAction()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public function testWatchComponent() |
| 68 | 68 | { |
| 69 | - $mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' ) |
|
| 70 | - ->setMethods( array( 'getOutput' ) ) |
|
| 69 | + $mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController') |
|
| 70 | + ->setMethods(array('getOutput')) |
|
| 71 | 71 | ->disableOriginalConstructor() |
| 72 | 72 | ->getMock(); |
| 73 | 73 | |
| 74 | - $mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) ); |
|
| 74 | + $mock->expects($this->once())->method('getOutput')->will($this->returnValue('test')); |
|
| 75 | 75 | |
| 76 | - $this->assertEquals( 'test', $mock->watchComponentAction() ); |
|
| 76 | + $this->assertEquals('test', $mock->watchComponentAction()); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -27,15 +27,15 @@ |
||
| 27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 28 | 28 | * @return array List of group codes the user is in |
| 29 | 29 | */ |
| 30 | - public function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 30 | + public function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 31 | 31 | { |
| 32 | 32 | $list = array(); |
| 33 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 33 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 34 | 34 | |
| 35 | 35 | $search = $manager->createSearch(); |
| 36 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
| 36 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
| 37 | 37 | |
| 38 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 38 | + foreach ($manager->searchItems($search) as $item) { |
|
| 39 | 39 | $list[] = $item->getCode(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param RequestStack $requestStack Current request stack |
| 33 | 33 | * @param Container $container Container object to access parameters |
| 34 | 34 | */ |
| 35 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
| 35 | + public function __construct(RequestStack $requestStack, Container $container) |
|
| 36 | 36 | { |
| 37 | 37 | $this->requestStack = $requestStack; |
| 38 | 38 | $this->container = $container; |
@@ -45,19 +45,19 @@ discard block |
||
| 45 | 45 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 46 | 46 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 47 | 47 | */ |
| 48 | - public function get( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 48 | + public function get(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 49 | 49 | { |
| 50 | - if( $this->locale === null ) |
|
| 50 | + if ($this->locale === null) |
|
| 51 | 51 | { |
| 52 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
| 52 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
| 53 | 53 | $request = $this->requestStack->getMasterRequest(); |
| 54 | 54 | |
| 55 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
| 56 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
| 57 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
| 55 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
| 56 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
| 57 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
| 58 | 58 | |
| 59 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 60 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
| 59 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 60 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $this->locale; |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | * @param string $site Unique site code |
| 72 | 72 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 73 | 73 | */ |
| 74 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 74 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 75 | 75 | { |
| 76 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 76 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 77 | 77 | |
| 78 | 78 | try |
| 79 | 79 | { |
| 80 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 81 | - $localeItem->setLanguageId( null ); |
|
| 82 | - $localeItem->setCurrencyId( null ); |
|
| 80 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 81 | + $localeItem->setLanguageId(null); |
|
| 82 | + $localeItem->setCurrencyId(null); |
|
| 83 | 83 | } |
| 84 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 84 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 85 | 85 | { |
| 86 | 86 | $localeItem = $localeManager->createItem(); |
| 87 | 87 | } |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | $client = static::createClient(array(), array( |
| 13 | 13 | 'PHP_AUTH_USER' => 'admin', |
| 14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
| 15 | - ) ); |
|
| 15 | + )); |
|
| 16 | 16 | |
| 17 | - $client->request( 'GET', '/unittest/jqadm/file/css' ); |
|
| 17 | + $client->request('GET', '/unittest/jqadm/file/css'); |
|
| 18 | 18 | |
| 19 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 20 | - $this->assertContains( '.aimeos', $client->getResponse()->getContent() ); |
|
| 19 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 20 | + $this->assertContains('.aimeos', $client->getResponse()->getContent()); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $client = static::createClient(array(), array( |
| 27 | 27 | 'PHP_AUTH_USER' => 'admin', |
| 28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
| 29 | - ) ); |
|
| 29 | + )); |
|
| 30 | 30 | |
| 31 | - $client->request( 'GET', '/unittest/jqadm/file/js' ); |
|
| 31 | + $client->request('GET', '/unittest/jqadm/file/js'); |
|
| 32 | 32 | |
| 33 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 34 | - $this->assertContains( 'Aimeos = {', $client->getResponse()->getContent() ); |
|
| 33 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 34 | + $this->assertContains('Aimeos = {', $client->getResponse()->getContent()); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | $client = static::createClient(array(), array( |
| 41 | 41 | 'PHP_AUTH_USER' => 'admin', |
| 42 | 42 | 'PHP_AUTH_PW' => 'adminpass', |
| 43 | - ) ); |
|
| 43 | + )); |
|
| 44 | 44 | |
| 45 | - $client->request( 'GET', '/unittest/jqadm/copy/product/0' ); |
|
| 45 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
| 46 | 46 | $response = $client->getResponse(); |
| 47 | 47 | |
| 48 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 49 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 48 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 49 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | $client = static::createClient(array(), array( |
| 56 | 56 | 'PHP_AUTH_USER' => 'admin', |
| 57 | 57 | 'PHP_AUTH_PW' => 'adminpass', |
| 58 | - ) ); |
|
| 58 | + )); |
|
| 59 | 59 | |
| 60 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
| 60 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
| 61 | 61 | $response = $client->getResponse(); |
| 62 | 62 | |
| 63 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 64 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 63 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 64 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | $client = static::createClient(array(), array( |
| 71 | 71 | 'PHP_AUTH_USER' => 'admin', |
| 72 | 72 | 'PHP_AUTH_PW' => 'adminpass', |
| 73 | - ) ); |
|
| 73 | + )); |
|
| 74 | 74 | |
| 75 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
| 75 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
| 76 | 76 | $response = $client->getResponse(); |
| 77 | 77 | |
| 78 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 79 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 78 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 79 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | $client = static::createClient(array(), array( |
| 86 | 86 | 'PHP_AUTH_USER' => 'admin', |
| 87 | 87 | 'PHP_AUTH_PW' => 'adminpass', |
| 88 | - ) ); |
|
| 88 | + )); |
|
| 89 | 89 | |
| 90 | - $client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
|
| 90 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
| 91 | 91 | $response = $client->getResponse(); |
| 92 | 92 | |
| 93 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 94 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 93 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 94 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | $client = static::createClient(array(), array( |
| 101 | 101 | 'PHP_AUTH_USER' => 'admin', |
| 102 | 102 | 'PHP_AUTH_PW' => 'adminpass', |
| 103 | - ) ); |
|
| 103 | + )); |
|
| 104 | 104 | |
| 105 | - $client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
|
| 105 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
| 106 | 106 | $response = $client->getResponse(); |
| 107 | 107 | |
| 108 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 109 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 108 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 109 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | $client = static::createClient(array(), array( |
| 116 | 116 | 'PHP_AUTH_USER' => 'admin', |
| 117 | 117 | 'PHP_AUTH_PW' => 'adminpass', |
| 118 | - ) ); |
|
| 118 | + )); |
|
| 119 | 119 | |
| 120 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
| 120 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
| 121 | 121 | $response = $client->getResponse(); |
| 122 | 122 | |
| 123 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 124 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 123 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 124 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | $client = static::createClient(array(), array( |
| 131 | 131 | 'PHP_AUTH_USER' => 'admin', |
| 132 | 132 | 'PHP_AUTH_PW' => 'adminpass', |
| 133 | - ) ); |
|
| 133 | + )); |
|
| 134 | 134 | |
| 135 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
| 135 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
| 136 | 136 | $response = $client->getResponse(); |
| 137 | 137 | |
| 138 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 139 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 138 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 139 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 140 | 140 | } |
| 141 | 141 | } |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected function configure() |
| 31 | 31 | { |
| 32 | - $this->setName( 'aimeos:account'); |
|
| 33 | - $this->setDescription( 'Creates new (admin) accounts' ); |
|
| 34 | - $this->addArgument( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ); |
|
| 35 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ); |
|
| 36 | - $this->addOption( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ); |
|
| 37 | - $this->addOption( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ); |
|
| 38 | - $this->addOption( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ); |
|
| 32 | + $this->setName('aimeos:account'); |
|
| 33 | + $this->setDescription('Creates new (admin) accounts'); |
|
| 34 | + $this->addArgument('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'); |
|
| 35 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'); |
|
| 36 | + $this->addOption('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'); |
|
| 37 | + $this->addOption('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'); |
|
| 38 | + $this->addOption('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -45,32 +45,32 @@ 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 | - $code = $input->getArgument( 'email' ); |
|
| 51 | - if( ( $password = $input->getOption( 'password' ) ) === null ) |
|
| 50 | + $code = $input->getArgument('email'); |
|
| 51 | + if (($password = $input->getOption('password')) === null) |
|
| 52 | 52 | { |
| 53 | - $helper = $this->getHelper( 'question' ); |
|
| 54 | - $question = new Question( 'Password' ); |
|
| 55 | - $question->setHidden( true ); |
|
| 53 | + $helper = $this->getHelper('question'); |
|
| 54 | + $question = new Question('Password'); |
|
| 55 | + $question->setHidden(true); |
|
| 56 | 56 | |
| 57 | - $password = $helper->ask( $input, $output, $question ); |
|
| 57 | + $password = $helper->ask($input, $output, $question); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
| 61 | - $context->setEditor( 'aimeos:account' ); |
|
| 60 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
| 61 | + $context->setEditor('aimeos:account'); |
|
| 62 | 62 | |
| 63 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 64 | - $context->setLocale( $localeManager->createItem() ); |
|
| 63 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 64 | + $context->setLocale($localeManager->createItem()); |
|
| 65 | 65 | |
| 66 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
| 66 | + $user = $this->createCustomerItem($context, $code, $password); |
|
| 67 | 67 | |
| 68 | - if( $input->getOption( 'admin' ) ) { |
|
| 69 | - $this->addGroup( $input, $output, $context, $user, 'admin' ); |
|
| 68 | + if ($input->getOption('admin')) { |
|
| 69 | + $this->addGroup($input, $output, $context, $user, 'admin'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( $input->getOption( 'editor' ) ) { |
|
| 73 | - $this->addGroup( $input, $output, $context, $user, 'editor' ); |
|
| 72 | + if ($input->getOption('editor')) { |
|
| 73 | + $this->addGroup($input, $output, $context, $user, 'editor'); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -84,24 +84,24 @@ discard block |
||
| 84 | 84 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
| 85 | 85 | * @param string $group Unique customer group code |
| 86 | 86 | */ |
| 87 | - protected function addGroup( InputInterface $input, OutputInterface $output, |
|
| 88 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group ) |
|
| 87 | + protected function addGroup(InputInterface $input, OutputInterface $output, |
|
| 88 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group) |
|
| 89 | 89 | { |
| 90 | - $output->writeln( sprintf( 'Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode() ) ); |
|
| 90 | + $output->writeln(sprintf('Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode())); |
|
| 91 | 91 | |
| 92 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 92 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 93 | 93 | |
| 94 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
| 94 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
| 95 | 95 | { |
| 96 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 96 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 97 | 97 | |
| 98 | 98 | $lcontext = clone $context; |
| 99 | - $lcontext->setLocale( $localeItem ); |
|
| 99 | + $lcontext->setLocale($localeItem); |
|
| 100 | 100 | |
| 101 | - $output->writeln( '- ' . $siteItem->getCode() ); |
|
| 101 | + $output->writeln('- '.$siteItem->getCode()); |
|
| 102 | 102 | |
| 103 | - $groupItem = $this->getGroupItem( $lcontext, $group ); |
|
| 104 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
| 103 | + $groupItem = $this->getGroupItem($lcontext, $group); |
|
| 104 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -113,31 +113,31 @@ discard block |
||
| 113 | 113 | * @param string $userid Unique user ID |
| 114 | 114 | * @param string $groupid Unique group ID |
| 115 | 115 | */ |
| 116 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
| 116 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
| 117 | 117 | { |
| 118 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
| 119 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
| 118 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
| 119 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
| 120 | 120 | |
| 121 | 121 | $search = $manager->createSearch(); |
| 122 | 122 | $expr = array( |
| 123 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
| 124 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
| 125 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
| 126 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
| 123 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
| 124 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
| 125 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
| 126 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
| 127 | 127 | ); |
| 128 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 129 | - $search->setSlice( 0, 1 ); |
|
| 128 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 129 | + $search->setSlice(0, 1); |
|
| 130 | 130 | |
| 131 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
| 131 | + if (count($manager->searchItems($search)) === 0) |
|
| 132 | 132 | { |
| 133 | 133 | $item = $manager->createItem(); |
| 134 | - $item->setDomain( 'customer/group' ); |
|
| 135 | - $item->setParentId( $userid ); |
|
| 136 | - $item->setTypeId( $typeid ); |
|
| 137 | - $item->setRefId( $groupid ); |
|
| 138 | - $item->setStatus( 1 ); |
|
| 134 | + $item->setDomain('customer/group'); |
|
| 135 | + $item->setParentId($userid); |
|
| 136 | + $item->setTypeId($typeid); |
|
| 137 | + $item->setRefId($groupid); |
|
| 138 | + $item->setStatus(1); |
|
| 139 | 139 | |
| 140 | - $manager->saveItem( $item, false ); |
|
| 140 | + $manager->saveItem($item, false); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
@@ -152,23 +152,23 @@ discard block |
||
| 152 | 152 | * @param string $password New user password |
| 153 | 153 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
| 154 | 154 | */ |
| 155 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
| 155 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
| 156 | 156 | { |
| 157 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 157 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 158 | 158 | |
| 159 | 159 | try { |
| 160 | - $item = $manager->findItem( $email ); |
|
| 161 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
| 160 | + $item = $manager->findItem($email); |
|
| 161 | + } catch (\Aimeos\MShop\Exception $e) { |
|
| 162 | 162 | $item = $manager->createItem(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $item->setCode( $email ); |
|
| 166 | - $item->setLabel( $email ); |
|
| 167 | - $item->getPaymentAddress()->setEmail( $email ); |
|
| 168 | - $item->setPassword( $password ); |
|
| 169 | - $item->setStatus( 1 ); |
|
| 165 | + $item->setCode($email); |
|
| 166 | + $item->setLabel($email); |
|
| 167 | + $item->getPaymentAddress()->setEmail($email); |
|
| 168 | + $item->setPassword($password); |
|
| 169 | + $item->setStatus(1); |
|
| 170 | 170 | |
| 171 | - $manager->saveItem( $item ); |
|
| 171 | + $manager->saveItem($item); |
|
| 172 | 172 | |
| 173 | 173 | return $item; |
| 174 | 174 | } |
@@ -181,21 +181,21 @@ discard block |
||
| 181 | 181 | * @param string $code Unique customer group code |
| 182 | 182 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
| 183 | 183 | */ |
| 184 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
| 184 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
| 185 | 185 | { |
| 186 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
| 186 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
| 187 | 187 | |
| 188 | 188 | try |
| 189 | 189 | { |
| 190 | - $item = $manager->findItem( $code ); |
|
| 190 | + $item = $manager->findItem($code); |
|
| 191 | 191 | } |
| 192 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 192 | + catch (\Aimeos\MShop\Exception $e) |
|
| 193 | 193 | { |
| 194 | 194 | $item = $manager->createItem(); |
| 195 | - $item->setLabel( $code ); |
|
| 196 | - $item->setCode( $code ); |
|
| 195 | + $item->setLabel($code); |
|
| 196 | + $item->setCode($code); |
|
| 197 | 197 | |
| 198 | - $manager->saveItem( $item ); |
|
| 198 | + $manager->saveItem($item); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return $item; |