@@ -12,26 +12,26 @@ discard block |
||
12 | 12 | $client = static::createClient(); |
13 | 13 | |
14 | 14 | |
15 | - $client->request( 'OPTIONS', '/unittest/jsonadm/product' ); |
|
15 | + $client->request('OPTIONS', '/unittest/jsonadm/product'); |
|
16 | 16 | $response = $client->getResponse(); |
17 | 17 | |
18 | - $json = json_decode( $response->getContent(), true ); |
|
18 | + $json = json_decode($response->getContent(), true); |
|
19 | 19 | |
20 | - $this->assertNotNull( $json ); |
|
21 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
22 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
23 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
20 | + $this->assertNotNull($json); |
|
21 | + $this->assertEquals(200, $response->getStatusCode()); |
|
22 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
23 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
24 | 24 | |
25 | 25 | |
26 | - $client->request( 'OPTIONS', '/unittest/jsonadm' ); |
|
26 | + $client->request('OPTIONS', '/unittest/jsonadm'); |
|
27 | 27 | $response = $client->getResponse(); |
28 | 28 | |
29 | - $json = json_decode( $response->getContent(), true ); |
|
29 | + $json = json_decode($response->getContent(), true); |
|
30 | 30 | |
31 | - $this->assertNotNull( $json ); |
|
32 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
33 | - $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
34 | - $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
31 | + $this->assertNotNull($json); |
|
32 | + $this->assertEquals(200, $response->getStatusCode()); |
|
33 | + $this->assertArrayHasKey('resources', $json['meta']); |
|
34 | + $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -41,58 +41,58 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}}'; |
44 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
44 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
45 | 45 | $response = $client->getResponse(); |
46 | 46 | |
47 | - $json = json_decode( $response->getContent(), true ); |
|
47 | + $json = json_decode($response->getContent(), true); |
|
48 | 48 | |
49 | - $this->assertNotNull( $json ); |
|
50 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
51 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
52 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
53 | - $this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
54 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
49 | + $this->assertNotNull($json); |
|
50 | + $this->assertEquals(201, $response->getStatusCode()); |
|
51 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
52 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.code']); |
|
53 | + $this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.label']); |
|
54 | + $this->assertEquals(1, $json['meta']['total']); |
|
55 | 55 | |
56 | 56 | $id = $json['data']['attributes']['product.stock.warehouse.id']; |
57 | 57 | |
58 | 58 | |
59 | 59 | $content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony2"}}}'; |
60 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content ); |
|
60 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content); |
|
61 | 61 | $response = $client->getResponse(); |
62 | 62 | |
63 | - $json = json_decode( $response->getContent(), true ); |
|
63 | + $json = json_decode($response->getContent(), true); |
|
64 | 64 | |
65 | - $this->assertNotNull( $json ); |
|
66 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
67 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
68 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
69 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
70 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
71 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
65 | + $this->assertNotNull($json); |
|
66 | + $this->assertEquals(200, $response->getStatusCode()); |
|
67 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
68 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
69 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
70 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
71 | + $this->assertEquals(1, $json['meta']['total']); |
|
72 | 72 | |
73 | 73 | |
74 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
74 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
75 | 75 | $response = $client->getResponse(); |
76 | 76 | |
77 | - $json = json_decode( $response->getContent(), true ); |
|
77 | + $json = json_decode($response->getContent(), true); |
|
78 | 78 | |
79 | - $this->assertNotNull( $json ); |
|
80 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
81 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data']['attributes'] ); |
|
82 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] ); |
|
83 | - $this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] ); |
|
84 | - $this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] ); |
|
85 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
79 | + $this->assertNotNull($json); |
|
80 | + $this->assertEquals(200, $response->getStatusCode()); |
|
81 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']); |
|
82 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']); |
|
83 | + $this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']); |
|
84 | + $this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']); |
|
85 | + $this->assertEquals(1, $json['meta']['total']); |
|
86 | 86 | |
87 | 87 | |
88 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id ); |
|
88 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id); |
|
89 | 89 | $response = $client->getResponse(); |
90 | 90 | |
91 | - $json = json_decode( $response->getContent(), true ); |
|
91 | + $json = json_decode($response->getContent(), true); |
|
92 | 92 | |
93 | - $this->assertNotNull( $json ); |
|
94 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
95 | - $this->assertEquals( 1, $json['meta']['total'] ); |
|
93 | + $this->assertNotNull($json); |
|
94 | + $this->assertEquals(200, $response->getStatusCode()); |
|
95 | + $this->assertEquals(1, $json['meta']['total']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,78 +105,78 @@ discard block |
||
105 | 105 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}, |
106 | 106 | {"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony"}} |
107 | 107 | ]}'; |
108 | - $client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
108 | + $client->request('POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
109 | 109 | $response = $client->getResponse(); |
110 | 110 | |
111 | - $json = json_decode( $response->getContent(), true ); |
|
111 | + $json = json_decode($response->getContent(), true); |
|
112 | 112 | |
113 | - $this->assertNotNull( $json ); |
|
114 | - $this->assertEquals( 201, $response->getStatusCode() ); |
|
115 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
116 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
117 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
118 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
119 | - $this->assertEquals( 'symfony', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
120 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
113 | + $this->assertNotNull($json); |
|
114 | + $this->assertEquals(201, $response->getStatusCode()); |
|
115 | + $this->assertEquals(2, count($json['data'])); |
|
116 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
117 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
118 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
119 | + $this->assertEquals('symfony', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
120 | + $this->assertEquals(2, $json['meta']['total']); |
|
121 | 121 | |
122 | - $ids = array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id'] ); |
|
122 | + $ids = array($json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id']); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | $content = '{"data":[ |
126 | 126 | {"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}, |
127 | 127 | {"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}} |
128 | 128 | ]}'; |
129 | - $client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
129 | + $client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
130 | 130 | $response = $client->getResponse(); |
131 | 131 | |
132 | - $json = json_decode( $response->getContent(), true ); |
|
133 | - |
|
134 | - $this->assertNotNull( $json ); |
|
135 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
136 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
137 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][0]['attributes'] ); |
|
138 | - $this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] ); |
|
139 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
140 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
141 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
142 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
143 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
144 | - |
|
145 | - |
|
146 | - $getParams = array( 'filter' => array( '&&' => array( |
|
147 | - array( '=~' => array( 'product.stock.warehouse.code' => 'symfony' ) ), |
|
148 | - array( '==' => array( 'product.stock.warehouse.label' => 'symfony2' ) ) |
|
149 | - ) ), |
|
150 | - 'sort' => 'product.stock.warehouse.code', 'page' => array( 'offset' => 0, 'limit' => 3 ) |
|
132 | + $json = json_decode($response->getContent(), true); |
|
133 | + |
|
134 | + $this->assertNotNull($json); |
|
135 | + $this->assertEquals(200, $response->getStatusCode()); |
|
136 | + $this->assertEquals(2, count($json['data'])); |
|
137 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][0]['attributes']); |
|
138 | + $this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']); |
|
139 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
140 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
141 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
142 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
143 | + $this->assertEquals(2, $json['meta']['total']); |
|
144 | + |
|
145 | + |
|
146 | + $getParams = array('filter' => array('&&' => array( |
|
147 | + array('=~' => array('product.stock.warehouse.code' => 'symfony')), |
|
148 | + array('==' => array('product.stock.warehouse.label' => 'symfony2')) |
|
149 | + )), |
|
150 | + 'sort' => 'product.stock.warehouse.code', 'page' => array('offset' => 0, 'limit' => 3) |
|
151 | 151 | ); |
152 | - $client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse', $getParams ); |
|
152 | + $client->request('GET', '/unittest/jsonadm/product/stock/warehouse', $getParams); |
|
153 | 153 | $response = $client->getResponse(); |
154 | 154 | |
155 | - $json = json_decode( $response->getContent(), true ); |
|
155 | + $json = json_decode($response->getContent(), true); |
|
156 | 156 | |
157 | - $this->assertNotNull( $json ); |
|
158 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
159 | - $this->assertEquals( 2, count( $json['data'] ) ); |
|
160 | - $this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.code'] ); |
|
161 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code'] ); |
|
162 | - $this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] ); |
|
163 | - $this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] ); |
|
164 | - $this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
165 | - $this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) ); |
|
166 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
157 | + $this->assertNotNull($json); |
|
158 | + $this->assertEquals(200, $response->getStatusCode()); |
|
159 | + $this->assertEquals(2, count($json['data'])); |
|
160 | + $this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.code']); |
|
161 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code']); |
|
162 | + $this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']); |
|
163 | + $this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']); |
|
164 | + $this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids)); |
|
165 | + $this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids)); |
|
166 | + $this->assertEquals(2, $json['meta']['total']); |
|
167 | 167 | |
168 | 168 | |
169 | 169 | $content = '{"data":[ |
170 | 170 | {"type":"product/stock/warehouse","id":' . $ids[0] . '}, |
171 | 171 | {"type":"product/stock/warehouse","id":' . $ids[1] . '} |
172 | 172 | ]}'; |
173 | - $client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content ); |
|
173 | + $client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content); |
|
174 | 174 | $response = $client->getResponse(); |
175 | 175 | |
176 | - $json = json_decode( $response->getContent(), true ); |
|
176 | + $json = json_decode($response->getContent(), true); |
|
177 | 177 | |
178 | - $this->assertNotNull( $json ); |
|
179 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
180 | - $this->assertEquals( 2, $json['meta']['total'] ); |
|
178 | + $this->assertNotNull($json); |
|
179 | + $this->assertEquals(200, $response->getStatusCode()); |
|
180 | + $this->assertEquals(2, $json['meta']['total']); |
|
181 | 181 | } |
182 | 182 | } |
@@ -10,210 +10,210 @@ |
||
10 | 10 | public function testCount() |
11 | 11 | { |
12 | 12 | $client = static::createClient(); |
13 | - $client->request( 'GET', '/unittest/de/EUR/count' ); |
|
13 | + $client->request('GET', '/unittest/de/EUR/count'); |
|
14 | 14 | $content = $client->getResponse()->getContent(); |
15 | 15 | |
16 | - $this->assertContains( '".catalog-filter-count li.cat-item"', $content ); |
|
17 | - $this->assertContains( '".catalog-filter-attribute .attribute-lists li.attr-item"', $content ); |
|
16 | + $this->assertContains('".catalog-filter-count li.cat-item"', $content); |
|
17 | + $this->assertContains('".catalog-filter-attribute .attribute-lists li.attr-item"', $content); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
21 | 21 | public function testFilterSearch() |
22 | 22 | { |
23 | 23 | $client = static::createClient(); |
24 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
24 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
25 | 25 | |
26 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-search' )->count() ); |
|
26 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-search')->count()); |
|
27 | 27 | |
28 | - $form = $crawler->filter( '.catalog-filter-search button' )->form(); |
|
28 | + $form = $crawler->filter('.catalog-filter-search button')->form(); |
|
29 | 29 | $form['f_search'] = 'Unit'; |
30 | - $crawler = $client->submit( $form ); |
|
30 | + $crawler = $client->submit($form); |
|
31 | 31 | |
32 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Test Selection")' )->count() ); |
|
33 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Empty Selection")' )->count() ); |
|
34 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->count() ); |
|
32 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Test Selection")')->count()); |
|
33 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Empty Selection")')->count()); |
|
34 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->count()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testFilterTree() |
39 | 39 | { |
40 | 40 | $client = static::createClient(); |
41 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
41 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
42 | 42 | |
43 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-tree' )->count() ); |
|
43 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-tree')->count()); |
|
44 | 44 | |
45 | - $link = $crawler->filter( '.catalog-filter-tree a.cat-item' )->link(); |
|
46 | - $crawler = $client->click( $link ); |
|
45 | + $link = $crawler->filter('.catalog-filter-tree a.cat-item')->link(); |
|
46 | + $crawler = $client->click($link); |
|
47 | 47 | |
48 | - $link = $crawler->filter( '.catalog-filter-tree .categories a.cat-item' )->link(); |
|
49 | - $crawler = $client->click( $link ); |
|
48 | + $link = $crawler->filter('.catalog-filter-tree .categories a.cat-item')->link(); |
|
49 | + $crawler = $client->click($link); |
|
50 | 50 | |
51 | - $link = $crawler->filter( '.catalog-filter-tree .coffee a.cat-item' )->link(); |
|
52 | - $crawler = $client->click( $link ); |
|
51 | + $link = $crawler->filter('.catalog-filter-tree .coffee a.cat-item')->link(); |
|
52 | + $crawler = $client->click($link); |
|
53 | 53 | |
54 | - $this->assertEquals( 3, $crawler->filter( '.catalog-stage-breadcrumb li' )->count() ); |
|
55 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-promo .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
54 | + $this->assertEquals(3, $crawler->filter('.catalog-stage-breadcrumb li')->count()); |
|
55 | + $this->assertEquals(1, $crawler->filter('.catalog-list-promo .product a:contains("Cafe Noire Expresso")')->count()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | 59 | public function testFilterAttribute() |
60 | 60 | { |
61 | 61 | $client = static::createClient(); |
62 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
62 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
63 | 63 | |
64 | - $this->assertEquals( 1, $crawler->filter( '.catalog-filter-attribute' )->count() ); |
|
64 | + $this->assertEquals(1, $crawler->filter('.catalog-filter-attribute')->count()); |
|
65 | 65 | |
66 | - $nodes = $crawler->filter( '.catalog-filter-attribute .attr-size span:contains("XS")' ); |
|
67 | - $id = $nodes->parents()->filter( '.attr-item' )->attr( 'data-id'); |
|
66 | + $nodes = $crawler->filter('.catalog-filter-attribute .attr-size span:contains("XS")'); |
|
67 | + $id = $nodes->parents()->filter('.attr-item')->attr('data-id'); |
|
68 | 68 | |
69 | - $form = $crawler->filter( '.catalog-filter .btn-action' )->form(); |
|
70 | - $form['f_attrid'] = array( $id => 'xs' ); |
|
71 | - $crawler = $client->submit( $form ); |
|
69 | + $form = $crawler->filter('.catalog-filter .btn-action')->form(); |
|
70 | + $form['f_attrid'] = array($id => 'xs'); |
|
71 | + $crawler = $client->submit($form); |
|
72 | 72 | |
73 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
74 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Cappuccino")' )->count() ); |
|
73 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->count()); |
|
74 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Cappuccino")')->count()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testStageBreadcrumb() |
79 | 79 | { |
80 | 80 | $client = static::createClient(); |
81 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
81 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
82 | 82 | |
83 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
84 | - $crawler = $client->click( $link ); |
|
83 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
84 | + $crawler = $client->click($link); |
|
85 | 85 | |
86 | - $this->assertEquals( 1, $crawler->filter( '.catalog-stage-breadcrumb li' )->count() ); |
|
86 | + $this->assertEquals(1, $crawler->filter('.catalog-stage-breadcrumb li')->count()); |
|
87 | 87 | |
88 | - $link = $crawler->filter( '.catalog-stage-breadcrumb a' )->link(); |
|
89 | - $crawler = $client->click( $link ); |
|
88 | + $link = $crawler->filter('.catalog-stage-breadcrumb a')->link(); |
|
89 | + $crawler = $client->click($link); |
|
90 | 90 | |
91 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list' )->count() ); |
|
92 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->count() ); |
|
93 | - $this->assertEquals( 1, $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Cappuccino")' )->count() ); |
|
91 | + $this->assertEquals(1, $crawler->filter('.catalog-list')->count()); |
|
92 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->count()); |
|
93 | + $this->assertEquals(1, $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Cappuccino")')->count()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | public function testStageNavigator() |
98 | 98 | { |
99 | 99 | $client = static::createClient(); |
100 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
100 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
101 | 101 | |
102 | - $link = $crawler->filter( '.catalog-list-pagination .option-name' )->link(); |
|
103 | - $crawler = $client->click( $link ); |
|
102 | + $link = $crawler->filter('.catalog-list-pagination .option-name')->link(); |
|
103 | + $crawler = $client->click($link); |
|
104 | 104 | |
105 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link(); |
|
106 | - $crawler = $client->click( $link ); |
|
105 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link(); |
|
106 | + $crawler = $client->click($link); |
|
107 | 107 | |
108 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
109 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Bundle")' )->count() ); |
|
108 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
109 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Bundle")')->count()); |
|
110 | 110 | |
111 | - $link = $crawler->filter( '.catalog-stage-navigator a.next' )->link(); |
|
112 | - $crawler = $client->click( $link ); |
|
111 | + $link = $crawler->filter('.catalog-stage-navigator a.next')->link(); |
|
112 | + $crawler = $client->click($link); |
|
113 | 113 | |
114 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
115 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Empty Selection")' )->count() ); |
|
114 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
115 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Empty Selection")')->count()); |
|
116 | 116 | |
117 | - $link = $crawler->filter( '.catalog-stage-navigator a.prev' )->link(); |
|
118 | - $crawler = $client->click( $link ); |
|
117 | + $link = $crawler->filter('.catalog-stage-navigator a.prev')->link(); |
|
118 | + $crawler = $client->click($link); |
|
119 | 119 | |
120 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail' )->count() ); |
|
121 | - $this->assertEquals( 1, $crawler->filter( '.catalog-detail:contains("Unittest: Bundle")' )->count() ); |
|
120 | + $this->assertEquals(1, $crawler->filter('.catalog-detail')->count()); |
|
121 | + $this->assertEquals(1, $crawler->filter('.catalog-detail:contains("Unittest: Bundle")')->count()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | public function testListSortationName() |
126 | 126 | { |
127 | 127 | $client = static::createClient(); |
128 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
128 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
129 | 129 | |
130 | - $link = $crawler->filter( '.catalog-list-pagination .option-name' )->link(); |
|
131 | - $crawler = $client->click( $link ); |
|
130 | + $link = $crawler->filter('.catalog-list-pagination .option-name')->link(); |
|
131 | + $crawler = $client->click($link); |
|
132 | 132 | |
133 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
134 | - $this->assertEquals( 1, $products->eq( 1 )->filter( 'h2:contains("Unittest: Bundle")' )->count() ); |
|
135 | - $this->assertEquals( 1, $products->eq( 2 )->filter( 'h2:contains("Unittest: Empty Selection")' )->count() ); |
|
133 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
134 | + $this->assertEquals(1, $products->eq(1)->filter('h2:contains("Unittest: Bundle")')->count()); |
|
135 | + $this->assertEquals(1, $products->eq(2)->filter('h2:contains("Unittest: Empty Selection")')->count()); |
|
136 | 136 | |
137 | - $link = $crawler->filter( '.catalog-list-pagination .option-name' )->link(); |
|
138 | - $crawler = $client->click( $link ); |
|
137 | + $link = $crawler->filter('.catalog-list-pagination .option-name')->link(); |
|
138 | + $crawler = $client->click($link); |
|
139 | 139 | |
140 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
140 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
141 | 141 | $count = $products->count(); |
142 | 142 | |
143 | - $this->assertGreaterThan( 2, $count ); |
|
144 | - $this->assertEquals( 1, $products->eq( $count - 3 )->filter( 'h2:contains("Unittest: Empty Selection")' )->count() ); |
|
145 | - $this->assertEquals( 1, $products->eq( $count - 2 )->filter( 'h2:contains("Unittest: Bundle")' )->count() ); |
|
143 | + $this->assertGreaterThan(2, $count); |
|
144 | + $this->assertEquals(1, $products->eq($count - 3)->filter('h2:contains("Unittest: Empty Selection")')->count()); |
|
145 | + $this->assertEquals(1, $products->eq($count - 2)->filter('h2:contains("Unittest: Bundle")')->count()); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | 149 | public function testListSortationPrice() |
150 | 150 | { |
151 | 151 | $client = static::createClient(); |
152 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
152 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
153 | 153 | |
154 | - $link = $crawler->filter( '.catalog-list-pagination .option-price' )->link(); |
|
155 | - $crawler = $client->click( $link ); |
|
154 | + $link = $crawler->filter('.catalog-list-pagination .option-price')->link(); |
|
155 | + $crawler = $client->click($link); |
|
156 | 156 | |
157 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
157 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
158 | 158 | $count = $products->count(); |
159 | 159 | |
160 | - $this->assertGreaterThan( 2, $count ); |
|
161 | - $this->assertEquals( 1, $products->eq( $count - 2 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
162 | - $this->assertEquals( 1, $products->eq( $count - 1 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
160 | + $this->assertGreaterThan(2, $count); |
|
161 | + $this->assertEquals(1, $products->eq($count - 2)->filter('.value:contains("600.00 €")')->count()); |
|
162 | + $this->assertEquals(1, $products->eq($count - 1)->filter('.value:contains("600.00 €")')->count()); |
|
163 | 163 | |
164 | - $link = $crawler->filter( '.catalog-list-pagination .option-price' )->link(); |
|
165 | - $crawler = $client->click( $link ); |
|
164 | + $link = $crawler->filter('.catalog-list-pagination .option-price')->link(); |
|
165 | + $crawler = $client->click($link); |
|
166 | 166 | |
167 | - $products = $crawler->filter( '.catalog-list-items .product' ); |
|
168 | - $this->assertEquals( 1, $products->eq( 0 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
169 | - $this->assertEquals( 1, $products->eq( 1 )->filter( '.value:contains("600.00 €")' )->count() ); |
|
167 | + $products = $crawler->filter('.catalog-list-items .product'); |
|
168 | + $this->assertEquals(1, $products->eq(0)->filter('.value:contains("600.00 €")')->count()); |
|
169 | + $this->assertEquals(1, $products->eq(1)->filter('.value:contains("600.00 €")')->count()); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
173 | 173 | public function testDetailPinned() |
174 | 174 | { |
175 | 175 | $client = static::createClient(); |
176 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
176 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
177 | 177 | |
178 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
179 | - $crawler = $client->click( $link ); |
|
178 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
179 | + $crawler = $client->click($link); |
|
180 | 180 | |
181 | - $link = $crawler->filter( '.catalog-detail a.actions-button-pin' )->link(); |
|
182 | - $crawler = $client->click( $link ); |
|
181 | + $link = $crawler->filter('.catalog-detail a.actions-button-pin')->link(); |
|
182 | + $crawler = $client->click($link); |
|
183 | 183 | |
184 | - $this->assertEquals( 1, $crawler->filter( '.catalog-session-pinned .pinned-item' )->count() ); |
|
184 | + $this->assertEquals(1, $crawler->filter('.catalog-session-pinned .pinned-item')->count()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | public function testDetailLastSeen() |
189 | 189 | { |
190 | 190 | $client = static::createClient(); |
191 | - $crawler = $client->request( 'GET', '/unittest/de/EUR/list' ); |
|
191 | + $crawler = $client->request('GET', '/unittest/de/EUR/list'); |
|
192 | 192 | |
193 | - $link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link(); |
|
194 | - $crawler = $client->click( $link ); |
|
193 | + $link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link(); |
|
194 | + $crawler = $client->click($link); |
|
195 | 195 | |
196 | - $this->assertEquals( 1, $crawler->filter( '.catalog-session-seen .seen-item' )->count() ); |
|
196 | + $this->assertEquals(1, $crawler->filter('.catalog-session-seen .seen-item')->count()); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | 200 | public function testSuggest() |
201 | 201 | { |
202 | 202 | $client = static::createClient(); |
203 | - $client->request( 'GET', '/unittest/de/EUR/suggest', array( 'f_search' => 'unit' ) ); |
|
203 | + $client->request('GET', '/unittest/de/EUR/suggest', array('f_search' => 'unit')); |
|
204 | 204 | $content = $client->getResponse()->getContent(); |
205 | 205 | |
206 | - $this->assertStringStartsWith( '[{', $content ); |
|
206 | + $this->assertStringStartsWith('[{', $content); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
210 | 210 | public function testStock() |
211 | 211 | { |
212 | 212 | $client = static::createClient(); |
213 | - $client->request( 'GET', '/unittest/de/EUR/stock' ); |
|
213 | + $client->request('GET', '/unittest/de/EUR/stock'); |
|
214 | 214 | $content = $client->getResponse()->getContent(); |
215 | 215 | |
216 | - $this->assertContains( '.aimeos .product .stock', $content ); |
|
217 | - $this->assertContains( '.aimeos .catalog-detail-basket', $content ); |
|
216 | + $this->assertContains('.aimeos .product .stock', $content); |
|
217 | + $this->assertContains('.aimeos .catalog-detail-basket', $content); |
|
218 | 218 | } |
219 | 219 | } |
@@ -12,11 +12,11 @@ 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', '/admin/unittest/de/0' ); |
|
15 | + )); |
|
16 | + $crawler = $client->request('GET', '/admin/unittest/de/0'); |
|
17 | 17 | |
18 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/admin/{site}/{lang}/{tab}")' )->count() ); |
|
19 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
18 | + $this->assertEquals(1, $crawler->filter('head:contains("/admin/{site}/{lang}/{tab}")')->count()); |
|
19 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | $client = static::createClient(array(), array( |
26 | 26 | 'PHP_AUTH_USER' => 'admin', |
27 | 27 | 'PHP_AUTH_PW' => 'adminpass', |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | |
30 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
30 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
31 | 31 | |
32 | - $client->request( 'POST', '/admin/do?_token=' . $token->getValue(), |
|
32 | + $client->request('POST', '/admin/do?_token=' . $token->getValue(), |
|
33 | 33 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
34 | 34 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
35 | 35 | ); |
36 | 36 | |
37 | - $this->assertStringStartsWith( '{', $client->getResponse()->getContent() ); |
|
37 | + $this->assertStringStartsWith('{', $client->getResponse()->getContent()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,10 +43,10 @@ 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 | - $client->request( 'GET', '/admin/file' ); |
|
48 | + $client->request('GET', '/admin/file'); |
|
49 | 49 | |
50 | - $this->assertContains( 'EXTUTIL', $client->getResponse()->getContent() ); |
|
50 | + $this->assertContains('EXTUTIL', $client->getResponse()->getContent()); |
|
51 | 51 | } |
52 | 52 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | $kernel = $this->createKernel(); |
15 | 15 | $kernel->boot(); |
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\SetupCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\SetupCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:setup' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'tplsite' => 'unittest', '--option' => 'setup/default/demo:0' ) ); |
|
20 | + $command = $application->find('aimeos:setup'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'tplsite' => 'unittest', '--option' => 'setup/default/demo:0')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | * @param CommandEvent $event CommandEvent instance |
26 | 26 | * @throws \RuntimeException If an error occured |
27 | 27 | */ |
28 | - public static function setupDatabase( CommandEvent $event ) |
|
28 | + public static function setupDatabase(CommandEvent $event) |
|
29 | 29 | { |
30 | 30 | $options = $env = array(); |
31 | 31 | |
32 | - if( $event->isDevMode() ) { |
|
32 | + if ($event->isDevMode()) { |
|
33 | 33 | $options[] = '--option=setup/default/demo:1'; |
34 | 34 | } else { |
35 | 35 | $env[] = '--env=prod'; |
36 | 36 | } |
37 | 37 | |
38 | - self::executeCommand( $event, 'aimeos:setup', $options + $env ); |
|
39 | - self::executeCommand( $event, 'aimeos:cache', $env ); |
|
38 | + self::executeCommand($event, 'aimeos:setup', $options + $env); |
|
39 | + self::executeCommand($event, 'aimeos:cache', $env); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | * @param CommandEvent $event CommandEvent instance |
47 | 47 | * @throws \RuntimeException If an error occured |
48 | 48 | */ |
49 | - public static function installBundle( CommandEvent $event ) |
|
49 | + public static function installBundle(CommandEvent $event) |
|
50 | 50 | { |
51 | - $event->getIO()->write( 'Installing the Aimeos shop bundle' ); |
|
51 | + $event->getIO()->write('Installing the Aimeos shop bundle'); |
|
52 | 52 | |
53 | - $options = self::getOptions( $event ); |
|
53 | + $options = self::getOptions($event); |
|
54 | 54 | |
55 | - if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) ) |
|
55 | + if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir'])) |
|
56 | 56 | { |
57 | 57 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
58 | - throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) ); |
|
58 | + throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir'])); |
|
59 | 59 | } |
60 | 60 | |
61 | - if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) ) |
|
61 | + if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir'])) |
|
62 | 62 | { |
63 | 63 | $msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available'; |
64 | - throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) ); |
|
64 | + throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir'])); |
|
65 | 65 | } |
66 | 66 | |
67 | - self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' ); |
|
68 | - self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' ); |
|
69 | - self::createDirectory( $options['symfony-web-dir'] . '/uploads' ); |
|
67 | + self::updateConfigFile($options['symfony-app-dir'] . '/config/config.yml'); |
|
68 | + self::updateRoutingFile($options['symfony-app-dir'] . '/config/routing.yml'); |
|
69 | + self::createDirectory($options['symfony-web-dir'] . '/uploads'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | * @param string $dir Absolute path of the new directory |
77 | 77 | * @throws \RuntimeException If directory couldn't be created |
78 | 78 | */ |
79 | - protected static function createDirectory( $dir ) |
|
79 | + protected static function createDirectory($dir) |
|
80 | 80 | { |
81 | 81 | $perm = 0755; |
82 | 82 | |
83 | - if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) ) |
|
83 | + if (!is_dir($dir) && !mkdir($dir, $perm, true)) |
|
84 | 84 | { |
85 | 85 | $msg = 'Unable to create directory "%1$s" with permission "%2$s"'; |
86 | - throw new \RuntimeException( sprintf( $msg, $dir, $perm ) ); |
|
86 | + throw new \RuntimeException(sprintf($msg, $dir, $perm)); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -96,28 +96,28 @@ discard block |
||
96 | 96 | * @param array List of configuration options for the given command |
97 | 97 | * @throws \RuntimeException If the command couldn't be executed |
98 | 98 | */ |
99 | - protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() ) |
|
99 | + protected static function executeCommand(CommandEvent $event, $cmd, array $options = array()) |
|
100 | 100 | { |
101 | - $php = escapeshellarg( self::getPhp() ); |
|
102 | - $console = escapeshellarg( self::getConsoleDir( $event ) . '/console' ); |
|
103 | - $cmd = escapeshellarg( $cmd ); |
|
101 | + $php = escapeshellarg(self::getPhp()); |
|
102 | + $console = escapeshellarg(self::getConsoleDir($event) . '/console'); |
|
103 | + $cmd = escapeshellarg($cmd); |
|
104 | 104 | |
105 | - foreach( $options as $key => $option ) { |
|
106 | - $options[$key] = escapeshellarg( $option ); |
|
105 | + foreach ($options as $key => $option) { |
|
106 | + $options[$key] = escapeshellarg($option); |
|
107 | 107 | } |
108 | 108 | |
109 | - if( $event->getIO()->isDecorated() ) { |
|
109 | + if ($event->getIO()->isDecorated()) { |
|
110 | 110 | $console .= ' --ansi'; |
111 | 111 | } |
112 | 112 | |
113 | - $process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 ); |
|
113 | + $process = new Process($php . ' ' . $console . ' ' . $cmd . ' ' . implode(' ', $options), null, null, null, 3600); |
|
114 | 114 | |
115 | - $process->run( function( $type, $buffer ) use ( $event ) { |
|
116 | - $event->getIO()->write( $buffer, false ); |
|
115 | + $process->run(function($type, $buffer) use ($event) { |
|
116 | + $event->getIO()->write($buffer, false); |
|
117 | 117 | } ); |
118 | 118 | |
119 | - if( !$process->isSuccessful() ) { |
|
120 | - throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) ); |
|
119 | + if (!$process->isSuccessful()) { |
|
120 | + throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd))); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | * @return string The path to the console directory |
131 | 131 | * @throws \RuntimeException If console directory couldn't be found |
132 | 132 | */ |
133 | - protected static function getConsoleDir( CommandEvent $event ) |
|
133 | + protected static function getConsoleDir(CommandEvent $event) |
|
134 | 134 | { |
135 | - $options = self::getOptions( $event ); |
|
135 | + $options = self::getOptions($event); |
|
136 | 136 | |
137 | - if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) { |
|
137 | + if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) { |
|
138 | 138 | return $options['symfony-bin-dir']; |
139 | 139 | } |
140 | 140 | |
141 | - if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) { |
|
141 | + if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) { |
|
142 | 142 | return $options['symfony-app-dir']; |
143 | 143 | } |
144 | 144 | |
145 | - throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) ); |
|
145 | + throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir')); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param CommandEvent $event Command event object |
153 | 153 | * @return array Associative list of option keys and values |
154 | 154 | */ |
155 | - protected static function getOptions( CommandEvent $event ) |
|
155 | + protected static function getOptions(CommandEvent $event) |
|
156 | 156 | { |
157 | 157 | return $event->getComposer()->getPackage()->getExtra(); |
158 | 158 | } |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | { |
169 | 169 | $phpFinder = new PhpExecutableFinder; |
170 | 170 | |
171 | - if( !( $phpPath = $phpFinder->find() ) ) { |
|
172 | - throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' ); |
|
171 | + if (!($phpPath = $phpFinder->find())) { |
|
172 | + throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $phpPath; |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | * @param string $filename Name of the YAML config file |
183 | 183 | * @throws \RuntimeException If file is not found |
184 | 184 | */ |
185 | - protected static function updateConfigFile( $filename ) |
|
185 | + protected static function updateConfigFile($filename) |
|
186 | 186 | { |
187 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
188 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
187 | + if (($content = file_get_contents($filename)) === false) { |
|
188 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
189 | 189 | } |
190 | 190 | |
191 | - if( self::addAsseticBundle( $content ) === true ) { |
|
191 | + if (self::addAsseticBundle($content) === true) { |
|
192 | 192 | $fs = new Filesystem(); |
193 | - $fs->dumpFile( $filename, $content ); |
|
193 | + $fs->dumpFile($filename, $content); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | * @param string $filename Name of the YAML config file |
202 | 202 | * @throws \RuntimeException If file is not found |
203 | 203 | */ |
204 | - protected static function updateRoutingFile( $filename ) |
|
204 | + protected static function updateRoutingFile($filename) |
|
205 | 205 | { |
206 | 206 | $update = false; |
207 | 207 | |
208 | - if( ( $content = file_get_contents( $filename ) ) === false ) { |
|
209 | - throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) ); |
|
208 | + if (($content = file_get_contents($filename)) === false) { |
|
209 | + throw new \RuntimeException(sprintf('File "%1$s" not found', $filename)); |
|
210 | 210 | } |
211 | 211 | |
212 | - if( strpos( $content, 'aimeos_shop:' ) === false ) |
|
212 | + if (strpos($content, 'aimeos_shop:') === false) |
|
213 | 213 | { |
214 | 214 | $content .= "\n" . 'aimeos_shop: |
215 | 215 | resource: "@AimeosShopBundle/Resources/config/routing.yml" |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | $update = true; |
219 | 219 | } |
220 | 220 | |
221 | - if( $update === true ) |
|
221 | + if ($update === true) |
|
222 | 222 | { |
223 | 223 | $fs = new Filesystem(); |
224 | - $fs->dumpFile( $filename, $content ); |
|
224 | + $fs->dumpFile($filename, $content); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | * @param string &$content Content of the config.yml file |
233 | 233 | * @return boolean True if modified, false if not |
234 | 234 | */ |
235 | - protected static function addAsseticBundle( &$content ) |
|
235 | + protected static function addAsseticBundle(&$content) |
|
236 | 236 | { |
237 | - if( preg_match( "/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 ) |
|
237 | + if (preg_match("/ bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1) |
|
238 | 238 | { |
239 | - $search = array( "/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/" ); |
|
240 | - $replace = array( " bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']" ); |
|
239 | + $search = array("/ bundles:[ ]*\[([^\]]+)\]/", "/ bundles:[ ]*\[([ ]*)\]/"); |
|
240 | + $replace = array(" bundles: [$1,'AimeosShopBundle']", " bundles: ['AimeosShopBundle']"); |
|
241 | 241 | |
242 | - if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) { |
|
242 | + if (($content = preg_replace($search, $replace, $content)) !== null) { |
|
243 | 243 | return true; |
244 | 244 | } |
245 | 245 | } |
@@ -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; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * @param string $pageName Name of the configured page |
41 | 41 | * @return array Associative list with body and header output separated by client name |
42 | 42 | */ |
43 | - public function getSections( $pageName ) |
|
43 | + public function getSections($pageName) |
|
44 | 44 | { |
45 | 45 | $context = $this->container->get('aimeos_context')->get(); |
46 | - $pagesConfig = $this->container->getParameter( 'aimeos_shop.page' ); |
|
47 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
46 | + $pagesConfig = $this->container->getParameter('aimeos_shop.page'); |
|
47 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
48 | 48 | |
49 | 49 | $langid = $context->getLocale()->getLanguageId(); |
50 | - $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths( 'client/html/templates' ); |
|
51 | - $view = $this->container->get('aimeos_view')->create( $context->getConfig(), $tmplPaths, $langid ); |
|
52 | - $context->setView( $view ); |
|
50 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); |
|
51 | + $view = $this->container->get('aimeos_view')->create($context->getConfig(), $tmplPaths, $langid); |
|
52 | + $context->setView($view); |
|
53 | 53 | |
54 | - if( isset( $pagesConfig[$pageName] ) ) |
|
54 | + if (isset($pagesConfig[$pageName])) |
|
55 | 55 | { |
56 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
56 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
57 | 57 | { |
58 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
59 | - $client->setView( clone $view ); |
|
58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
59 | + $client->setView(clone $view); |
|
60 | 60 | $client->process(); |
61 | 61 | |
62 | 62 | $result['aibody'][$clientName] = $client->getBody(); |
@@ -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 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Interface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths(); |
|
46 | + $i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths(); |
|
47 | 47 | |
48 | - foreach( $languageIds as $langid ) |
|
48 | + foreach ($languageIds as $langid) |
|
49 | 49 | { |
50 | - if( !isset( $this->i18n[$langid] ) ) |
|
50 | + if (!isset($this->i18n[$langid])) |
|
51 | 51 | { |
52 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $langid, array( 'disableNotices' => true ) ); |
|
52 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true)); |
|
53 | 53 | |
54 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
55 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
54 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
55 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
56 | 56 | |
57 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
58 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix ); |
|
57 | + if (function_exists('apc_store') === true && $apc === true) { |
|
58 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix); |
|
59 | 59 | } |
60 | 60 | |
61 | - $translations = $this->container->getParameter( 'aimeos_shop.i18n' ); |
|
61 | + $translations = $this->container->getParameter('aimeos_shop.i18n'); |
|
62 | 62 | |
63 | - if( isset( $translations[$langid] ) ) { |
|
64 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] ); |
|
63 | + if (isset($translations[$langid])) { |
|
64 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->i18n[$langid] = $i18n; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param RequestStack $requestStack Current request stack |
32 | 32 | * @param Container $container Container object to access parameters |
33 | 33 | */ |
34 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
34 | + public function __construct(RequestStack $requestStack, Container $container) |
|
35 | 35 | { |
36 | 36 | $this->requestStack = $requestStack; |
37 | 37 | $this->container = $container; |
@@ -46,53 +46,53 @@ discard block |
||
46 | 46 | * @param string|null $locale Code of the current language or null for no translation |
47 | 47 | * @return \Aimeos\MW\View\Iface View object |
48 | 48 | */ |
49 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
49 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
50 | 50 | { |
51 | 51 | $params = $fixed = array(); |
52 | 52 | $request = $this->requestStack->getMasterRequest(); |
53 | 53 | |
54 | - if( $locale !== null ) |
|
54 | + if ($locale !== null) |
|
55 | 55 | { |
56 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
56 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
57 | 57 | $fixed = $this->getFixedParams(); |
58 | 58 | |
59 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
59 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
60 | 60 | $translation = $i18n[$locale]; |
61 | 61 | } |
62 | 62 | else |
63 | 63 | { |
64 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
64 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
68 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
69 | 69 | |
70 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
71 | - $view->addHelper( 'translate', $helper ); |
|
70 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
71 | + $view->addHelper('translate', $helper); |
|
72 | 72 | |
73 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
74 | - $view->addHelper( 'url', $helper ); |
|
73 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
74 | + $view->addHelper('url', $helper); |
|
75 | 75 | |
76 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
77 | - $view->addHelper( 'param', $helper ); |
|
76 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
77 | + $view->addHelper('param', $helper); |
|
78 | 78 | |
79 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
80 | - $view->addHelper( 'config', $helper ); |
|
79 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
80 | + $view->addHelper('config', $helper); |
|
81 | 81 | |
82 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
83 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
84 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
85 | - $view->addHelper( 'number', $helper ); |
|
82 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
83 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
84 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
85 | + $view->addHelper('number', $helper); |
|
86 | 86 | |
87 | - if( $request !== null ) |
|
87 | + if ($request !== null) |
|
88 | 88 | { |
89 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
90 | - $view->addHelper( 'request', $helper ); |
|
89 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
90 | + $view->addHelper('request', $helper); |
|
91 | 91 | } |
92 | 92 | |
93 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
94 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
95 | - $view->addHelper( 'csrf', $helper ); |
|
93 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
94 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
95 | + $view->addHelper('csrf', $helper); |
|
96 | 96 | |
97 | 97 | return $view; |
98 | 98 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | $urlparams = array(); |
109 | 109 | $attr = $this->requestStack->getMasterRequest()->attributes; |
110 | 110 | |
111 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
111 | + if (($site = $attr->get('site')) !== null) { |
|
112 | 112 | $urlparams['site'] = $site; |
113 | 113 | } |
114 | 114 | |
115 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
115 | + if (($lang = $attr->get('locale')) !== null) { |
|
116 | 116 | $urlparams['locale'] = $lang; |
117 | 117 | } |
118 | 118 | |
119 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
119 | + if (($currency = $attr->get('currency')) !== null) { |
|
120 | 120 | $urlparams['currency'] = $currency; |
121 | 121 | } |
122 | 122 |
@@ -58,8 +58,7 @@ |
||
58 | 58 | |
59 | 59 | $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
60 | 60 | $translation = $i18n[$locale]; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
65 | 64 | } |