@@ -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', '/jqadm/file/css' ); |
|
17 | + $client->request('GET', '/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', '/jqadm/file/js' ); |
|
31 | + $client->request('GET', '/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,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-symfony' ) { |
|
69 | + if ($item['name'] === 'aimeos/aimeos-symfony') { |
|
70 | 70 | return $item['version']; |
71 | 71 | } |
72 | 72 | } |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | * @param CommandEvent $event CommandEvent instance |
29 | 29 | * @throws \RuntimeException If an error occured |
30 | 30 | */ |
31 | - public static function setupDatabase( CommandEvent $event ) |
|
31 | + public static function setupDatabase(CommandEvent $event) |
|
32 | 32 | { |
33 | 33 | $options = $env = array(); |
34 | 34 | |
35 | - if( $event->isDevMode() ) { |
|
35 | + if ($event->isDevMode()) { |
|
36 | 36 | $options[] = '--option=setup/default/demo:1'; |
37 | 37 | } else { |
38 | 38 | $env[] = '--env=prod'; |
39 | 39 | } |
40 | 40 | |
41 | - self::executeCommand( $event, 'aimeos:setup', $options + $env ); |
|
42 | - self::executeCommand( $event, 'aimeos:cache', $env ); |
|
41 | + self::executeCommand($event, 'aimeos:setup', $options + $env); |
|
42 | + self::executeCommand($event, 'aimeos:cache', $env); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -49,30 +49,30 @@ discard block |
||
49 | 49 | * @param CommandEvent $event CommandEvent instance |
50 | 50 | * @throws \RuntimeException If an error occured |
51 | 51 | */ |
52 | - public static function installBundle( CommandEvent $event ) |
|
52 | + public static function installBundle(CommandEvent $event) |
|
53 | 53 | { |
54 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
54 | + $event->getIO()->write('Installing the Aimeos shop bundle'); |
|
55 | 55 | |
56 | - $options = self::getOptions( $event ); |
|
56 | + $options = self::getOptions($event); |
|
57 | 57 | |
58 | - if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) ) |
|
58 | + if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir'])) |
|
59 | 59 | { |
60 | 60 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
61 | - throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) ); |
|
61 | + throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir'])); |
|
62 | 62 | } |
63 | 63 | |
64 | - if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) ) |
|
64 | + if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir'])) |
|
65 | 65 | { |
66 | 66 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
67 | - throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) ); |
|
67 | + throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir'])); |
|
68 | 68 | } |
69 | 69 | |
70 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
71 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
72 | - self::createDirectory( $options['symfony-app-dir'] . '/secure' ); |
|
73 | - self::createDirectory( $options['symfony-web-dir'] . '/uploads' ); |
|
74 | - self::createDirectory( $options['symfony-web-dir'] . '/preview' ); |
|
75 | - self::createDirectory( $options['symfony-web-dir'] . '/files' ); |
|
70 | + self::updateConfigFile($options['symfony-app-dir'].'/config/config.yml'); |
|
71 | + self::updateRoutingFile($options['symfony-app-dir'].'/config/routing.yml'); |
|
72 | + self::createDirectory($options['symfony-app-dir'].'/secure'); |
|
73 | + self::createDirectory($options['symfony-web-dir'].'/uploads'); |
|
74 | + self::createDirectory($options['symfony-web-dir'].'/preview'); |
|
75 | + self::createDirectory($options['symfony-web-dir'].'/files'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * @param string $dir Absolute path of the new directory |
83 | 83 | * @throws \RuntimeException If directory couldn't be created |
84 | 84 | */ |
85 | - protected static function createDirectory( $dir ) |
|
85 | + protected static function createDirectory($dir) |
|
86 | 86 | { |
87 | 87 | $perm = 0755; |
88 | 88 | |
89 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
89 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
90 | 90 | { |
91 | 91 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
92 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
92 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -102,28 +102,28 @@ discard block |
||
102 | 102 | * @param array List of configuration options for the given command |
103 | 103 | * @throws \RuntimeException If the command couldn't be executed |
104 | 104 | */ |
105 | - protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() ) |
|
105 | + protected static function executeCommand(CommandEvent $event, $cmd, array $options = array()) |
|
106 | 106 | { |
107 | - $php = escapeshellarg( self::getPhp() ); |
|
108 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
109 | - $cmd = escapeshellarg( $cmd ); |
|
107 | + $php = escapeshellarg(self::getPhp()); |
|
108 | + $console = escapeshellarg(self::getConsoleDir($event).'/console'); |
|
109 | + $cmd = escapeshellarg($cmd); |
|
110 | 110 | |
111 | - foreach( $options as $key => $option ) { |
|
112 | - $options[$key] = escapeshellarg( $option ); |
|
111 | + foreach ($options as $key => $option) { |
|
112 | + $options[$key] = escapeshellarg($option); |
|
113 | 113 | } |
114 | 114 | |
115 | - if( $event->getIO()->isDecorated() ) { |
|
115 | + if ($event->getIO()->isDecorated()) { |
|
116 | 116 | $console .= ' --ansi'; |
117 | 117 | } |
118 | 118 | |
119 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
119 | + $process = new Process($php.' '.$console.' '.$cmd.' '.implode(' ', $options), null, null, null, 3600); |
|
120 | 120 | |
121 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
122 | - $event->getIO()->write( $buffer, false ); |
|
121 | + $process->run(function($type, $buffer) use ($event) { |
|
122 | + $event->getIO()->write($buffer, false); |
|
123 | 123 | } ); |
124 | 124 | |
125 | - if( !$process->isSuccessful() ) { |
|
126 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
125 | + if (!$process->isSuccessful()) { |
|
126 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | * @return string The path to the console directory |
137 | 137 | * @throws \RuntimeException If console directory couldn't be found |
138 | 138 | */ |
139 | - protected static function getConsoleDir( CommandEvent $event ) |
|
139 | + protected static function getConsoleDir(CommandEvent $event) |
|
140 | 140 | { |
141 | - $options = self::getOptions( $event ); |
|
141 | + $options = self::getOptions($event); |
|
142 | 142 | |
143 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
143 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
144 | 144 | return $options['symfony-bin-dir']; |
145 | 145 | } |
146 | 146 | |
147 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
147 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
148 | 148 | return $options['symfony-app-dir']; |
149 | 149 | } |
150 | 150 | |
151 | - throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) ); |
|
151 | + throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir')); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param CommandEvent $event Command event object |
159 | 159 | * @return array Associative list of option keys and values |
160 | 160 | */ |
161 | - protected static function getOptions( CommandEvent $event ) |
|
161 | + protected static function getOptions(CommandEvent $event) |
|
162 | 162 | { |
163 | 163 | return $event->getComposer()->getPackage()->getExtra(); |
164 | 164 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | { |
175 | 175 | $phpFinder = new PhpExecutableFinder; |
176 | 176 | |
177 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
178 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
177 | + if (!($phpPath = $phpFinder->find())) { |
|
178 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $phpPath; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | * @param string $filename Name of the YAML config file |
189 | 189 | * @throws \RuntimeException If file is not found |
190 | 190 | */ |
191 | - protected static function updateConfigFile( $filename ) |
|
191 | + protected static function updateConfigFile($filename) |
|
192 | 192 | { |
193 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
194 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
193 | + if (($content = file_get_contents($filename)) === false) { |
|
194 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
195 | 195 | } |
196 | 196 | |
197 | - if( self::addAsseticBundle( $content ) === true ) { |
|
197 | + if (self::addAsseticBundle($content) === true) { |
|
198 | 198 | $fs = new Filesystem(); |
199 | - $fs->dumpFile( $filename, $content ); |
|
199 | + $fs->dumpFile($filename, $content); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -207,27 +207,27 @@ discard block |
||
207 | 207 | * @param string $filename Name of the YAML config file |
208 | 208 | * @throws \RuntimeException If file is not found |
209 | 209 | */ |
210 | - protected static function updateRoutingFile( $filename ) |
|
210 | + protected static function updateRoutingFile($filename) |
|
211 | 211 | { |
212 | 212 | $update = false; |
213 | 213 | |
214 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
215 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
214 | + if (($content = file_get_contents($filename)) === false) { |
|
215 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
216 | 216 | } |
217 | 217 | |
218 | - if( strpos( $content, 'aimeos_shop:' ) === false ) |
|
218 | + if (strpos($content, 'aimeos_shop:') === false) |
|
219 | 219 | { |
220 | - $content .= "\n" . 'aimeos_shop: |
|
220 | + $content .= "\n".'aimeos_shop: |
|
221 | 221 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
222 | 222 | prefix: /'; |
223 | 223 | |
224 | 224 | $update = true; |
225 | 225 | } |
226 | 226 | |
227 | - if( $update === true ) |
|
227 | + if ($update === true) |
|
228 | 228 | { |
229 | 229 | $fs = new Filesystem(); |
230 | - $fs->dumpFile( $filename, $content ); |
|
230 | + $fs->dumpFile($filename, $content); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | * @param string &$content Content of the config.yml file |
239 | 239 | * @return boolean True if modified, false if not |
240 | 240 | */ |
241 | - protected static function addAsseticBundle( &$content ) |
|
241 | + protected static function addAsseticBundle(&$content) |
|
242 | 242 | { |
243 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
243 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
244 | 244 | { |
245 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
246 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
245 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
246 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
247 | 247 | |
248 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
248 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | } |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * {@inheritDoc} |
33 | 33 | */ |
34 | - public function load( array $configs, ContainerBuilder $container ) |
|
34 | + public function load(array $configs, ContainerBuilder $container) |
|
35 | 35 | { |
36 | 36 | $configuration = new Configuration(); |
37 | - $config = $this->processConfiguration( $configuration, $configs ); |
|
37 | + $config = $this->processConfiguration($configuration, $configs); |
|
38 | 38 | |
39 | - foreach( $configs as $list ) { |
|
40 | - $this->merge( $config, $list ); |
|
39 | + foreach ($configs as $list) { |
|
40 | + $this->merge($config, $list); |
|
41 | 41 | } |
42 | 42 | |
43 | - foreach( $config as $key => $value ) { |
|
44 | - $container->setParameter( 'aimeos_shop.' . $key, $value ); |
|
43 | + foreach ($config as $key => $value) { |
|
44 | + $container->setParameter('aimeos_shop.'.$key, $value); |
|
45 | 45 | } |
46 | 46 | |
47 | - $loader = new Loader\YamlFileLoader( $container, new FileLocator( dirname( __DIR__ ) . '/Resources/config' ) ); |
|
48 | - $loader->load( 'services.yml' ); |
|
47 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config')); |
|
48 | + $loader->load('services.yml'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param ContainerBuilder $container ContainerBuilder object |
56 | 56 | */ |
57 | - public function prepend( ContainerBuilder $container ) |
|
57 | + public function prepend(ContainerBuilder $container) |
|
58 | 58 | { |
59 | - $configFile = dirname( __DIR__ ) . '/Resources/config/aimeos_shop.yml'; |
|
60 | - $config = Yaml::parse( file_get_contents( $configFile ) ); |
|
59 | + $configFile = dirname(__DIR__).'/Resources/config/aimeos_shop.yml'; |
|
60 | + $config = Yaml::parse(file_get_contents($configFile)); |
|
61 | 61 | |
62 | - $container->prependExtensionConfig( 'aimeos_shop', $config ); |
|
63 | - $container->addResource( new FileResource( $configFile ) ); |
|
62 | + $container->prependExtensionConfig('aimeos_shop', $config); |
|
63 | + $container->addResource(new FileResource($configFile)); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | * @param array &$original Associative list of original values |
71 | 71 | * @param array $overrule Associative list of new values |
72 | 72 | */ |
73 | - protected function merge( array &$original, array $overrule ) |
|
73 | + protected function merge(array &$original, array $overrule) |
|
74 | 74 | { |
75 | - foreach( array_keys( $overrule ) as $key ) |
|
75 | + foreach (array_keys($overrule) as $key) |
|
76 | 76 | { |
77 | - if( isset( $original[$key] ) && is_array( $original[$key] ) ) { |
|
78 | - if( is_array( $overrule[$key] ) ) { |
|
79 | - $this->merge( $original[$key], $overrule[$key] ); |
|
77 | + if (isset($original[$key]) && is_array($original[$key])) { |
|
78 | + if (is_array($overrule[$key])) { |
|
79 | + $this->merge($original[$key], $overrule[$key]); |
|
80 | 80 | } |
81 | - } elseif( isset( $overrule[$key] ) ) { |
|
81 | + } elseif (isset($overrule[$key])) { |
|
82 | 82 | $original[$key] = $overrule[$key]; |
83 | 83 | } |
84 | 84 | } |
@@ -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 | - {"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
|
136 | - {"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}} |
|
135 | + {"type":"product/stock/warehouse","id":' . $ids[0].',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
|
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 | - {"type":"product/stock/warehouse","id":' . $ids[0] . '}, |
|
180 | - {"type":"product/stock/warehouse","id":' . $ids[1] . '} |
|
179 | + {"type":"product/stock/warehouse","id":' . $ids[0].'}, |
|
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 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * {@inheritdoc} |
30 | 30 | */ |
31 | - public function registerContainerConfiguration( LoaderInterface $loader ) |
|
31 | + public function registerContainerConfiguration(LoaderInterface $loader) |
|
32 | 32 | { |
33 | - $loader->load( __DIR__ . '/config/config.yml' ); |
|
33 | + $loader->load(__DIR__.'/config/config.yml'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getCacheDir() |
41 | 41 | { |
42 | - return sys_get_temp_dir() . '/aimeos-symfony2/cache'; |
|
42 | + return sys_get_temp_dir().'/aimeos-symfony2/cache'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getLogDir() |
50 | 50 | { |
51 | - return sys_get_temp_dir() . '/aimeos-symfony2/logs'; |
|
51 | + return sys_get_temp_dir().'/aimeos-symfony2/logs'; |
|
52 | 52 | } |
53 | 53 | } |
@@ -3,24 +3,24 @@ discard block |
||
3 | 3 | use Doctrine\Common\Annotations\AnnotationRegistry; |
4 | 4 | |
5 | 5 | |
6 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
6 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
7 | 7 | |
8 | 8 | // if the bundle is within a symfony project, try to reuse the project's autoload |
9 | 9 | $files = array( |
10 | - __DIR__ . '/../vendor/autoload.php', |
|
11 | - __DIR__ . '/../../vendor/autoload.php', |
|
10 | + __DIR__.'/../vendor/autoload.php', |
|
11 | + __DIR__.'/../../vendor/autoload.php', |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | $autoload = false; |
15 | -foreach( $files as $file ) |
|
15 | +foreach ($files as $file) |
|
16 | 16 | { |
17 | - if( is_file( $file ) ) { |
|
17 | + if (is_file($file)) { |
|
18 | 18 | $autoload = include_once $file; |
19 | 19 | break; |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if( !$autoload ) |
|
23 | +if (!$autoload) |
|
24 | 24 | { |
25 | 25 | exit( |
26 | 26 | "Unable to find autoload.php file, please use composer to load dependencies: |
@@ -30,4 +30,4 @@ discard block |
||
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | -AnnotationRegistry::registerLoader( array( $autoload, 'loadClass' ) ); |
|
33 | +AnnotationRegistry::registerLoader(array($autoload, 'loadClass')); |
@@ -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( 'Ext.', $client->getResponse()->getContent() ); |
|
52 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
53 | + $this->assertContains('Ext.', $client->getResponse()->getContent()); |
|
54 | 54 | } |
55 | 55 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * @param string $pageName Name of the configured page |
41 | 41 | * @return array Associative list with body and header output separated by client name |
42 | 42 | */ |
43 | - public function getSections( $pageName ) |
|
43 | + public function getSections($pageName) |
|
44 | 44 | { |
45 | 45 | $context = $this->container->get('aimeos_context')->get(); |
46 | - $pagesConfig = $this->container->getParameter( 'aimeos_shop.page' ); |
|
47 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
46 | + $pagesConfig = $this->container->getParameter('aimeos_shop.page'); |
|
47 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
48 | 48 | |
49 | 49 | $langid = $context->getLocale()->getLanguageId(); |
50 | - $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths( 'client/html/templates' ); |
|
51 | - $view = $this->container->get('aimeos_view')->create( $context, $tmplPaths, $langid ); |
|
52 | - $context->setView( $view ); |
|
50 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); |
|
51 | + $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); |
|
52 | + $context->setView($view); |
|
53 | 53 | |
54 | - if( isset( $pagesConfig[$pageName] ) ) |
|
54 | + if (isset($pagesConfig[$pageName])) |
|
55 | 55 | { |
56 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
56 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
57 | 57 | { |
58 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
59 | - $client->setView( clone $view ); |
|
58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
59 | + $client->setView(clone $view); |
|
60 | 60 | $client->process(); |
61 | 61 | |
62 | 62 | $result['aibody'][$clientName] = $client->getBody(); |