@@ -12,29 +12,29 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
15 | + )); |
|
16 | 16 | |
17 | 17 | |
18 | - $client->request( 'OPTIONS', '/unittest/jsonadm/product' ); |
|
18 | + $client->request('OPTIONS', '/unittest/jsonadm/product'); |
|
19 | 19 | $response = $client->getResponse(); |
20 | 20 | |
21 | - $json = json_decode( $response->getContent(), true ); |
|
21 | + $json = json_decode($response->getContent(), true); |
|
22 | 22 | |
23 | - $this->assertNotNull( $json ); |
|
24 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
25 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
26 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
23 | + $this->assertNotNull($json); |
|
24 | + $this->assertEquals(200, $response->getStatusCode()); |
|
25 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
26 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
27 | 27 | |
28 | 28 | |
29 | - $client->request( 'OPTIONS', '/unittest/jsonadm' ); |
|
29 | + $client->request('OPTIONS', '/unittest/jsonadm'); |
|
30 | 30 | $response = $client->getResponse(); |
31 | 31 | |
32 | - $json = json_decode( $response->getContent(), true ); |
|
32 | + $json = json_decode($response->getContent(), true); |
|
33 | 33 | |
34 | - $this->assertNotNull( $json ); |
|
35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
36 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
37 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
34 | + $this->assertNotNull($json); |
|
35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
36 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
37 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,62 +43,62 @@ discard block |
||
43 | 43 | $client = static::createClient(array(), array( |
44 | 44 | 'PHP_AUTH_USER' => 'admin', |
45 | 45 | 'PHP_AUTH_PW' => 'adminpass', |
46 | - ) ); |
|
46 | + )); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}}'; |
50 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
50 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
51 | 51 | $response = $client->getResponse(); |
52 | 52 | |
53 | - $json = json_decode( $response->getContent(), true ); |
|
53 | + $json = json_decode($response->getContent(), true); |
|
54 | 54 | |
55 | - $this->assertNotNull( $json ); |
|
56 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
57 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
58 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
59 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
60 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
55 | + $this->assertNotNull($json); |
|
56 | + $this->assertEquals(201, $response->getStatusCode()); |
|
57 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
58 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.code']); |
|
59 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.label']); |
|
60 | + $this->assertEquals(1, $json['meta']['total']); |
|
61 | 61 | |
62 | 62 | $id = $json['data']['attributes']['product.stock.warehouse.id']; |
63 | 63 | |
64 | 64 | |
65 | 65 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony2"}}}'; |
66 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content ); |
|
66 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content); |
|
67 | 67 | $response = $client->getResponse(); |
68 | 68 | |
69 | - $json = json_decode( $response->getContent(), true ); |
|
69 | + $json = json_decode($response->getContent(), true); |
|
70 | 70 | |
71 | - $this->assertNotNull( $json ); |
|
72 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
73 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
74 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
75 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
76 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
77 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
71 | + $this->assertNotNull($json); |
|
72 | + $this->assertEquals(200, $response->getStatusCode()); |
|
73 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
74 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
75 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
76 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
77 | + $this->assertEquals(1, $json['meta']['total']); |
|
78 | 78 | |
79 | 79 | |
80 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
80 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
81 | 81 | $response = $client->getResponse(); |
82 | 82 | |
83 | - $json = json_decode( $response->getContent(), true ); |
|
83 | + $json = json_decode($response->getContent(), true); |
|
84 | 84 | |
85 | - $this->assertNotNull( $json ); |
|
86 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
87 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
88 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
89 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
90 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
91 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
85 | + $this->assertNotNull($json); |
|
86 | + $this->assertEquals(200, $response->getStatusCode()); |
|
87 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
88 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
89 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
90 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
91 | + $this->assertEquals(1, $json['meta']['total']); |
|
92 | 92 | |
93 | 93 | |
94 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
94 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
95 | 95 | $response = $client->getResponse(); |
96 | 96 | |
97 | - $json = json_decode( $response->getContent(), true ); |
|
97 | + $json = json_decode($response->getContent(), true); |
|
98 | 98 | |
99 | - $this->assertNotNull( $json ); |
|
100 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
101 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
99 | + $this->assertNotNull($json); |
|
100 | + $this->assertEquals(200, $response->getStatusCode()); |
|
101 | + $this->assertEquals(1, $json['meta']['total']); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -107,85 +107,85 @@ discard block |
||
107 | 107 | $client = static::createClient(array(), array( |
108 | 108 | 'PHP_AUTH_USER' => 'admin', |
109 | 109 | 'PHP_AUTH_PW' => 'adminpass', |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | $content = '{"data":[ |
114 | 114 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}, |
115 | 115 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony"}} |
116 | 116 | ]}'; |
117 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
117 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
118 | 118 | $response = $client->getResponse(); |
119 | 119 | |
120 | - $json = json_decode( $response->getContent(), true ); |
|
120 | + $json = json_decode($response->getContent(), true); |
|
121 | 121 | |
122 | - $this->assertNotNull( $json ); |
|
123 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
124 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
125 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
126 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
127 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
128 | - $this->assertEquals( 'symfony', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
129 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
122 | + $this->assertNotNull($json); |
|
123 | + $this->assertEquals(201, $response->getStatusCode()); |
|
124 | + $this->assertEquals(2, count($json['data'])); |
|
125 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
126 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
127 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
128 | + $this->assertEquals('symfony', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
129 | + $this->assertEquals(2, $json['meta']['total']); |
|
130 | 130 | |
131 | - $ids = array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id'] ); |
|
131 | + $ids = array($json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id']); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | $content = '{"data":[ |
135 | 135 | {"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
136 | 136 | {"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}} |
137 | 137 | ]}'; |
138 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
138 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
139 | 139 | $response = $client->getResponse(); |
140 | 140 | |
141 | - $json = json_decode( $response->getContent(), true ); |
|
142 | - |
|
143 | - $this->assertNotNull( $json ); |
|
144 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
145 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
146 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
147 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
148 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
149 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
150 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
151 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
152 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
153 | - |
|
154 | - |
|
155 | - $getParams = array( 'filter' => array( '&&' => array( |
|
156 | - array( '=~' => array( 'product.stock.warehouse.code' => 'symfony' ) ), |
|
157 | - array( '==' => array( 'product.stock.warehouse.label' => 'symfony2' ) ) |
|
158 | - ) ), |
|
159 | - 'sort' => 'product.stock.warehouse.code', 'page' => array( 'offset' => 0, 'limit' => 3 ) |
|
141 | + $json = json_decode($response->getContent(), true); |
|
142 | + |
|
143 | + $this->assertNotNull($json); |
|
144 | + $this->assertEquals(200, $response->getStatusCode()); |
|
145 | + $this->assertEquals(2, count($json['data'])); |
|
146 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
147 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
148 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
149 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
150 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
151 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
152 | + $this->assertEquals(2, $json['meta']['total']); |
|
153 | + |
|
154 | + |
|
155 | + $getParams = array('filter' => array('&&' => array( |
|
156 | + array('=~' => array('product.stock.warehouse.code' => 'symfony')), |
|
157 | + array('==' => array('product.stock.warehouse.label' => 'symfony2')) |
|
158 | + )), |
|
159 | + 'sort' => 'product.stock.warehouse.code', 'page' => array('offset' => 0, 'limit' => 3) |
|
160 | 160 | ); |
161 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse', $getParams ); |
|
161 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse', $getParams); |
|
162 | 162 | $response = $client->getResponse(); |
163 | 163 | |
164 | - $json = json_decode( $response->getContent(), true ); |
|
164 | + $json = json_decode($response->getContent(), true); |
|
165 | 165 | |
166 | - $this->assertNotNull( $json ); |
|
167 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
168 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
169 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.code'] ); |
|
170 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code'] ); |
|
171 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
172 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
173 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
174 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
175 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
166 | + $this->assertNotNull($json); |
|
167 | + $this->assertEquals(200, $response->getStatusCode()); |
|
168 | + $this->assertEquals(2, count($json['data'])); |
|
169 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.code']); |
|
170 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code']); |
|
171 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
172 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
173 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
174 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
175 | + $this->assertEquals(2, $json['meta']['total']); |
|
176 | 176 | |
177 | 177 | |
178 | 178 | $content = '{"data":[ |
179 | 179 | {"type":"product/stock/warehouse","id":' . $ids[0] . '}, |
180 | 180 | {"type":"product/stock/warehouse","id":' . $ids[1] . '} |
181 | 181 | ]}'; |
182 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
182 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
183 | 183 | $response = $client->getResponse(); |
184 | 184 | |
185 | - $json = json_decode( $response->getContent(), true ); |
|
185 | + $json = json_decode($response->getContent(), true); |
|
186 | 186 | |
187 | - $this->assertNotNull( $json ); |
|
188 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
189 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
187 | + $this->assertNotNull($json); |
|
188 | + $this->assertEquals(200, $response->getStatusCode()); |
|
189 | + $this->assertEquals(2, $json['meta']['total']); |
|
190 | 190 | } |
191 | 191 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
16 | - $crawler = $client->request( 'GET', '/unittest/extadm/de/0' ); |
|
15 | + )); |
|
16 | + $crawler = $client->request('GET', '/unittest/extadm/de/0'); |
|
17 | 17 | |
18 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
19 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() ); |
|
20 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
18 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
19 | + $this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count()); |
|
20 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | $client = static::createClient(array(), array( |
27 | 27 | 'PHP_AUTH_USER' => 'admin', |
28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | |
31 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
31 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
32 | 32 | |
33 | - $client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
33 | + $client->request('POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
34 | 34 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
35 | 35 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
36 | 36 | ); |
37 | 37 | |
38 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
39 | - $this->assertStringStartsWith( '{', $client->getResponse()->getContent() ); |
|
38 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
39 | + $this->assertStringStartsWith('{', $client->getResponse()->getContent()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $client = static::createClient(array(), array( |
46 | 46 | 'PHP_AUTH_USER' => 'admin', |
47 | 47 | 'PHP_AUTH_PW' => 'adminpass', |
48 | - ) ); |
|
48 | + )); |
|
49 | 49 | |
50 | - $client->request( 'GET', '/unittest/extadm/file' ); |
|
50 | + $client->request('GET', '/unittest/extadm/file'); |
|
51 | 51 | |
52 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
53 | - $this->assertContains( 'EXTUTIL', $client->getResponse()->getContent() ); |
|
52 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
53 | + $this->assertContains('EXTUTIL', $client->getResponse()->getContent()); |
|
54 | 54 | } |
55 | 55 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
15 | + )); |
|
16 | 16 | |
17 | - $client->request( 'GET', '/unittest/jqadm/copy/product/0' ); |
|
17 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
18 | 18 | $response = $client->getResponse(); |
19 | 19 | |
20 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
21 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
20 | + $this->assertEquals(200, $response->getStatusCode()); |
|
21 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | $client = static::createClient(array(), array( |
28 | 28 | 'PHP_AUTH_USER' => 'admin', |
29 | 29 | 'PHP_AUTH_PW' => 'adminpass', |
30 | - ) ); |
|
30 | + )); |
|
31 | 31 | |
32 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
32 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
33 | 33 | $response = $client->getResponse(); |
34 | 34 | |
35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
36 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
36 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | $client = static::createClient(array(), array( |
43 | 43 | 'PHP_AUTH_USER' => 'admin', |
44 | 44 | 'PHP_AUTH_PW' => 'adminpass', |
45 | - ) ); |
|
45 | + )); |
|
46 | 46 | |
47 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
47 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
48 | 48 | $response = $client->getResponse(); |
49 | 49 | |
50 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
51 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
50 | + $this->assertEquals(200, $response->getStatusCode()); |
|
51 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $client = static::createClient(array(), array( |
58 | 58 | 'PHP_AUTH_USER' => 'admin', |
59 | 59 | 'PHP_AUTH_PW' => 'adminpass', |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | - $client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
|
62 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
63 | 63 | $response = $client->getResponse(); |
64 | 64 | |
65 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
66 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
65 | + $this->assertEquals(200, $response->getStatusCode()); |
|
66 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | $client = static::createClient(array(), array( |
73 | 73 | 'PHP_AUTH_USER' => 'admin', |
74 | 74 | 'PHP_AUTH_PW' => 'adminpass', |
75 | - ) ); |
|
75 | + )); |
|
76 | 76 | |
77 | - $client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
|
77 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
78 | 78 | $response = $client->getResponse(); |
79 | 79 | |
80 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
81 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
80 | + $this->assertEquals(200, $response->getStatusCode()); |
|
81 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | $client = static::createClient(array(), array( |
88 | 88 | 'PHP_AUTH_USER' => 'admin', |
89 | 89 | 'PHP_AUTH_PW' => 'adminpass', |
90 | - ) ); |
|
90 | + )); |
|
91 | 91 | |
92 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
92 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
93 | 93 | $response = $client->getResponse(); |
94 | 94 | |
95 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
96 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
95 | + $this->assertEquals(200, $response->getStatusCode()); |
|
96 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $client = static::createClient(array(), array( |
103 | 103 | 'PHP_AUTH_USER' => 'admin', |
104 | 104 | 'PHP_AUTH_PW' => 'adminpass', |
105 | - ) ); |
|
105 | + )); |
|
106 | 106 | |
107 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
107 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
108 | 108 | $response = $client->getResponse(); |
109 | 109 | |
110 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
111 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
110 | + $this->assertEquals(200, $response->getStatusCode()); |
|
111 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
112 | 112 | } |
113 | 113 | } |
@@ -210,8 +210,7 @@ |
||
210 | 210 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
211 | 211 | $localeItem->setLanguageId( null ); |
212 | 212 | $localeItem->setCurrencyId( null ); |
213 | - } |
|
214 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
213 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
215 | 214 | { |
216 | 215 | $localeItem = $localeManager->createItem(); |
217 | 216 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return string Generated output |
33 | 33 | */ |
34 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
34 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
37 | - return $this->getHtml( $cntl->copy() ); |
|
36 | + $cntl = $this->createClient($request, $site, $resource); |
|
37 | + return $this->getHtml($cntl->copy()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * @param string $site Unique site code |
47 | 47 | * @return string Generated output |
48 | 48 | */ |
49 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
49 | + public function createAction(Request $request, $resource, $site = 'default') |
|
50 | 50 | { |
51 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
52 | - return $this->getHtml( $cntl->create() ); |
|
51 | + $cntl = $this->createClient($request, $site, $resource); |
|
52 | + return $this->getHtml($cntl->create()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | * @param string $site Unique site code |
62 | 62 | * @return string Generated output |
63 | 63 | */ |
64 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
64 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
65 | 65 | { |
66 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
67 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
66 | + $cntl = $this->createClient($request, $site, $resource); |
|
67 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * @param string $site Unique site code |
77 | 77 | * @return string Generated output |
78 | 78 | */ |
79 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
79 | + public function getAction(Request $request, $resource, $site = 'default') |
|
80 | 80 | { |
81 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
82 | - return $this->getHtml( $cntl->get() ); |
|
81 | + $cntl = $this->createClient($request, $site, $resource); |
|
82 | + return $this->getHtml($cntl->get()); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return string Generated output |
93 | 93 | */ |
94 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
94 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
97 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
96 | + $cntl = $this->createClient($request, $site, $resource); |
|
97 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * @param string $site Unique site code |
107 | 107 | * @return string Generated output |
108 | 108 | */ |
109 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
109 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
110 | 110 | { |
111 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
112 | - return $this->getHtml( $cntl->search() ); |
|
111 | + $cntl = $this->createClient($request, $site, $resource); |
|
112 | + return $this->getHtml($cntl->search()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | * @param string $resource Resource location, e.g. "product" |
122 | 122 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
123 | 123 | */ |
124 | - protected function createClient( Request $request, $site, $resource ) |
|
124 | + protected function createClient(Request $request, $site, $resource) |
|
125 | 125 | { |
126 | - $lang = $request->get( 'lang', 'en' ); |
|
126 | + $lang = $request->get('lang', 'en'); |
|
127 | 127 | |
128 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
129 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
128 | + $aimeos = $this->get('aimeos')->get(); |
|
129 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
130 | 130 | |
131 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
132 | - $context = $this->setLocale( $context, $site, $lang ); |
|
131 | + $context = $this->get('aimeos_context')->get(false); |
|
132 | + $context = $this->setLocale($context, $site, $lang); |
|
133 | 133 | |
134 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
135 | - $context->setView( $view ); |
|
134 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
135 | + $context->setView($view); |
|
136 | 136 | |
137 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
137 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | * @param string $content Content from admin client |
145 | 145 | * @return \Illuminate\Contracts\View\View View for rendering the output |
146 | 146 | */ |
147 | - protected function getHtml( $content ) |
|
147 | + protected function getHtml($content) |
|
148 | 148 | { |
149 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
150 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
149 | + $version = $this->get('aimeos')->getVersion(); |
|
150 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
151 | 151 | |
152 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
152 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,23 +161,23 @@ discard block |
||
161 | 161 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
162 | 162 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
163 | 163 | */ |
164 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null ) |
|
164 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null) |
|
165 | 165 | { |
166 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
166 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
167 | 167 | |
168 | 168 | try |
169 | 169 | { |
170 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
171 | - $localeItem->setLanguageId( null ); |
|
172 | - $localeItem->setCurrencyId( null ); |
|
170 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
171 | + $localeItem->setLanguageId(null); |
|
172 | + $localeItem->setCurrencyId(null); |
|
173 | 173 | } |
174 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
174 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
175 | 175 | { |
176 | 176 | $localeItem = $localeManager->createItem(); |
177 | 177 | } |
178 | 178 | |
179 | - $context->setLocale( $localeItem ); |
|
180 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang ) ) ); |
|
179 | + $context->setLocale($localeItem); |
|
180 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
181 | 181 | |
182 | 182 | return $context; |
183 | 183 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Container $container Container object to access parameters |
31 | 31 | */ |
32 | - public function __construct( Container $container ) |
|
32 | + public function __construct(Container $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function get() |
44 | 44 | { |
45 | - if( $this->object === null ) |
|
45 | + if ($this->object === null) |
|
46 | 46 | { |
47 | - $extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' ); |
|
48 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
47 | + $extDirs = (array) $this->container->getParameter('aimeos_shop.extdir'); |
|
48 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this->object; |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getVersion() |
61 | 61 | { |
62 | - $filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
62 | + $filename = dirname($this->container->get('kernel')->getRootDir()) . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
63 | 63 | |
64 | - if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false |
|
65 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
64 | + if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false |
|
65 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
66 | 66 | ) { |
67 | - foreach( (array) $content['packages'] as $item ) |
|
67 | + foreach ((array) $content['packages'] as $item) |
|
68 | 68 | { |
69 | - if( $item['name'] === 'aimeos/aimeos-symfony2' ) { |
|
69 | + if ($item['name'] === 'aimeos/aimeos-symfony2') { |
|
70 | 70 | return $item['version']; |
71 | 71 | } |
72 | 72 | } |
@@ -29,23 +29,23 @@ |
||
29 | 29 | public function getConfigTreeBuilder() |
30 | 30 | { |
31 | 31 | $treeBuilder = new TreeBuilder(); |
32 | - $rootNode = $treeBuilder->root( 'aimeos_shop' ); |
|
32 | + $rootNode = $treeBuilder->root('aimeos_shop'); |
|
33 | 33 | |
34 | 34 | $rootNode |
35 | 35 | ->children() |
36 | - ->booleanNode('disable_sites')->defaultValue( true )->end() |
|
37 | - ->booleanNode('apc_enable')->defaultValue( false )->end() |
|
38 | - ->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end() |
|
36 | + ->booleanNode('disable_sites')->defaultValue(true)->end() |
|
37 | + ->booleanNode('apc_enable')->defaultValue(false)->end() |
|
38 | + ->scalarNode('apc_prefix')->defaultValue('sf2:')->end() |
|
39 | 39 | ->scalarNode('extdir')->end() |
40 | 40 | ->scalarNode('uploaddir')->end() |
41 | - ->variableNode('admin')->defaultValue( array() )->end() |
|
42 | - ->variableNode('client')->defaultValue( array() )->end() |
|
43 | - ->variableNode('controller')->defaultValue( array() )->end() |
|
44 | - ->variableNode('i18n')->defaultValue( array() )->end() |
|
45 | - ->variableNode('madmin')->defaultValue( array() )->end() |
|
46 | - ->variableNode('mshop')->defaultValue( array() )->end() |
|
47 | - ->variableNode('resource')->defaultValue( array() )->end() |
|
48 | - ->variableNode('page')->defaultValue( array() )->end() |
|
41 | + ->variableNode('admin')->defaultValue(array())->end() |
|
42 | + ->variableNode('client')->defaultValue(array())->end() |
|
43 | + ->variableNode('controller')->defaultValue(array())->end() |
|
44 | + ->variableNode('i18n')->defaultValue(array())->end() |
|
45 | + ->variableNode('madmin')->defaultValue(array())->end() |
|
46 | + ->variableNode('mshop')->defaultValue(array())->end() |
|
47 | + ->variableNode('resource')->defaultValue(array())->end() |
|
48 | + ->variableNode('page')->defaultValue(array())->end() |
|
49 | 49 | ->end() |
50 | 50 | ; |
51 | 51 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | 13 | |
14 | - $client->request( 'GET', '/admin' ); |
|
14 | + $client->request('GET', '/admin'); |
|
15 | 15 | $response = $client->getResponse(); |
16 | 16 | |
17 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
18 | - $this->assertContains( '<form class="login"', $response->getContent() ); |
|
17 | + $this->assertEquals(200, $response->getStatusCode()); |
|
18 | + $this->assertContains('<form class="login"', $response->getContent()); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | $client = static::createClient(array(), array( |
25 | 25 | 'PHP_AUTH_USER' => 'admin', |
26 | 26 | 'PHP_AUTH_PW' => 'adminpass', |
27 | - ) ); |
|
27 | + )); |
|
28 | 28 | |
29 | - $client->request( 'GET', '/admin' ); |
|
29 | + $client->request('GET', '/admin'); |
|
30 | 30 | $response = $client->getResponse(); |
31 | 31 | |
32 | - $this->assertEquals( 302, $response->getStatusCode() ); |
|
33 | - $this->assertContains( '/default/jqadm/search/product?lang=en', $response->getContent() ); |
|
32 | + $this->assertEquals(302, $response->getStatusCode()); |
|
33 | + $this->assertContains('/default/jqadm/search/product?lang=en', $response->getContent()); |
|
34 | 34 | } |
35 | 35 | } |
@@ -32,56 +32,56 @@ discard block |
||
32 | 32 | * @param integer $tab Number of the currently active tab |
33 | 33 | * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface |
34 | 34 | */ |
35 | - public function indexAction( $site = 'default', $lang, $tab ) |
|
35 | + public function indexAction($site = 'default', $lang, $tab) |
|
36 | 36 | { |
37 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
38 | - $context = $this->setLocale( $context, $site, $lang ); |
|
37 | + $context = $this->get('aimeos_context')->get(false); |
|
38 | + $context = $this->setLocale($context, $site, $lang); |
|
39 | 39 | |
40 | - $aimeos = $this->get( 'aimeos' ); |
|
40 | + $aimeos = $this->get('aimeos'); |
|
41 | 41 | $bootstrap = $aimeos->get(); |
42 | 42 | |
43 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
44 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
43 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
44 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
45 | 45 | $cssFiles = array(); |
46 | 46 | |
47 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
47 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
48 | 48 | { |
49 | - foreach( $paths as $path ) |
|
49 | + foreach ($paths as $path) |
|
50 | 50 | { |
51 | 51 | $jsbAbsPath = $base . '/' . $path; |
52 | 52 | |
53 | - if( !is_file( $jsbAbsPath ) ) { |
|
54 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
53 | + if (!is_file($jsbAbsPath)) { |
|
54 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
55 | 55 | } |
56 | 56 | |
57 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
58 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
57 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
58 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
63 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
62 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
63 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
64 | 64 | |
65 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
66 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
65 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
66 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
67 | 67 | |
68 | 68 | $vars = array( |
69 | 69 | 'lang' => $lang, |
70 | 70 | 'cssFiles' => $cssFiles, |
71 | 71 | 'languages' => $this->getJsonLanguages(), |
72 | - 'config' => $this->getJsonClientConfig( $context ), |
|
73 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
74 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
72 | + 'config' => $this->getJsonClientConfig($context), |
|
73 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
74 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
75 | 75 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
76 | 76 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
77 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
78 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
79 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
77 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
78 | + 'urlTemplate' => urldecode($adminUrl), |
|
79 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
80 | 80 | 'version' => $aimeos->getVersion(), |
81 | 81 | 'activeTab' => $tab, |
82 | 82 | ); |
83 | 83 | |
84 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
84 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,22 +91,22 @@ discard block |
||
91 | 91 | * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
92 | 92 | * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response |
93 | 93 | */ |
94 | - public function doAction( Request $request ) |
|
94 | + public function doAction(Request $request) |
|
95 | 95 | { |
96 | 96 | $csrfProvider = $this->get('security.csrf.token_manager'); |
97 | 97 | |
98 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
99 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
98 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
99 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
100 | 100 | } |
101 | 101 | |
102 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
103 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
104 | - $context = $this->setLocale( $context ); |
|
102 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
103 | + $context = $this->get('aimeos_context')->get(false); |
|
104 | + $context = $this->setLocale($context); |
|
105 | 105 | |
106 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
106 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
107 | 107 | |
108 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
109 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
108 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
109 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | { |
120 | 120 | $contents = ''; |
121 | 121 | $jsFiles = array(); |
122 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
122 | + $aimeos = $this->get('aimeos')->get(); |
|
123 | 123 | |
124 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
124 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
125 | 125 | { |
126 | - foreach( $paths as $path ) |
|
126 | + foreach ($paths as $path) |
|
127 | 127 | { |
128 | 128 | $jsbAbsPath = $base . '/' . $path; |
129 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
130 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
129 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
130 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - foreach( $jsFiles as $file ) |
|
134 | + foreach ($jsFiles as $file) |
|
135 | 135 | { |
136 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
136 | + if (($content = file_get_contents($file)) !== false) { |
|
137 | 137 | $contents .= $content; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - $response = new Response( $contents ); |
|
142 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
141 | + $response = new Response($contents); |
|
142 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
143 | 143 | |
144 | 144 | return $response; |
145 | 145 | } |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | { |
155 | 155 | $result = array(); |
156 | 156 | |
157 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
158 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
157 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
158 | + $result[] = array('id' => $id, 'label' => $id); |
|
159 | 159 | } |
160 | 160 | |
161 | - return json_encode( $result ); |
|
161 | + return json_encode($result); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
169 | 169 | * @return string JSON encoded configuration object |
170 | 170 | */ |
171 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
171 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
172 | 172 | { |
173 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
174 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
173 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
174 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | * @param string $lang ISO language code like "en" or "en_GB" |
183 | 183 | * @return string JSON encoded translation object |
184 | 184 | */ |
185 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
185 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
186 | 186 | { |
187 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
187 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
188 | 188 | |
189 | 189 | $content = array( |
190 | - 'admin' => $i18n->getAll( 'admin' ), |
|
191 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
190 | + 'admin' => $i18n->getAll('admin'), |
|
191 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
192 | 192 | ); |
193 | 193 | |
194 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
194 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -203,19 +203,19 @@ discard block |
||
203 | 203 | * @return string JSON encoded site item object |
204 | 204 | * @throws Exception If no site item was found for the code |
205 | 205 | */ |
206 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
206 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
207 | 207 | { |
208 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
208 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
209 | 209 | |
210 | 210 | $criteria = $manager->createSearch(); |
211 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
212 | - $items = $manager->searchItems( $criteria ); |
|
211 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
212 | + $items = $manager->searchItems($criteria); |
|
213 | 213 | |
214 | - if( ( $item = reset( $items ) ) === false ) { |
|
215 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
214 | + if (($item = reset($items)) === false) { |
|
215 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
216 | 216 | } |
217 | 217 | |
218 | - return json_encode( $item->toArray() ); |
|
218 | + return json_encode($item->toArray()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
228 | 228 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
229 | 229 | */ |
230 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
230 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
231 | 231 | { |
232 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
232 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
233 | 233 | |
234 | 234 | try { |
235 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
236 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
235 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
236 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
237 | 237 | $localeItem = $localeManager->createItem(); |
238 | 238 | } |
239 | 239 | |
240 | - $context->setLocale( $localeItem ); |
|
240 | + $context->setLocale($localeItem); |
|
241 | 241 | |
242 | 242 | return $context; |
243 | 243 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * Creates a list of all available translations. |
146 | 146 | * |
147 | 147 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
148 | - * @return array List of language IDs with labels |
|
148 | + * @return string List of language IDs with labels |
|
149 | 149 | */ |
150 | 150 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
151 | 151 | { |
@@ -19,31 +19,31 @@ discard block |
||
19 | 19 | |
20 | 20 | public function testGetId() |
21 | 21 | { |
22 | - $this->assertEquals( null, $this->object->getId() ); |
|
22 | + $this->assertEquals(null, $this->object->getId()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testGetUsername() |
27 | 27 | { |
28 | - $this->assertEquals( null, $this->object->getUsername() ); |
|
28 | + $this->assertEquals(null, $this->object->getUsername()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testGetPassword() |
33 | 33 | { |
34 | - $this->assertEquals( null, $this->object->getPassword() ); |
|
34 | + $this->assertEquals(null, $this->object->getPassword()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetSalt() |
39 | 39 | { |
40 | - $this->assertEquals( 'mshop', $this->object->getSalt() ); |
|
40 | + $this->assertEquals('mshop', $this->object->getSalt()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetRoles() |
45 | 45 | { |
46 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
46 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testSerialize() |
57 | 57 | { |
58 | - $this->assertEquals( 'a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize() ); |
|
58 | + $this->assertEquals('a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testUnserialize() |
63 | 63 | { |
64 | - $this->object->unserialize( 'a:3:{i:0;N;i:1;N;i:2;N;}' ); |
|
64 | + $this->object->unserialize('a:3:{i:0;N;i:1;N;i:2;N;}'); |
|
65 | 65 | } |
66 | 66 | } |