@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | * @param string $classname Name of the setup task class |
| 26 | 26 | * @return boolean True if class is found, false if not |
| 27 | 27 | */ |
| 28 | - public static function autoload( $classname ) |
|
| 28 | + public static function autoload($classname) |
|
| 29 | 29 | { |
| 30 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
| 30 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
| 31 | 31 | { |
| 32 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
| 33 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
| 32 | + $fileName = substr($classname, 21) . '.php'; |
|
| 33 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
| 34 | 34 | |
| 35 | - foreach( $paths as $path ) |
|
| 35 | + foreach ($paths as $path) |
|
| 36 | 36 | { |
| 37 | 37 | $file = $path . DIRECTORY_SEPARATOR . $fileName; |
| 38 | 38 | |
| 39 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
| 39 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function configure() |
| 53 | 53 | { |
| 54 | - $this->setName( 'aimeos:setup'); |
|
| 55 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
| 56 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
| 57 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
| 58 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
| 54 | + $this->setName('aimeos:setup'); |
|
| 55 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
| 56 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
| 57 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
| 58 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -65,35 +65,35 @@ discard block |
||
| 65 | 65 | * @param InputInterface $input Input object |
| 66 | 66 | * @param OutputInterface $output Output object |
| 67 | 67 | */ |
| 68 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
| 68 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 69 | 69 | { |
| 70 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false ); |
|
| 71 | - $ctx->setEditor( 'aimeos:setup' ); |
|
| 70 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false); |
|
| 71 | + $ctx->setEditor('aimeos:setup'); |
|
| 72 | 72 | |
| 73 | 73 | $config = $ctx->getConfig(); |
| 74 | - $site = $input->getArgument( 'site' ); |
|
| 75 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
| 74 | + $site = $input->getArgument('site'); |
|
| 75 | + $tplsite = $input->getArgument('tplsite'); |
|
| 76 | 76 | |
| 77 | - $config->set( 'setup/site', $site ); |
|
| 78 | - $dbconfig = $this->getDbConfig( $config ); |
|
| 79 | - $this->setOptions( $config, $input ); |
|
| 77 | + $config->set('setup/site', $site); |
|
| 78 | + $dbconfig = $this->getDbConfig($config); |
|
| 79 | + $this->setOptions($config, $input); |
|
| 80 | 80 | |
| 81 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
| 81 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
| 82 | 82 | |
| 83 | 83 | $includePaths = $taskPaths; |
| 84 | 84 | $includePaths[] = get_include_path(); |
| 85 | 85 | |
| 86 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
| 87 | - throw new \Exception( 'Unable to extend include path' ); |
|
| 86 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
| 87 | + throw new \Exception('Unable to extend include path'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true ); |
|
| 90 | + spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true); |
|
| 91 | 91 | |
| 92 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
| 92 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
| 93 | 93 | |
| 94 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
| 94 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
| 95 | 95 | |
| 96 | - $manager->run( 'mysql' ); |
|
| 96 | + $manager->run('mysql'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @param \Aimeos\MW\Config\Iface $conf Config object |
| 104 | 104 | * @return array Multi-dimensional associative list of database configuration parameters |
| 105 | 105 | */ |
| 106 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
| 106 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
| 107 | 107 | { |
| 108 | - $dbconfig = $conf->get( 'resource', array() ); |
|
| 108 | + $dbconfig = $conf->get('resource', array()); |
|
| 109 | 109 | |
| 110 | - foreach( $dbconfig as $rname => $dbconf ) |
|
| 110 | + foreach ($dbconfig as $rname => $dbconf) |
|
| 111 | 111 | { |
| 112 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
| 113 | - unset( $dbconfig[$rname] ); |
|
| 112 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
| 113 | + unset($dbconfig[$rname]); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | * @param array Associative list of database configurations |
| 127 | 127 | * @throws \RuntimeException If the format of the options is invalid |
| 128 | 128 | */ |
| 129 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
| 129 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
| 130 | 130 | { |
| 131 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
| 131 | + foreach ((array) $input->getOption('option') as $option) |
|
| 132 | 132 | { |
| 133 | - list( $name, $value ) = explode( ':', $option ); |
|
| 134 | - $conf->set( $name, $value ); |
|
| 133 | + list($name, $value) = explode(':', $option); |
|
| 134 | + $conf->set($name, $value); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Single entry point for all JSON admin requests. |
| 90 | 90 | * |
| 91 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 91 | + * @param Request $request Symfony request object |
|
| 92 | 92 | * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response |
| 93 | 93 | */ |
| 94 | 94 | public function doAction( Request $request ) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * Creates a list of all available translations. |
| 150 | 150 | * |
| 151 | 151 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 152 | - * @return array List of language IDs with labels |
|
| 152 | + * @return string List of language IDs with labels |
|
| 153 | 153 | */ |
| 154 | 154 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
| 155 | 155 | { |
@@ -32,56 +32,56 @@ discard block |
||
| 32 | 32 | * @param integer $tab Number of the currently active tab |
| 33 | 33 | * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface |
| 34 | 34 | */ |
| 35 | - public function indexAction( $site = 'default', $lang, $tab ) |
|
| 35 | + public function indexAction($site = 'default', $lang, $tab) |
|
| 36 | 36 | { |
| 37 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 38 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 37 | + $context = $this->get('aimeos_context')->get(false); |
|
| 38 | + $context = $this->setLocale($context, $site, $lang); |
|
| 39 | 39 | |
| 40 | - $aimeos = $this->get( 'aimeos' ); |
|
| 40 | + $aimeos = $this->get('aimeos'); |
|
| 41 | 41 | $bootstrap = $aimeos->get(); |
| 42 | 42 | |
| 43 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
| 44 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 43 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
| 44 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 45 | 45 | $cssFiles = array(); |
| 46 | 46 | |
| 47 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 47 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 48 | 48 | { |
| 49 | - foreach( $paths as $path ) |
|
| 49 | + foreach ($paths as $path) |
|
| 50 | 50 | { |
| 51 | 51 | $jsbAbsPath = $base . '/' . $path; |
| 52 | 52 | |
| 53 | - if( !is_file( $jsbAbsPath ) ) { |
|
| 54 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
| 53 | + if (!is_file($jsbAbsPath)) { |
|
| 54 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
| 58 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
| 57 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
| 58 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
| 63 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
| 62 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
| 63 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
| 64 | 64 | |
| 65 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
| 66 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
| 65 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
| 66 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
| 67 | 67 | |
| 68 | 68 | $vars = array( |
| 69 | 69 | 'lang' => $lang, |
| 70 | 70 | 'cssFiles' => $cssFiles, |
| 71 | - 'languages' => $this->getJsonLanguages( $context), |
|
| 72 | - 'config' => $this->getJsonClientConfig( $context ), |
|
| 73 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
| 74 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
| 71 | + 'languages' => $this->getJsonLanguages($context), |
|
| 72 | + 'config' => $this->getJsonClientConfig($context), |
|
| 73 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
| 74 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
| 75 | 75 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 76 | 76 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 77 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 78 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
| 79 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
| 77 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 78 | + 'urlTemplate' => urldecode($adminUrl), |
|
| 79 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
| 80 | 80 | 'version' => $aimeos->getVersion(), |
| 81 | 81 | 'activeTab' => $tab, |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
| 84 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -91,22 +91,22 @@ discard block |
||
| 91 | 91 | * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
| 92 | 92 | * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response |
| 93 | 93 | */ |
| 94 | - public function doAction( Request $request ) |
|
| 94 | + public function doAction(Request $request) |
|
| 95 | 95 | { |
| 96 | 96 | $csrfProvider = $this->get('security.csrf.token_manager'); |
| 97 | 97 | |
| 98 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
| 99 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
| 98 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
| 99 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
| 103 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 104 | - $context = $this->setLocale( $context ); |
|
| 102 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
| 103 | + $context = $this->get('aimeos_context')->get(false); |
|
| 104 | + $context = $this->setLocale($context); |
|
| 105 | 105 | |
| 106 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 106 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 107 | 107 | |
| 108 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
| 109 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
| 108 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
| 109 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
@@ -119,27 +119,27 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $contents = ''; |
| 121 | 121 | $jsFiles = array(); |
| 122 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 122 | + $aimeos = $this->get('aimeos')->get(); |
|
| 123 | 123 | |
| 124 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 124 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 125 | 125 | { |
| 126 | - foreach( $paths as $path ) |
|
| 126 | + foreach ($paths as $path) |
|
| 127 | 127 | { |
| 128 | 128 | $jsbAbsPath = $base . '/' . $path; |
| 129 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 130 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
| 129 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 130 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - foreach( $jsFiles as $file ) |
|
| 134 | + foreach ($jsFiles as $file) |
|
| 135 | 135 | { |
| 136 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 136 | + if (($content = file_get_contents($file)) !== false) { |
|
| 137 | 137 | $contents .= $content; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $response = new Response( $contents ); |
|
| 142 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
| 141 | + $response = new Response($contents); |
|
| 142 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
| 143 | 143 | |
| 144 | 144 | return $response; |
| 145 | 145 | } |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 152 | 152 | * @return array List of language IDs with labels |
| 153 | 153 | */ |
| 154 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 154 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 155 | 155 | { |
| 156 | 156 | $result = array(); |
| 157 | 157 | |
| 158 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
| 159 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
| 158 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
| 159 | + $result[] = array('id' => $id, 'label' => $id); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - return json_encode( $result ); |
|
| 162 | + return json_encode($result); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 170 | 170 | * @return string JSON encoded configuration object |
| 171 | 171 | */ |
| 172 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 172 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 173 | 173 | { |
| 174 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 175 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 174 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 175 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -183,16 +183,16 @@ discard block |
||
| 183 | 183 | * @param string $lang ISO language code like "en" or "en_GB" |
| 184 | 184 | * @return string JSON encoded translation object |
| 185 | 185 | */ |
| 186 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 186 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 187 | 187 | { |
| 188 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
| 188 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
| 189 | 189 | |
| 190 | 190 | $content = array( |
| 191 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 192 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 191 | + 'admin' => $i18n->getAll('admin'), |
|
| 192 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 195 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -204,19 +204,19 @@ discard block |
||
| 204 | 204 | * @return string JSON encoded site item object |
| 205 | 205 | * @throws Exception If no site item was found for the code |
| 206 | 206 | */ |
| 207 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 207 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 208 | 208 | { |
| 209 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 209 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 210 | 210 | |
| 211 | 211 | $criteria = $manager->createSearch(); |
| 212 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 213 | - $items = $manager->searchItems( $criteria ); |
|
| 212 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 213 | + $items = $manager->searchItems($criteria); |
|
| 214 | 214 | |
| 215 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 216 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 215 | + if (($item = reset($items)) === false) { |
|
| 216 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - return json_encode( $item->toArray() ); |
|
| 219 | + return json_encode($item->toArray()); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -228,17 +228,17 @@ discard block |
||
| 228 | 228 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 229 | 229 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 230 | 230 | */ |
| 231 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 231 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 232 | 232 | { |
| 233 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 233 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 234 | 234 | |
| 235 | 235 | try { |
| 236 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 237 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 236 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 237 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 238 | 238 | $localeItem = $localeManager->createItem(); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $context->setLocale( $localeItem ); |
|
| 241 | + $context->setLocale($localeItem); |
|
| 242 | 242 | |
| 243 | 243 | return $context; |
| 244 | 244 | } |
@@ -26,11 +26,10 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Returns the HTML code for a copy of a resource object |
| 28 | 28 | * |
| 29 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 29 | + * @param Request $request Symfony request object |
|
| 30 | 30 | * @param string $resource Resource location, e.g. "product" |
| 31 | 31 | * @param integer $id Unique resource ID |
| 32 | - * @param string $sitecode Unique site code |
|
| 33 | - * @return string Generated output |
|
| 32 | + * @return Response Generated output |
|
| 34 | 33 | */ |
| 35 | 34 | public function copyAction( Request $request, $resource, $id, $site = 'default' ) |
| 36 | 35 | { |
@@ -42,10 +41,9 @@ discard block |
||
| 42 | 41 | /** |
| 43 | 42 | * Returns the HTML code for a new resource object |
| 44 | 43 | * |
| 45 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 44 | + * @param Request $request Symfony request object |
|
| 46 | 45 | * @param string $resource Resource location, e.g. "product" |
| 47 | - * @param string $sitecode Unique site code |
|
| 48 | - * @return string Generated output |
|
| 46 | + * @return Response Generated output |
|
| 49 | 47 | */ |
| 50 | 48 | public function createAction( Request $request, $resource, $site = 'default' ) |
| 51 | 49 | { |
@@ -57,11 +55,10 @@ discard block |
||
| 57 | 55 | /** |
| 58 | 56 | * Deletes the resource object or a list of resource objects |
| 59 | 57 | * |
| 60 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 58 | + * @param Request $request Symfony request object |
|
| 61 | 59 | * @param string $resource Resource location, e.g. "product" |
| 62 | 60 | * @param integer $id Unique resource ID |
| 63 | - * @param string $sitecode Unique site code |
|
| 64 | - * @return string Generated output |
|
| 61 | + * @return Response Generated output |
|
| 65 | 62 | */ |
| 66 | 63 | public function deleteAction( Request $request, $resource, $id, $site = 'default' ) |
| 67 | 64 | { |
@@ -73,11 +70,10 @@ discard block |
||
| 73 | 70 | /** |
| 74 | 71 | * Returns the HTML code for the requested resource object |
| 75 | 72 | * |
| 76 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 73 | + * @param Request $request Symfony request object |
|
| 77 | 74 | * @param string $resource Resource location, e.g. "product" |
| 78 | 75 | * @param integer $id Unique resource ID |
| 79 | - * @param string $sitecode Unique site code |
|
| 80 | - * @return string Generated output |
|
| 76 | + * @return Response Generated output |
|
| 81 | 77 | */ |
| 82 | 78 | public function getAction( Request $request, $resource, $id, $site = 'default' ) |
| 83 | 79 | { |
@@ -89,10 +85,9 @@ discard block |
||
| 89 | 85 | /** |
| 90 | 86 | * Saves a new resource object |
| 91 | 87 | * |
| 92 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 88 | + * @param Request $request Symfony request object |
|
| 93 | 89 | * @param string $resource Resource location, e.g. "product" |
| 94 | - * @param string $sitecode Unique site code |
|
| 95 | - * @return string Generated output |
|
| 90 | + * @return Response Generated output |
|
| 96 | 91 | */ |
| 97 | 92 | public function saveAction( Request $request, $resource, $site = 'default' ) |
| 98 | 93 | { |
@@ -104,10 +99,9 @@ discard block |
||
| 104 | 99 | /** |
| 105 | 100 | * Returns the HTML code for a list of resource objects |
| 106 | 101 | * |
| 107 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 102 | + * @param Request $request Symfony request object |
|
| 108 | 103 | * @param string $resource Resource location, e.g. "product" |
| 109 | - * @param string $sitecode Unique site code |
|
| 110 | - * @return string Generated output |
|
| 104 | + * @return Response Generated output |
|
| 111 | 105 | */ |
| 112 | 106 | public function searchAction( Request $request, $resource, $site = 'default' ) |
| 113 | 107 | { |
@@ -119,10 +113,11 @@ discard block |
||
| 119 | 113 | /** |
| 120 | 114 | * Returns the resource controller |
| 121 | 115 | * |
| 122 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
| 116 | + * @param Request $request Symfony request object |
|
| 123 | 117 | * @param string $sitecode Unique site code |
| 124 | 118 | * @param string Resource location, e.g. "product" |
| 125 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
| 119 | + * @param string $resource |
|
| 120 | + * @return \Aimeos\Admin\JQAdm\Iface Context item |
|
| 126 | 121 | */ |
| 127 | 122 | protected function createClient( Request $request, $sitecode, $resource ) |
| 128 | 123 | { |
@@ -146,7 +141,7 @@ discard block |
||
| 146 | 141 | * |
| 147 | 142 | * @param string $site Unique site code |
| 148 | 143 | * @param string $content Content from admin client |
| 149 | - * @return \Illuminate\Contracts\View\View View for rendering the output |
|
| 144 | + * @return Response View for rendering the output |
|
| 150 | 145 | */ |
| 151 | 146 | protected function getHtml( $site, $content ) |
| 152 | 147 | { |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace Aimeos\ShopBundle\Controller; |
| 12 | 12 | |
| 13 | 13 | use Symfony\Component\HttpFoundation\Request; |
| 14 | -use Symfony\Component\HttpFoundation\Response; |
|
| 15 | 14 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 16 | 15 | |
| 17 | 16 | |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | * @param string $sitecode Unique site code |
| 33 | 33 | * @return string Generated output |
| 34 | 34 | */ |
| 35 | - public function copyAction( Request $request, $resource, $id, $site = 'default' ) |
|
| 35 | + public function copyAction(Request $request, $resource, $id, $site = 'default') |
|
| 36 | 36 | { |
| 37 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 38 | - return $this->getHtml( $site, $cntl->copy( $id ) ); |
|
| 37 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 38 | + return $this->getHtml($site, $cntl->copy($id)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | * @param string $sitecode Unique site code |
| 48 | 48 | * @return string Generated output |
| 49 | 49 | */ |
| 50 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
| 50 | + public function createAction(Request $request, $resource, $site = 'default') |
|
| 51 | 51 | { |
| 52 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 53 | - return $this->getHtml( $site, $cntl->create() ); |
|
| 52 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 53 | + return $this->getHtml($site, $cntl->create()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | * @param string $sitecode Unique site code |
| 64 | 64 | * @return string Generated output |
| 65 | 65 | */ |
| 66 | - public function deleteAction( Request $request, $resource, $id, $site = 'default' ) |
|
| 66 | + public function deleteAction(Request $request, $resource, $id, $site = 'default') |
|
| 67 | 67 | { |
| 68 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 69 | - return $this->getHtml( $site, $cntl->delete( $id ) . $cntl->search() ); |
|
| 68 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 69 | + return $this->getHtml($site, $cntl->delete($id) . $cntl->search()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @param string $sitecode Unique site code |
| 80 | 80 | * @return string Generated output |
| 81 | 81 | */ |
| 82 | - public function getAction( Request $request, $resource, $id, $site = 'default' ) |
|
| 82 | + public function getAction(Request $request, $resource, $id, $site = 'default') |
|
| 83 | 83 | { |
| 84 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 85 | - return $this->getHtml( $site, $cntl->get( $id ) ); |
|
| 84 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 85 | + return $this->getHtml($site, $cntl->get($id)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | * @param string $sitecode Unique site code |
| 95 | 95 | * @return string Generated output |
| 96 | 96 | */ |
| 97 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
| 97 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
| 98 | 98 | { |
| 99 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 100 | - return $this->getHtml( $site, ( $cntl->save() ? : $cntl->search() ) ); |
|
| 99 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 100 | + return $this->getHtml($site, ($cntl->save() ?: $cntl->search())); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * @param string $sitecode Unique site code |
| 110 | 110 | * @return string Generated output |
| 111 | 111 | */ |
| 112 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
| 112 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
| 113 | 113 | { |
| 114 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 115 | - return $this->getHtml( $site, $cntl->search() ); |
|
| 114 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 115 | + return $this->getHtml($site, $cntl->search()); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -124,20 +124,20 @@ discard block |
||
| 124 | 124 | * @param string Resource location, e.g. "product" |
| 125 | 125 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
| 126 | 126 | */ |
| 127 | - protected function createClient( Request $request, $sitecode, $resource ) |
|
| 127 | + protected function createClient(Request $request, $sitecode, $resource) |
|
| 128 | 128 | { |
| 129 | - $lang = $request->get( 'lang', 'en' ); |
|
| 129 | + $lang = $request->get('lang', 'en'); |
|
| 130 | 130 | |
| 131 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 132 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 131 | + $aimeos = $this->get('aimeos')->get(); |
|
| 132 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 133 | 133 | |
| 134 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 135 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
| 134 | + $context = $this->get('aimeos_context')->get(false); |
|
| 135 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
| 136 | 136 | |
| 137 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
| 138 | - $context->setView( $view ); |
|
| 137 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
| 138 | + $context->setView($view); |
|
| 139 | 139 | |
| 140 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 140 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | * @param string $content Content from admin client |
| 149 | 149 | * @return \Illuminate\Contracts\View\View View for rendering the output |
| 150 | 150 | */ |
| 151 | - protected function getHtml( $site, $content ) |
|
| 151 | + protected function getHtml($site, $content) |
|
| 152 | 152 | { |
| 153 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
| 154 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
| 153 | + $version = $this->get('aimeos')->getVersion(); |
|
| 154 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
| 155 | 155 | |
| 156 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
| 156 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
@@ -165,23 +165,23 @@ discard block |
||
| 165 | 165 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 166 | 166 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 167 | 167 | */ |
| 168 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null ) |
|
| 168 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null) |
|
| 169 | 169 | { |
| 170 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 170 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 171 | 171 | |
| 172 | 172 | try |
| 173 | 173 | { |
| 174 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
| 175 | - $localeItem->setLanguageId( null ); |
|
| 176 | - $localeItem->setCurrencyId( null ); |
|
| 174 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
| 175 | + $localeItem->setLanguageId(null); |
|
| 176 | + $localeItem->setCurrencyId(null); |
|
| 177 | 177 | } |
| 178 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 178 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 179 | 179 | { |
| 180 | 180 | $localeItem = $localeManager->createItem(); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $context->setLocale( $localeItem ); |
|
| 184 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang ) ) ); |
|
| 183 | + $context->setLocale($localeItem); |
|
| 184 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
| 185 | 185 | |
| 186 | 186 | return $context; |
| 187 | 187 | } |
@@ -210,8 +210,7 @@ |
||
| 210 | 210 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
| 211 | 211 | $localeItem->setLanguageId( null ); |
| 212 | 212 | $localeItem->setCurrencyId( null ); |
| 213 | - } |
|
| 214 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 213 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 215 | 214 | { |
| 216 | 215 | $localeItem = $localeManager->createItem(); |
| 217 | 216 | } |
@@ -12,29 +12,29 @@ discard block |
||
| 12 | 12 | $client = static::createClient(array(), array( |
| 13 | 13 | 'PHP_AUTH_USER' => 'admin', |
| 14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
| 15 | - ) ); |
|
| 15 | + )); |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | - $client->request( 'OPTIONS', '/unittest/jsonadm/product' ); |
|
| 18 | + $client->request('OPTIONS', '/unittest/jsonadm/product'); |
|
| 19 | 19 | $response = $client->getResponse(); |
| 20 | 20 | |
| 21 | - $json = json_decode( $response->getContent(), true ); |
|
| 21 | + $json = json_decode($response->getContent(), true); |
|
| 22 | 22 | |
| 23 | - $this->assertNotNull( $json ); |
|
| 24 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 25 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
| 26 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
| 23 | + $this->assertNotNull($json); |
|
| 24 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 25 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
| 26 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - $client->request( 'OPTIONS', '/unittest/jsonadm' ); |
|
| 29 | + $client->request('OPTIONS', '/unittest/jsonadm'); |
|
| 30 | 30 | $response = $client->getResponse(); |
| 31 | 31 | |
| 32 | - $json = json_decode( $response->getContent(), true ); |
|
| 32 | + $json = json_decode($response->getContent(), true); |
|
| 33 | 33 | |
| 34 | - $this->assertNotNull( $json ); |
|
| 35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 36 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
| 37 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
| 34 | + $this->assertNotNull($json); |
|
| 35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 36 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
| 37 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -43,62 +43,62 @@ discard block |
||
| 43 | 43 | $client = static::createClient(array(), array( |
| 44 | 44 | 'PHP_AUTH_USER' => 'admin', |
| 45 | 45 | 'PHP_AUTH_PW' => 'adminpass', |
| 46 | - ) ); |
|
| 46 | + )); |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}}'; |
| 50 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
| 50 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
| 51 | 51 | $response = $client->getResponse(); |
| 52 | 52 | |
| 53 | - $json = json_decode( $response->getContent(), true ); |
|
| 53 | + $json = json_decode($response->getContent(), true); |
|
| 54 | 54 | |
| 55 | - $this->assertNotNull( $json ); |
|
| 56 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
| 57 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
| 58 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
| 59 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
| 60 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
| 55 | + $this->assertNotNull($json); |
|
| 56 | + $this->assertEquals(201, $response->getStatusCode()); |
|
| 57 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
| 58 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.code']); |
|
| 59 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.label']); |
|
| 60 | + $this->assertEquals(1, $json['meta']['total']); |
|
| 61 | 61 | |
| 62 | 62 | $id = $json['data']['attributes']['product.stock.warehouse.id']; |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony2"}}}'; |
| 66 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content ); |
|
| 66 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content); |
|
| 67 | 67 | $response = $client->getResponse(); |
| 68 | 68 | |
| 69 | - $json = json_decode( $response->getContent(), true ); |
|
| 69 | + $json = json_decode($response->getContent(), true); |
|
| 70 | 70 | |
| 71 | - $this->assertNotNull( $json ); |
|
| 72 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 73 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
| 74 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
| 75 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
| 76 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
| 77 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
| 71 | + $this->assertNotNull($json); |
|
| 72 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 73 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
| 74 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
| 75 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
| 76 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
| 77 | + $this->assertEquals(1, $json['meta']['total']); |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
| 80 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
| 81 | 81 | $response = $client->getResponse(); |
| 82 | 82 | |
| 83 | - $json = json_decode( $response->getContent(), true ); |
|
| 83 | + $json = json_decode($response->getContent(), true); |
|
| 84 | 84 | |
| 85 | - $this->assertNotNull( $json ); |
|
| 86 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 87 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
| 88 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
| 89 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
| 90 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
| 91 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
| 85 | + $this->assertNotNull($json); |
|
| 86 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 87 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
| 88 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
| 89 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
| 90 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
| 91 | + $this->assertEquals(1, $json['meta']['total']); |
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
| 94 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
| 95 | 95 | $response = $client->getResponse(); |
| 96 | 96 | |
| 97 | - $json = json_decode( $response->getContent(), true ); |
|
| 97 | + $json = json_decode($response->getContent(), true); |
|
| 98 | 98 | |
| 99 | - $this->assertNotNull( $json ); |
|
| 100 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 101 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
| 99 | + $this->assertNotNull($json); |
|
| 100 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 101 | + $this->assertEquals(1, $json['meta']['total']); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -107,85 +107,85 @@ discard block |
||
| 107 | 107 | $client = static::createClient(array(), array( |
| 108 | 108 | 'PHP_AUTH_USER' => 'admin', |
| 109 | 109 | 'PHP_AUTH_PW' => 'adminpass', |
| 110 | - ) ); |
|
| 110 | + )); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | $content = '{"data":[ |
| 114 | 114 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}, |
| 115 | 115 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony"}} |
| 116 | 116 | ]}'; |
| 117 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
| 117 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
| 118 | 118 | $response = $client->getResponse(); |
| 119 | 119 | |
| 120 | - $json = json_decode( $response->getContent(), true ); |
|
| 120 | + $json = json_decode($response->getContent(), true); |
|
| 121 | 121 | |
| 122 | - $this->assertNotNull( $json ); |
|
| 123 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
| 124 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
| 125 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
| 126 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
| 127 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
| 128 | - $this->assertEquals( 'symfony', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
| 129 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
| 122 | + $this->assertNotNull($json); |
|
| 123 | + $this->assertEquals(201, $response->getStatusCode()); |
|
| 124 | + $this->assertEquals(2, count($json['data'])); |
|
| 125 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
| 126 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
| 127 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
| 128 | + $this->assertEquals('symfony', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
| 129 | + $this->assertEquals(2, $json['meta']['total']); |
|
| 130 | 130 | |
| 131 | - $ids = array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id'] ); |
|
| 131 | + $ids = array($json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id']); |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | $content = '{"data":[ |
| 135 | 135 | {"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
| 136 | 136 | {"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}} |
| 137 | 137 | ]}'; |
| 138 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
| 138 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
| 139 | 139 | $response = $client->getResponse(); |
| 140 | 140 | |
| 141 | - $json = json_decode( $response->getContent(), true ); |
|
| 142 | - |
|
| 143 | - $this->assertNotNull( $json ); |
|
| 144 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 145 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
| 146 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
| 147 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
| 148 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
| 149 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
| 150 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
| 151 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
| 152 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - $getParams = array( 'filter' => array( '&&' => array( |
|
| 156 | - array( '=~' => array( 'product.stock.warehouse.code' => 'symfony' ) ), |
|
| 157 | - array( '==' => array( 'product.stock.warehouse.label' => 'symfony2' ) ) |
|
| 158 | - ) ), |
|
| 159 | - 'sort' => 'product.stock.warehouse.code', 'page' => array( 'offset' => 0, 'limit' => 3 ) |
|
| 141 | + $json = json_decode($response->getContent(), true); |
|
| 142 | + |
|
| 143 | + $this->assertNotNull($json); |
|
| 144 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 145 | + $this->assertEquals(2, count($json['data'])); |
|
| 146 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
| 147 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
| 148 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
| 149 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
| 150 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
| 151 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
| 152 | + $this->assertEquals(2, $json['meta']['total']); |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + $getParams = array('filter' => array('&&' => array( |
|
| 156 | + array('=~' => array('product.stock.warehouse.code' => 'symfony')), |
|
| 157 | + array('==' => array('product.stock.warehouse.label' => 'symfony2')) |
|
| 158 | + )), |
|
| 159 | + 'sort' => 'product.stock.warehouse.code', 'page' => array('offset' => 0, 'limit' => 3) |
|
| 160 | 160 | ); |
| 161 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse', $getParams ); |
|
| 161 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse', $getParams); |
|
| 162 | 162 | $response = $client->getResponse(); |
| 163 | 163 | |
| 164 | - $json = json_decode( $response->getContent(), true ); |
|
| 164 | + $json = json_decode($response->getContent(), true); |
|
| 165 | 165 | |
| 166 | - $this->assertNotNull( $json ); |
|
| 167 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 168 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
| 169 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.code'] ); |
|
| 170 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code'] ); |
|
| 171 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
| 172 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
| 173 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
| 174 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
| 175 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
| 166 | + $this->assertNotNull($json); |
|
| 167 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 168 | + $this->assertEquals(2, count($json['data'])); |
|
| 169 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.code']); |
|
| 170 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code']); |
|
| 171 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
| 172 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
| 173 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
| 174 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
| 175 | + $this->assertEquals(2, $json['meta']['total']); |
|
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | $content = '{"data":[ |
| 179 | 179 | {"type":"product/stock/warehouse","id":' . $ids[0] . '}, |
| 180 | 180 | {"type":"product/stock/warehouse","id":' . $ids[1] . '} |
| 181 | 181 | ]}'; |
| 182 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
| 182 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
| 183 | 183 | $response = $client->getResponse(); |
| 184 | 184 | |
| 185 | - $json = json_decode( $response->getContent(), true ); |
|
| 185 | + $json = json_decode($response->getContent(), true); |
|
| 186 | 186 | |
| 187 | - $this->assertNotNull( $json ); |
|
| 188 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 189 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
| 187 | + $this->assertNotNull($json); |
|
| 188 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 189 | + $this->assertEquals(2, $json['meta']['total']); |
|
| 190 | 190 | } |
| 191 | 191 | } |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | $client = static::createClient(array(), array( |
| 13 | 13 | 'PHP_AUTH_USER' => 'admin', |
| 14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
| 15 | - ) ); |
|
| 16 | - $crawler = $client->request( 'GET', '/unittest/extadm/de/0' ); |
|
| 15 | + )); |
|
| 16 | + $crawler = $client->request('GET', '/unittest/extadm/de/0'); |
|
| 17 | 17 | |
| 18 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 19 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() ); |
|
| 20 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
| 18 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 19 | + $this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count()); |
|
| 20 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,17 +26,17 @@ discard block |
||
| 26 | 26 | $client = static::createClient(array(), array( |
| 27 | 27 | 'PHP_AUTH_USER' => 'admin', |
| 28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
| 29 | - ) ); |
|
| 29 | + )); |
|
| 30 | 30 | |
| 31 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
| 31 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
| 32 | 32 | |
| 33 | - $client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
| 33 | + $client->request('POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
| 34 | 34 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
| 35 | 35 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 39 | - $this->assertStringStartsWith( '{', $client->getResponse()->getContent() ); |
|
| 38 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 39 | + $this->assertStringStartsWith('{', $client->getResponse()->getContent()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | $client = static::createClient(array(), array( |
| 46 | 46 | 'PHP_AUTH_USER' => 'admin', |
| 47 | 47 | 'PHP_AUTH_PW' => 'adminpass', |
| 48 | - ) ); |
|
| 48 | + )); |
|
| 49 | 49 | |
| 50 | - $client->request( 'GET', '/unittest/extadm/file' ); |
|
| 50 | + $client->request('GET', '/unittest/extadm/file'); |
|
| 51 | 51 | |
| 52 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
| 53 | - $this->assertContains( 'EXTUTIL', $client->getResponse()->getContent() ); |
|
| 52 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 53 | + $this->assertContains('EXTUTIL', $client->getResponse()->getContent()); |
|
| 54 | 54 | } |
| 55 | 55 | } |
@@ -12,13 +12,13 @@ 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/copy/product/0' ); |
|
| 17 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
| 18 | 18 | $response = $client->getResponse(); |
| 19 | 19 | |
| 20 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 21 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 20 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 21 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | $client = static::createClient(array(), array( |
| 28 | 28 | 'PHP_AUTH_USER' => 'admin', |
| 29 | 29 | 'PHP_AUTH_PW' => 'adminpass', |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
| 32 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
| 33 | 33 | $response = $client->getResponse(); |
| 34 | 34 | |
| 35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 36 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 36 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $client = static::createClient(array(), array( |
| 43 | 43 | 'PHP_AUTH_USER' => 'admin', |
| 44 | 44 | 'PHP_AUTH_PW' => 'adminpass', |
| 45 | - ) ); |
|
| 45 | + )); |
|
| 46 | 46 | |
| 47 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
| 47 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
| 48 | 48 | $response = $client->getResponse(); |
| 49 | 49 | |
| 50 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 51 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 50 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 51 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | $client = static::createClient(array(), array( |
| 58 | 58 | 'PHP_AUTH_USER' => 'admin', |
| 59 | 59 | 'PHP_AUTH_PW' => 'adminpass', |
| 60 | - ) ); |
|
| 60 | + )); |
|
| 61 | 61 | |
| 62 | - $client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
|
| 62 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
| 63 | 63 | $response = $client->getResponse(); |
| 64 | 64 | |
| 65 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 66 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 65 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 66 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | $client = static::createClient(array(), array( |
| 73 | 73 | 'PHP_AUTH_USER' => 'admin', |
| 74 | 74 | 'PHP_AUTH_PW' => 'adminpass', |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | |
| 77 | - $client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
|
| 77 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
| 78 | 78 | $response = $client->getResponse(); |
| 79 | 79 | |
| 80 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 81 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 80 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 81 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | $client = static::createClient(array(), array( |
| 88 | 88 | 'PHP_AUTH_USER' => 'admin', |
| 89 | 89 | 'PHP_AUTH_PW' => 'adminpass', |
| 90 | - ) ); |
|
| 90 | + )); |
|
| 91 | 91 | |
| 92 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
| 92 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
| 93 | 93 | $response = $client->getResponse(); |
| 94 | 94 | |
| 95 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 96 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 95 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 96 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | $client = static::createClient(array(), array( |
| 103 | 103 | 'PHP_AUTH_USER' => 'admin', |
| 104 | 104 | 'PHP_AUTH_PW' => 'adminpass', |
| 105 | - ) ); |
|
| 105 | + )); |
|
| 106 | 106 | |
| 107 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
| 107 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
| 108 | 108 | $response = $client->getResponse(); |
| 109 | 109 | |
| 110 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 111 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 110 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 111 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 112 | 112 | } |
| 113 | 113 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param Container $container Container object to access parameters |
| 31 | 31 | */ |
| 32 | - public function __construct( Container $container ) |
|
| 32 | + public function __construct(Container $container) |
|
| 33 | 33 | { |
| 34 | 34 | $this->container = $container; |
| 35 | 35 | } |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function get() |
| 44 | 44 | { |
| 45 | - if( $this->object === null ) |
|
| 45 | + if ($this->object === null) |
|
| 46 | 46 | { |
| 47 | - $extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' ); |
|
| 48 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
| 47 | + $extDirs = (array) $this->container->getParameter('aimeos_shop.extdir'); |
|
| 48 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $this->object; |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function getVersion() |
| 61 | 61 | { |
| 62 | - $filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
| 62 | + $filename = dirname($this->container->get('kernel')->getRootDir()) . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
| 63 | 63 | |
| 64 | - if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false |
|
| 65 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
| 64 | + if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false |
|
| 65 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
| 66 | 66 | ) { |
| 67 | - foreach( (array) $content['packages'] as $item ) |
|
| 67 | + foreach ((array) $content['packages'] as $item) |
|
| 68 | 68 | { |
| 69 | - if( $item['name'] === 'aimeos/aimeos-symfony2' ) { |
|
| 69 | + if ($item['name'] === 'aimeos/aimeos-symfony2') { |
|
| 70 | 70 | return $item['version']; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -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/product?lang=en', $response->getContent() ); |
|
| 32 | + $this->assertEquals(302, $response->getStatusCode()); |
|
| 33 | + $this->assertContains('/default/jqadm/search/product?lang=en', $response->getContent()); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | * @param \Symfony\Component\HttpFoundation\Request $request Request object |
| 29 | 29 | * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface |
| 30 | 30 | */ |
| 31 | - public function indexAction( Request $request ) |
|
| 31 | + public function indexAction(Request $request) |
|
| 32 | 32 | { |
| 33 | - if( $this->has( 'security.authorization_checker' ) && ( $service = $this->get( 'security.authorization_checker' ) ) |
|
| 34 | - && $this->get( 'security.token_storage' )->getToken() && $service->isGranted( 'ROLE_ADMIN' ) |
|
| 35 | - || $this->has( 'security.context' ) && ( $service = $this->get( 'security.context' ) ) |
|
| 36 | - && $service->getToken() && $service->isGranted( 'ROLE_ADMIN' ) |
|
| 33 | + if ($this->has('security.authorization_checker') && ($service = $this->get('security.authorization_checker')) |
|
| 34 | + && $this->get('security.token_storage')->getToken() && $service->isGranted('ROLE_ADMIN') |
|
| 35 | + || $this->has('security.context') && ($service = $this->get('security.context')) |
|
| 36 | + && $service->getToken() && $service->isGranted('ROLE_ADMIN') |
|
| 37 | 37 | ) { |
| 38 | - $params = array( 'site' => 'default', 'resource' => 'product', 'lang' => 'en' ); |
|
| 39 | - return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) ); |
|
| 38 | + $params = array('site' => 'default', 'resource' => 'product', 'lang' => 'en'); |
|
| 39 | + return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return $this->render( 'AimeosShopBundle:Admin:index.html.twig', array( 'email' => $request->get( 'email' ) ) ); |
|
| 42 | + return $this->render('AimeosShopBundle:Admin:index.html.twig', array('email' => $request->get('email'))); |
|
| 43 | 43 | } |
| 44 | 44 | } |