Completed
Push — master ( d244ae...64fd19 )
by Aimeos
02:45
created
DependencyInjection/AimeosShopExtension.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
Tests/Controller/CheckoutControllerTest.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -12,66 +12,66 @@  discard block
 block discarded – undo
12 12
 		$client = static::createClient(array(), array(
13 13
 			'PHP_AUTH_USER' => 'UTC001',
14 14
 			'PHP_AUTH_PW'   => 'unittest',
15
-		) );
15
+		));
16 16
 
17
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
17
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
18 18
 
19
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
20
-		$crawler = $client->click( $link );
19
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
20
+		$crawler = $client->click($link);
21 21
 
22
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
23
-		$crawler = $client->submit( $form );
22
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
23
+		$crawler = $client->submit($form);
24 24
 
25
-		$link = $crawler->filter( '.basket-standard .btn-action' )->link();
26
-		$crawler = $client->click( $link );
25
+		$link = $crawler->filter('.basket-standard .btn-action')->link();
26
+		$crawler = $client->click($link);
27 27
 
28
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .current:contains("Adresse")' )->count() );
29
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .basket a' )->count() );
30
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .address a' )->count() );
31
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .delivery a' )->count() );
32
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .payment a' )->count() );
33
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .summary a' )->count() );
28
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .current:contains("Adresse")')->count());
29
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .basket a')->count());
30
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .address a')->count());
31
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .delivery a')->count());
32
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .payment a')->count());
33
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .summary a')->count());
34 34
 
35 35
 
36
-		$form = $crawler->filter( '.checkout-standard form' )->form();
37
-		$form['ca_billingoption']->select( $crawler->filter( '.checkout-standard-address .item-address input' )->attr( 'value' ) );
38
-		$crawler = $client->submit( $form );
36
+		$form = $crawler->filter('.checkout-standard form')->form();
37
+		$form['ca_billingoption']->select($crawler->filter('.checkout-standard-address .item-address input')->attr('value'));
38
+		$crawler = $client->submit($form);
39 39
 
40
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .basket a' )->count() );
41
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .address a' )->count() );
42
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .current:contains("Versand")' )->count() );
43
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .delivery a' )->count() );
44
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .payment a' )->count() );
45
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .summary a' )->count() );
40
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .basket a')->count());
41
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .address a')->count());
42
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .current:contains("Versand")')->count());
43
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .delivery a')->count());
44
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .payment a')->count());
45
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .summary a')->count());
46 46
 
47 47
 
48
-		$form = $crawler->filter( '.checkout-standard form' )->form();
49
-		$form['c_deliveryoption']->select( $crawler->filter( '.checkout-standard-delivery .item-service input' )->attr( 'value' ) );
50
-		$crawler = $client->submit( $form );
48
+		$form = $crawler->filter('.checkout-standard form')->form();
49
+		$form['c_deliveryoption']->select($crawler->filter('.checkout-standard-delivery .item-service input')->attr('value'));
50
+		$crawler = $client->submit($form);
51 51
 
52
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .basket a' )->count() );
53
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .address a' )->count() );
54
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .delivery a' )->count() );
55
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .current:contains("Zahlung")' )->count() );
56
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .payment a' )->count() );
57
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .summary a' )->count() );
52
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .basket a')->count());
53
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .address a')->count());
54
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .delivery a')->count());
55
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .current:contains("Zahlung")')->count());
56
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .payment a')->count());
57
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .summary a')->count());
58 58
 
59 59
 
60
-		$form = $crawler->filter( '.checkout-standard form' )->form();
61
-		$form['c_paymentoption']->select( $crawler->filter( '.checkout-standard-payment .item-service input' )->attr( 'value' ) );
62
-		$crawler = $client->submit( $form );
60
+		$form = $crawler->filter('.checkout-standard form')->form();
61
+		$form['c_paymentoption']->select($crawler->filter('.checkout-standard-payment .item-service input')->attr('value'));
62
+		$crawler = $client->submit($form);
63 63
 
64
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .basket a' )->count() );
65
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .address a' )->count() );
66
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .delivery a' )->count() );
67
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .payment a' )->count() );
68
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard .steps .current:contains("Übersicht")' )->count() );
69
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps .summary a' )->count() );
64
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .basket a')->count());
65
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .address a')->count());
66
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .delivery a')->count());
67
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .payment a')->count());
68
+		$this->assertEquals(1, $crawler->filter('.checkout-standard .steps .current:contains("Übersicht")')->count());
69
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps .summary a')->count());
70 70
 
71 71
 
72
-		$link = $crawler->filter( '.checkout-standard .steps .basket a' )->link();
73
-		$crawler = $client->click( $link );
74
-		$this->assertEquals( 0, $crawler->filter( '.checkout-standard .steps' )->count() );
72
+		$link = $crawler->filter('.checkout-standard .steps .basket a')->link();
73
+		$crawler = $client->click($link);
74
+		$this->assertEquals(0, $crawler->filter('.checkout-standard .steps')->count());
75 75
 	}
76 76
 
77 77
 
@@ -80,47 +80,47 @@  discard block
 block discarded – undo
80 80
 		$client = static::createClient(array(), array(
81 81
 			'PHP_AUTH_USER' => 'UTC001',
82 82
 			'PHP_AUTH_PW'   => 'unittest',
83
-		) );
83
+		));
84 84
 
85
-		$crawler = $this->_goToSummary( $client );
85
+		$crawler = $this->_goToSummary($client);
86 86
 
87
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
87
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
88 88
 
89 89
 
90
-		$link = $crawler->filter( '.checkout-standard .btn-back' )->link();
91
-		$crawler = $client->click( $link );
90
+		$link = $crawler->filter('.checkout-standard .btn-back')->link();
91
+		$crawler = $client->click($link);
92 92
 
93
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-payment' )->count() );
93
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-payment')->count());
94 94
 
95 95
 
96
-		$link = $crawler->filter( '.checkout-standard .btn-back' )->link();
97
-		$crawler = $client->click( $link );
96
+		$link = $crawler->filter('.checkout-standard .btn-back')->link();
97
+		$crawler = $client->click($link);
98 98
 
99
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-delivery' )->count() );
99
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-delivery')->count());
100 100
 
101 101
 
102
-		$link = $crawler->filter( '.checkout-standard .btn-back' )->link();
103
-		$crawler = $client->click( $link );
102
+		$link = $crawler->filter('.checkout-standard .btn-back')->link();
103
+		$crawler = $client->click($link);
104 104
 
105
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-address' )->count() );
105
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-address')->count());
106 106
 
107 107
 
108
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
109
-		$crawler = $client->submit( $form );
108
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
109
+		$crawler = $client->submit($form);
110 110
 
111
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-delivery' )->count() );
111
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-delivery')->count());
112 112
 
113 113
 
114
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
115
-		$crawler = $client->submit( $form );
114
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
115
+		$crawler = $client->submit($form);
116 116
 
117
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-payment' )->count() );
117
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-payment')->count());
118 118
 
119 119
 
120
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
121
-		$crawler = $client->submit( $form );
120
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
121
+		$crawler = $client->submit($form);
122 122
 
123
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
123
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
124 124
 	}
125 125
 
126 126
 
@@ -129,17 +129,17 @@  discard block
 block discarded – undo
129 129
 		$client = static::createClient(array(), array(
130 130
 			'PHP_AUTH_USER' => 'UTC001',
131 131
 			'PHP_AUTH_PW'   => 'unittest',
132
-		) );
132
+		));
133 133
 
134
-		$crawler = $this->_goToSummary( $client );
134
+		$crawler = $this->_goToSummary($client);
135 135
 
136
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
136
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
137 137
 
138 138
 
139
-		$link = $crawler->filter( '.checkout-standard .common-summary-address .payment .modify' )->link();
140
-		$crawler = $client->click( $link );
139
+		$link = $crawler->filter('.checkout-standard .common-summary-address .payment .modify')->link();
140
+		$crawler = $client->click($link);
141 141
 
142
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-address' )->count() );
142
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-address')->count());
143 143
 	}
144 144
 
145 145
 
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 		$client = static::createClient(array(), array(
149 149
 			'PHP_AUTH_USER' => 'UTC001',
150 150
 			'PHP_AUTH_PW'   => 'unittest',
151
-		) );
151
+		));
152 152
 
153
-		$crawler = $this->_goToSummary( $client );
153
+		$crawler = $this->_goToSummary($client);
154 154
 
155
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
155
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
156 156
 
157 157
 
158
-		$link = $crawler->filter( '.checkout-standard .common-summary-address .delivery .modify' )->link();
159
-		$crawler = $client->click( $link );
158
+		$link = $crawler->filter('.checkout-standard .common-summary-address .delivery .modify')->link();
159
+		$crawler = $client->click($link);
160 160
 
161
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-address' )->count() );
161
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-address')->count());
162 162
 	}
163 163
 
164 164
 
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 		$client = static::createClient(array(), array(
168 168
 			'PHP_AUTH_USER' => 'UTC001',
169 169
 			'PHP_AUTH_PW'   => 'unittest',
170
-		) );
170
+		));
171 171
 
172
-		$crawler = $this->_goToSummary( $client );
172
+		$crawler = $this->_goToSummary($client);
173 173
 
174
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
174
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
175 175
 
176 176
 
177
-		$link = $crawler->filter( '.checkout-standard .common-summary-service .delivery .modify' )->link();
178
-		$crawler = $client->click( $link );
177
+		$link = $crawler->filter('.checkout-standard .common-summary-service .delivery .modify')->link();
178
+		$crawler = $client->click($link);
179 179
 
180
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-delivery' )->count() );
180
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-delivery')->count());
181 181
 	}
182 182
 
183 183
 
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 		$client = static::createClient(array(), array(
187 187
 			'PHP_AUTH_USER' => 'UTC001',
188 188
 			'PHP_AUTH_PW'   => 'unittest',
189
-		) );
189
+		));
190 190
 
191
-		$crawler = $this->_goToSummary( $client );
191
+		$crawler = $this->_goToSummary($client);
192 192
 
193
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
193
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
194 194
 
195 195
 
196
-		$link = $crawler->filter( '.checkout-standard .common-summary-service .payment .modify' )->link();
197
-		$crawler = $client->click( $link );
196
+		$link = $crawler->filter('.checkout-standard .common-summary-service .payment .modify')->link();
197
+		$crawler = $client->click($link);
198 198
 
199
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-payment' )->count() );
199
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-payment')->count());
200 200
 	}
201 201
 
202 202
 
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 		$client = static::createClient(array(), array(
206 206
 			'PHP_AUTH_USER' => 'UTC001',
207 207
 			'PHP_AUTH_PW'   => 'unittest',
208
-		) );
208
+		));
209 209
 
210
-		$crawler = $this->_goToSummary( $client );
210
+		$crawler = $this->_goToSummary($client);
211 211
 
212
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
212
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
213 213
 
214 214
 
215
-		$link = $crawler->filter( '.checkout-standard .common-summary-detail .modify' )->link();
216
-		$crawler = $client->click( $link );
215
+		$link = $crawler->filter('.checkout-standard .common-summary-detail .modify')->link();
216
+		$crawler = $client->click($link);
217 217
 
218
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard' )->count() );
218
+		$this->assertEquals(1, $crawler->filter('.basket-standard')->count());
219 219
 	}
220 220
 
221 221
 
@@ -224,51 +224,51 @@  discard block
 block discarded – undo
224 224
 		$client = static::createClient(array(), array(
225 225
 			'PHP_AUTH_USER' => 'UTC001',
226 226
 			'PHP_AUTH_PW'   => 'unittest',
227
-		) );
227
+		));
228 228
 
229
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
229
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
230 230
 
231
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
232
-		$crawler = $client->click( $link );
231
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
232
+		$crawler = $client->click($link);
233 233
 
234
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
235
-		$crawler = $client->submit( $form );
234
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
235
+		$crawler = $client->submit($form);
236 236
 
237
-		$link = $crawler->filter( '.basket-standard .btn-action' )->link();
238
-		$crawler = $client->click( $link );
237
+		$link = $crawler->filter('.basket-standard .btn-action')->link();
238
+		$crawler = $client->click($link);
239 239
 
240
-		$form = $crawler->filter( '.checkout-standard form' )->form();
241
-		$form['ca_billingoption']->select( $crawler->filter( '.checkout-standard-address .item-address input' )->attr( 'value' ) );
242
-		$crawler = $client->submit( $form );
240
+		$form = $crawler->filter('.checkout-standard form')->form();
241
+		$form['ca_billingoption']->select($crawler->filter('.checkout-standard-address .item-address input')->attr('value'));
242
+		$crawler = $client->submit($form);
243 243
 
244
-		$form = $crawler->filter( '.checkout-standard form' )->form();
245
-		$form['c_deliveryoption']->select( $crawler->filter( '.checkout-standard-delivery .item-service input' )->attr( 'value' ) );
246
-		$crawler = $client->submit( $form );
244
+		$form = $crawler->filter('.checkout-standard form')->form();
245
+		$form['c_deliveryoption']->select($crawler->filter('.checkout-standard-delivery .item-service input')->attr('value'));
246
+		$crawler = $client->submit($form);
247 247
 
248
-		$form = $crawler->filter( '.checkout-standard form' )->form();
249
-		$payId = $crawler->filter( '.checkout-standard-payment .item-service' )->eq( 1 )->filter( 'input' )->attr( 'value' );
250
-		$form['c_paymentoption']->select( $payId );
251
-		$form['c_payment[' . $payId . '][directdebit.accountowner]'] = 'test user';
252
-		$form['c_payment[' . $payId . '][directdebit.accountno]'] = '12345';
253
-		$form['c_payment[' . $payId . '][directdebit.bankcode]'] = '67890';
254
-		$form['c_payment[' . $payId . '][directdebit.bankname]'] = 'test bank';
255
-		$crawler = $client->submit( $form );
248
+		$form = $crawler->filter('.checkout-standard form')->form();
249
+		$payId = $crawler->filter('.checkout-standard-payment .item-service')->eq(1)->filter('input')->attr('value');
250
+		$form['c_paymentoption']->select($payId);
251
+		$form['c_payment['.$payId.'][directdebit.accountowner]'] = 'test user';
252
+		$form['c_payment['.$payId.'][directdebit.accountno]'] = '12345';
253
+		$form['c_payment['.$payId.'][directdebit.bankcode]'] = '67890';
254
+		$form['c_payment['.$payId.'][directdebit.bankname]'] = 'test bank';
255
+		$crawler = $client->submit($form);
256 256
 
257
-		$this->assertEquals( 1, $crawler->filter( '.checkout-standard-summary' )->count() );
257
+		$this->assertEquals(1, $crawler->filter('.checkout-standard-summary')->count());
258 258
 
259 259
 
260 260
 		// Test if T&C are not accepted
261
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
262
-		$crawler = $client->submit( $form );
261
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
262
+		$crawler = $client->submit($form);
263 263
 
264
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
264
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
265 265
 		$form['cs_option_terms_value']->tick();
266
-		$crawler = $client->submit( $form );
266
+		$crawler = $client->submit($form);
267 267
 
268
-		$form = $crawler->filter( '.checkout-standard .btn-action' )->form();
269
-		$crawler = $client->submit( $form );
268
+		$form = $crawler->filter('.checkout-standard .btn-action')->form();
269
+		$crawler = $client->submit($form);
270 270
 
271
-		$this->assertEquals( 1, $crawler->filter( '.checkout-confirm' )->count() );
271
+		$this->assertEquals(1, $crawler->filter('.checkout-confirm')->count());
272 272
 	}
273 273
 
274 274
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	{
277 277
 		$client = static::createClient();
278 278
 
279
-		$client->request( 'GET', '/unittest/de/EUR/update' );
279
+		$client->request('GET', '/unittest/de/EUR/update');
280 280
 
281
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
281
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
282 282
 	}
283 283
 
284 284
 
@@ -288,30 +288,30 @@  discard block
 block discarded – undo
288 288
 	 * @param \Symfony\Bundle\FrameworkBundle\Client $client HTTP test client
289 289
 	 * @return \Symfony\Component\DomCrawler\Crawler Crawler HTTP crawler
290 290
 	 */
291
-	protected function _goToSummary( $client )
291
+	protected function _goToSummary($client)
292 292
 	{
293
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
293
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
294 294
 
295
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
296
-		$crawler = $client->click( $link );
295
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
296
+		$crawler = $client->click($link);
297 297
 
298
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
299
-		$crawler = $client->submit( $form );
298
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
299
+		$crawler = $client->submit($form);
300 300
 
301
-		$link = $crawler->filter( '.basket-standard .btn-action' )->link();
302
-		$crawler = $client->click( $link );
301
+		$link = $crawler->filter('.basket-standard .btn-action')->link();
302
+		$crawler = $client->click($link);
303 303
 
304
-		$form = $crawler->filter( '.checkout-standard form' )->form();
305
-		$form['ca_billingoption']->select( $crawler->filter( '.checkout-standard-address .item-address input' )->attr( 'value' ) );
306
-		$crawler = $client->submit( $form );
304
+		$form = $crawler->filter('.checkout-standard form')->form();
305
+		$form['ca_billingoption']->select($crawler->filter('.checkout-standard-address .item-address input')->attr('value'));
306
+		$crawler = $client->submit($form);
307 307
 
308
-		$form = $crawler->filter( '.checkout-standard form' )->form();
309
-		$form['c_deliveryoption']->select( $crawler->filter( '.checkout-standard-delivery .item-service input' )->attr( 'value' ) );
310
-		$crawler = $client->submit( $form );
308
+		$form = $crawler->filter('.checkout-standard form')->form();
309
+		$form['c_deliveryoption']->select($crawler->filter('.checkout-standard-delivery .item-service input')->attr('value'));
310
+		$crawler = $client->submit($form);
311 311
 
312
-		$form = $crawler->filter( '.checkout-standard form' )->form();
313
-		$form['c_paymentoption']->select( $crawler->filter( '.checkout-standard-payment .item-service input' )->attr( 'value' ) );
314
-		$crawler = $client->submit( $form );
312
+		$form = $crawler->filter('.checkout-standard form')->form();
313
+		$form['c_paymentoption']->select($crawler->filter('.checkout-standard-payment .item-service input')->attr('value'));
314
+		$crawler = $client->submit($form);
315 315
 
316 316
 		return $crawler;
317 317
 	}
Please login to merge, or discard this patch.
Tests/Controller/JsonadmControllerTest.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Tests/Fixtures/app/AppKernel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Tests/bootstrap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
30 30
 	);
31 31
 }
32 32
 
33
-AnnotationRegistry::registerLoader( array( $autoload, 'loadClass' ) );
33
+AnnotationRegistry::registerLoader(array($autoload, 'loadClass'));
Please login to merge, or discard this patch.
Command/JobsCommand.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	protected function configure()
30 30
 	{
31 31
 		$names = '';
32
-		$aimeos = new \Aimeos\Bootstrap( array() );
33
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' );
34
-		$controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths );
32
+		$aimeos = new \Aimeos\Bootstrap(array());
33
+		$cntlPaths = $aimeos->getCustomPaths('controller/jobs');
34
+		$controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths);
35 35
 
36
-		foreach( $controllers as $key => $controller ) {
37
-			$names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL;
36
+		foreach ($controllers as $key => $controller) {
37
+			$names .= str_pad($key, 30).$controller->getName().PHP_EOL;
38 38
 		}
39 39
 
40
-		$this->setName( 'aimeos:jobs' );
41
-		$this->setDescription( 'Executes the job controllers' );
42
-		$this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' );
43
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' );
44
-		$this->setHelp( "Available jobs are:\n" . $names );
40
+		$this->setName('aimeos:jobs');
41
+		$this->setDescription('Executes the job controllers');
42
+		$this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"');
43
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)');
44
+		$this->setHelp("Available jobs are:\n".$names);
45 45
 	}
46 46
 
47 47
 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 	 * @param InputInterface $input Input object
52 52
 	 * @param OutputInterface $output Output object
53 53
 	 */
54
-	protected function execute( InputInterface $input, OutputInterface $output )
54
+	protected function execute(InputInterface $input, OutputInterface $output)
55 55
 	{
56 56
 		$context = $this->getContext();
57
-		$aimeos = $this->getContainer()->get( 'aimeos' )->get();
57
+		$aimeos = $this->getContainer()->get('aimeos')->get();
58 58
 
59
-		$jobs = explode( ' ', $input->getArgument( 'jobs' ) );
60
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
59
+		$jobs = explode(' ', $input->getArgument('jobs'));
60
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
61 61
 
62
-		foreach( $this->getSiteItems( $context, $input ) as $siteItem )
62
+		foreach ($this->getSiteItems($context, $input) as $siteItem)
63 63
 		{
64
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false );
65
-			$context->setLocale( $localeItem );
64
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
65
+			$context->setLocale($localeItem);
66 66
 
67
-			$output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) );
67
+			$output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode()));
68 68
 
69
-			foreach( $jobs as $jobname ) {
70
-				\Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run();
69
+			foreach ($jobs as $jobname) {
70
+				\Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
71 71
 			}
72 72
 		}
73 73
 	}
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 	{
83 83
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
84 84
 
85
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), array() );
86
-		$ctx->setConfig( $conf );
85
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), array());
86
+		$ctx->setConfig($conf);
87 87
 
88
-		$locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem();
89
-		$locale->setLanguageId( 'en' );
90
-		$ctx->setLocale( $locale );
88
+		$locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem();
89
+		$locale->setLanguageId('en');
90
+		$ctx->setLocale($locale);
91 91
 
92
-		$i18n = new \Aimeos\MW\Translation\None( 'en' );
93
-		$ctx->setI18n( array( 'en' => $i18n ) );
92
+		$i18n = new \Aimeos\MW\Translation\None('en');
93
+		$ctx->setI18n(array('en' => $i18n));
94 94
 
95 95
 		return $ctx;
96 96
 	}
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
 	{
106 106
 		$container = $this->getContainer();
107 107
 		$aimeos = $container->get('aimeos')->get();
108
-		$context = $container->get( 'aimeos_context' )->get( false );
108
+		$context = $container->get('aimeos_context')->get(false);
109 109
 
110
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
111
-		$tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) );
112
-		$view = $container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths );
110
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
111
+		$tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates'));
112
+		$view = $container->get('aimeos_view')->create($context->getConfig(), $tmplPaths);
113 113
 
114
-		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' );
115
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
116
-		$i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids );
114
+		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language');
115
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
116
+		$i18n = $this->getContainer()->get('aimeos_i18n')->get($langids);
117 117
 
118
-		$context->setEditor( 'aimeos:jobs' );
119
-		$context->setView( $view );
120
-		$context->setI18n( $i18n );
118
+		$context->setEditor('aimeos:jobs');
119
+		$context->setView($view);
120
+		$context->setI18n($i18n);
121 121
 
122 122
 		return $context;
123 123
 	}
Please login to merge, or discard this patch.
Command/SetupCommand.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param string $classname Name of the setup task class
31 31
 	 * @return boolean True if class is found, false if not
32 32
 	 */
33
-	public static function autoload( $classname )
33
+	public static function autoload($classname)
34 34
 	{
35
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
35
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
36 36
 		{
37
-			$fileName = substr( $classname, 21 ) . '.php';
38
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
37
+			$fileName = substr($classname, 21).'.php';
38
+			$paths = explode(PATH_SEPARATOR, get_include_path());
39 39
 
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$file = $path . DIRECTORY_SEPARATOR . $fileName;
42
+				$file = $path.DIRECTORY_SEPARATOR.$fileName;
43 43
 
44
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
44
+				if (file_exists($file) === true && (include_once $file) !== false) {
45 45
 					return true;
46 46
 				}
47 47
 			}
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	protected function configure()
58 58
 	{
59
-		$this->setName( 'aimeos:setup');
60
-		$this->setDescription( 'Initialize or update the Aimeos database tables' );
61
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' );
62
-		$this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' );
63
-		$this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() );
59
+		$this->setName('aimeos:setup');
60
+		$this->setDescription('Initialize or update the Aimeos database tables');
61
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default');
62
+		$this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default');
63
+		$this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array());
64 64
 	}
65 65
 
66 66
 
@@ -70,35 +70,35 @@  discard block
 block discarded – undo
70 70
 	 * @param InputInterface $input Input object
71 71
 	 * @param OutputInterface $output Output object
72 72
 	 */
73
-	protected function execute( InputInterface $input, OutputInterface $output )
73
+	protected function execute(InputInterface $input, OutputInterface $output)
74 74
 	{
75
-		$ctx = $this->getContainer()->get( 'aimeos_context' )->get( false );
76
-		$ctx->setEditor( 'aimeos:setup' );
75
+		$ctx = $this->getContainer()->get('aimeos_context')->get(false);
76
+		$ctx->setEditor('aimeos:setup');
77 77
 
78 78
 		$config = $ctx->getConfig();
79
-		$site = $input->getArgument( 'site' );
80
-		$tplsite = $input->getArgument( 'tplsite' );
79
+		$site = $input->getArgument('site');
80
+		$tplsite = $input->getArgument('tplsite');
81 81
 
82
-		$config->set( 'setup/site', $site );
83
-		$dbconfig = $this->getDbConfig( $config );
84
-		$this->setOptions( $config, $input );
82
+		$config->set('setup/site', $site);
83
+		$dbconfig = $this->getDbConfig($config);
84
+		$this->setOptions($config, $input);
85 85
 
86
-		$taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite );
86
+		$taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
87 87
 
88 88
 		$includePaths = $taskPaths;
89 89
 		$includePaths[] = get_include_path();
90 90
 
91
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
92
-			throw new \Exception( 'Unable to extend include path' );
91
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
92
+			throw new \Exception('Unable to extend include path');
93 93
 		}
94 94
 
95
-		spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true );
95
+		spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true);
96 96
 
97
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
97
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
98 98
 
99
-		$output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) );
99
+		$output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
100 100
 
101
-		$manager->run( 'mysql' );
101
+		$manager->run('mysql');
102 102
 	}
103 103
 
104 104
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
109 109
 	 * @return array Multi-dimensional associative list of database configuration parameters
110 110
 	 */
111
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
111
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
112 112
 	{
113
-		$dbconfig = $conf->get( 'resource', array() );
113
+		$dbconfig = $conf->get('resource', array());
114 114
 
115
-		foreach( $dbconfig as $rname => $dbconf )
115
+		foreach ($dbconfig as $rname => $dbconf)
116 116
 		{
117
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
118
-				unset( $dbconfig[$rname] );
117
+			if (strncmp($rname, 'db', 2) !== 0) {
118
+				unset($dbconfig[$rname]);
119 119
 			}
120 120
 		}
121 121
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 	 * @param array Associative list of database configurations
132 132
 	 * @throws \RuntimeException If the format of the options is invalid
133 133
 	 */
134
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input )
134
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input)
135 135
 	{
136
-		foreach( (array) $input->getOption( 'option' ) as $option )
136
+		foreach ((array) $input->getOption('option') as $option)
137 137
 		{
138
-			list( $name, $value ) = explode( ':', $option );
139
-			$conf->set( $name, $value );
138
+			list($name, $value) = explode(':', $option);
139
+			$conf->set($name, $value);
140 140
 		}
141 141
 	}
142 142
 }
Please login to merge, or discard this patch.
Controller/ExtadmController.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -30,63 +30,63 @@  discard block
 block discarded – undo
30 30
 	 * @param Request $request Symfony request object
31 31
 	 * @return Response Generated output for the admin interface
32 32
 	 */
33
-	public function indexAction( Request $request )
33
+	public function indexAction(Request $request)
34 34
 	{
35
-		$site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) );
36
-		$lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) );
37
-		$tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) );
35
+		$site = $request->attributes->get('site', $request->query->get('site', 'default'));
36
+		$lang = $request->attributes->get('lang', $request->query->get('lang', 'en'));
37
+		$tab = $request->attributes->get('tab', $request->query->get('tab', 0));
38 38
 
39
-		$context = $this->get( 'aimeos_context' )->get( false );
40
-		$context = $this->setLocale( $context, $site, $lang );
39
+		$context = $this->get('aimeos_context')->get(false);
40
+		$context = $this->setLocale($context, $site, $lang);
41 41
 
42
-		$aimeos = $this->get( 'aimeos' );
42
+		$aimeos = $this->get('aimeos');
43 43
 		$bootstrap = $aimeos->get();
44 44
 
45
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
46
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
45
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
46
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
47 47
 		$cssFiles = array();
48 48
 
49
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
49
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
50 50
 		{
51
-			foreach( $paths as $path )
51
+			foreach ($paths as $path)
52 52
 			{
53
-				$jsbAbsPath = $base . '/' . $path;
53
+				$jsbAbsPath = $base.'/'.$path;
54 54
 
55
-				if( !is_file( $jsbAbsPath ) ) {
56
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
55
+				if (!is_file($jsbAbsPath)) {
56
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
57 57
 				}
58 58
 
59
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
60
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
59
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
60
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
61 61
 			}
62 62
 		}
63 63
 
64
-		$params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' );
65
-		$adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params );
64
+		$params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
65
+		$adminUrl = $this->generateUrl('aimeos_shop_extadm', $params);
66 66
 
67
-		$token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue();
68
-		$jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) );
67
+		$token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue();
68
+		$jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site));
69 69
 
70
-		$jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) );
70
+		$jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
71 71
 
72 72
 		$vars = array(
73 73
 			'lang' => $lang,
74 74
 			'cssFiles' => $cssFiles,
75 75
 			'languages' => $this->getJsonLanguages(),
76
-			'config' => $this->getJsonClientConfig( $context ),
77
-			'site' => $this->getJsonSiteItem( $context, $site ),
78
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
76
+			'config' => $this->getJsonClientConfig($context),
77
+			'site' => $this->getJsonSiteItem($context, $site),
78
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
79 79
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
80 80
 			'itemSchemas' => $controller->getJsonItemSchemas(),
81
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
82
-			'urlTemplate' => urldecode( $adminUrl ),
83
-			'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ),
81
+			'smd' => $controller->getJsonSmd($jsonUrl),
82
+			'urlTemplate' => urldecode($adminUrl),
83
+			'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'),
84 84
 			'version' => $aimeos->getVersion(),
85 85
 			'jqadmurl' => $jqadmUrl,
86 86
 			'activeTab' => $tab,
87 87
 		);
88 88
 
89
-		return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars );
89
+		return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars);
90 90
 	}
91 91
 
92 92
 
@@ -96,23 +96,23 @@  discard block
 block discarded – undo
96 96
 	 * @param Request $request Symfony request object
97 97
 	 * @return Response JSON RPC message response
98 98
 	 */
99
-	public function doAction( Request $request )
99
+	public function doAction(Request $request)
100 100
 	{
101 101
 		$csrfProvider = $this->get('security.csrf.token_manager');
102 102
 
103
-		if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token',  $request->query->get( '_token' ) ) ) !== true ) {
104
-			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' );
103
+		if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) {
104
+			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid');
105 105
 		}
106 106
 
107
-		$cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' );
108
-		$context = $this->get( 'aimeos_context' )->get( false );
109
-		$context->setView( $this->get( 'aimeos_view' )->create( $context->getConfig(), array() ) );
110
-		$context = $this->setLocale( $context );
107
+		$cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs');
108
+		$context = $this->get('aimeos_context')->get(false);
109
+		$context->setView($this->get('aimeos_view')->create($context->getConfig(), array()));
110
+		$context = $this->setLocale($context);
111 111
 
112
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
112
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
113 113
 
114
-		$response = $controller->process( $request->request->all(), $request->getContent() );
115
-		return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) );
114
+		$response = $controller->process($request->request->all(), $request->getContent());
115
+		return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response));
116 116
 	}
117 117
 
118 118
 
@@ -125,27 +125,27 @@  discard block
 block discarded – undo
125 125
 	{
126 126
 		$contents = '';
127 127
 		$jsFiles = array();
128
-		$aimeos = $this->get( 'aimeos' )->get();
128
+		$aimeos = $this->get('aimeos')->get();
129 129
 
130
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
130
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
131 131
 		{
132
-			foreach( $paths as $path )
132
+			foreach ($paths as $path)
133 133
 			{
134
-				$jsbAbsPath = $base . '/' . $path;
135
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
136
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
134
+				$jsbAbsPath = $base.'/'.$path;
135
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
136
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
137 137
 			}
138 138
 		}
139 139
 
140
-		foreach( $jsFiles as $file )
140
+		foreach ($jsFiles as $file)
141 141
 		{
142
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
142
+			if (($content = file_get_contents($file)) !== false) {
143 143
 				$contents .= $content;
144 144
 			}
145 145
 		}
146 146
 
147
-		$response = new Response( $contents );
148
-		$response->headers->set( 'Content-Type', 'application/javascript' );
147
+		$response = new Response($contents);
148
+		$response->headers->set('Content-Type', 'application/javascript');
149 149
 
150 150
 		return $response;
151 151
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		$result = array();
162 162
 
163
-		foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
164
-			$result[] = array( 'id' => $id, 'label' => $id );
163
+		foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) {
164
+			$result[] = array('id' => $id, 'label' => $id);
165 165
 		}
166 166
 
167
-		return json_encode( $result );
167
+		return json_encode($result);
168 168
 	}
169 169
 
170 170
 
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
175 175
 	 * @return string JSON encoded configuration object
176 176
 	 */
177
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
177
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
178 178
 	{
179
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
180
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
179
+		$config = $context->getConfig()->get('admin/extjs', array());
180
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
181 181
 	}
182 182
 
183 183
 
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 	 * @param string $lang ISO language code like "en" or "en_GB"
189 189
 	 * @return string JSON encoded translation object
190 190
 	 */
191
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
191
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
192 192
 	{
193
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
193
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
194 194
 
195 195
 		$content = array(
196
-			'admin' => $i18n->getAll( 'admin' ),
197
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
196
+			'admin' => $i18n->getAll('admin'),
197
+			'admin/ext' => $i18n->getAll('admin/ext'),
198 198
 		);
199 199
 
200
-		return json_encode( $content, JSON_FORCE_OBJECT );
200
+		return json_encode($content, JSON_FORCE_OBJECT);
201 201
 	}
202 202
 
203 203
 
@@ -209,19 +209,19 @@  discard block
 block discarded – undo
209 209
 	 * @return string JSON encoded site item object
210 210
 	 * @throws Exception If no site item was found for the code
211 211
 	 */
212
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
212
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
213 213
 	{
214
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
214
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
215 215
 
216 216
 		$criteria = $manager->createSearch();
217
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
218
-		$items = $manager->searchItems( $criteria );
217
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
218
+		$items = $manager->searchItems($criteria);
219 219
 
220
-		if( ( $item = reset( $items ) ) === false ) {
221
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
220
+		if (($item = reset($items)) === false) {
221
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
222 222
 		}
223 223
 
224
-		return json_encode( $item->toArray() );
224
+		return json_encode($item->toArray());
225 225
 	}
226 226
 
227 227
 
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
234 234
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
235 235
 	 */
236
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
236
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
237 237
 	{
238
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
238
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
239 239
 
240 240
 		try {
241
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
242
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
241
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
242
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
243 243
 			$localeItem = $localeManager->createItem();
244 244
 		}
245 245
 
246
-		$context->setLocale( $localeItem );
246
+		$context->setLocale($localeItem);
247 247
 
248 248
 		return $context;
249 249
 	}
Please login to merge, or discard this patch.
Tests/Controller/ExtadmControllerTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.