@@ -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 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class JobsCommandTest extends WebTestCase |
11 | 11 | { |
12 | - public function testJobsCommand() |
|
13 | - { |
|
14 | - $kernel = $this->createKernel(); |
|
15 | - $kernel->boot(); |
|
12 | + public function testJobsCommand() |
|
13 | + { |
|
14 | + $kernel = $this->createKernel(); |
|
15 | + $kernel->boot(); |
|
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\JobsCommand() ); |
|
17 | + $application = new Application( $kernel ); |
|
18 | + $application->add( new Command\JobsCommand() ); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:jobs' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild' ) ); |
|
20 | + $command = $application->find( 'aimeos:jobs' ); |
|
21 | + $commandTester = new CommandTester( $command ); |
|
22 | + $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild' ) ); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
25 | - } |
|
24 | + $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
25 | + } |
|
26 | 26 | } |
@@ -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\JobsCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\JobsCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:jobs' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild' ) ); |
|
20 | + $command = $application->find('aimeos:jobs'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'jobs' => 'index/rebuild')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class CacheCommandTest extends WebTestCase |
11 | 11 | { |
12 | - public function testCacheCommand() |
|
13 | - { |
|
14 | - $kernel = $this->createKernel(); |
|
15 | - $kernel->boot(); |
|
12 | + public function testCacheCommand() |
|
13 | + { |
|
14 | + $kernel = $this->createKernel(); |
|
15 | + $kernel->boot(); |
|
16 | 16 | |
17 | - $application = new Application( $kernel ); |
|
18 | - $application->add( new Command\CacheCommand() ); |
|
17 | + $application = new Application( $kernel ); |
|
18 | + $application->add( new Command\CacheCommand() ); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:cache' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) ); |
|
20 | + $command = $application->find( 'aimeos:cache' ); |
|
21 | + $commandTester = new CommandTester( $command ); |
|
22 | + $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) ); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
25 | - } |
|
24 | + $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
25 | + } |
|
26 | 26 | } |
@@ -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\CacheCommand() ); |
|
17 | + $application = new Application($kernel); |
|
18 | + $application->add(new Command\CacheCommand()); |
|
19 | 19 | |
20 | - $command = $application->find( 'aimeos:cache' ); |
|
21 | - $commandTester = new CommandTester( $command ); |
|
22 | - $commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) ); |
|
20 | + $command = $application->find('aimeos:cache'); |
|
21 | + $commandTester = new CommandTester($command); |
|
22 | + $commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest')); |
|
23 | 23 | |
24 | - $this->assertEquals( 0, $commandTester->getStatusCode() ); |
|
24 | + $this->assertEquals(0, $commandTester->getStatusCode()); |
|
25 | 25 | } |
26 | 26 | } |
@@ -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 | } |
@@ -20,229 +20,229 @@ |
||
20 | 20 | */ |
21 | 21 | class User implements UserInterface, \Serializable |
22 | 22 | { |
23 | - /** |
|
24 | - * @ORM\Column(type="integer") |
|
25 | - * @ORM\Id |
|
26 | - * @ORM\GeneratedValue(strategy="AUTO") |
|
27 | - */ |
|
28 | - protected $id; |
|
29 | - |
|
30 | - /** |
|
31 | - * @ORM\Column(name="siteid", type="integer") |
|
32 | - */ |
|
33 | - protected $siteid; |
|
34 | - |
|
35 | - /** |
|
36 | - * @ORM\Column(type="string", length=255) |
|
37 | - */ |
|
38 | - protected $label; |
|
39 | - |
|
40 | - /** |
|
41 | - * @ORM\Column(name="code", type="string", length=32) |
|
42 | - */ |
|
43 | - protected $username; |
|
44 | - |
|
45 | - /** |
|
46 | - * @ORM\Column(type="string", length=255) |
|
47 | - */ |
|
48 | - protected $password; |
|
49 | - |
|
50 | - /** |
|
51 | - * @ORM\Column(name="status", type="smallint") |
|
52 | - */ |
|
53 | - protected $isActive; |
|
54 | - |
|
55 | - /** |
|
56 | - * @ORM\Column(name="salutation", type="string", length=8) |
|
57 | - */ |
|
58 | - protected $salutation = ''; |
|
59 | - |
|
60 | - /** |
|
61 | - * @ORM\Column(name="company", type="string", length=100) |
|
62 | - */ |
|
63 | - protected $company = ''; |
|
64 | - |
|
65 | - /** |
|
66 | - * @ORM\Column(name="vatid", type="string", length=32) |
|
67 | - */ |
|
68 | - protected $vatid = ''; |
|
69 | - |
|
70 | - /** |
|
71 | - * @ORM\Column(name="title", type="string", length=64) |
|
72 | - */ |
|
73 | - protected $title = ''; |
|
74 | - |
|
75 | - /** |
|
76 | - * @ORM\Column(name="firstname", type="string", length=64) |
|
77 | - */ |
|
78 | - protected $firstname = ''; |
|
79 | - |
|
80 | - /** |
|
81 | - * @ORM\Column(name="lastname", type="string", length=64) |
|
82 | - */ |
|
83 | - protected $lastname = ''; |
|
84 | - |
|
85 | - /** |
|
86 | - * @ORM\Column(name="address1", type="string", length=255) |
|
87 | - */ |
|
88 | - protected $address1 = ''; |
|
89 | - |
|
90 | - /** |
|
91 | - * @ORM\Column(name="address2", type="string", length=255) |
|
92 | - */ |
|
93 | - protected $address2 = ''; |
|
94 | - |
|
95 | - /** |
|
96 | - * @ORM\Column(name="address3", type="string", length=255) |
|
97 | - */ |
|
98 | - protected $address3 = ''; |
|
99 | - |
|
100 | - /** |
|
101 | - * @ORM\Column(name="postal", type="string", length=16) |
|
102 | - */ |
|
103 | - protected $postal = ''; |
|
104 | - |
|
105 | - /** |
|
106 | - * @ORM\Column(name="city", type="string", length=255) |
|
107 | - */ |
|
108 | - protected $city = ''; |
|
109 | - |
|
110 | - /** |
|
111 | - * @ORM\Column(name="state", type="string", length=255) |
|
112 | - */ |
|
113 | - protected $state = ''; |
|
114 | - |
|
115 | - /** |
|
116 | - * @ORM\Column(name="langid", type="string", length=5, nullable=true) |
|
117 | - */ |
|
118 | - protected $langid = ''; |
|
119 | - |
|
120 | - /** |
|
121 | - * @ORM\Column(name="countryid", type="string", length=2, nullable=true) |
|
122 | - */ |
|
123 | - protected $countryid = ''; |
|
124 | - |
|
125 | - /** |
|
126 | - * @ORM\Column(name="telephone", type="string", length=32) |
|
127 | - */ |
|
128 | - protected $telephone = ''; |
|
129 | - |
|
130 | - /** |
|
131 | - * @ORM\Column(name="telefax", type="string", length=255) |
|
132 | - */ |
|
133 | - protected $telefax = ''; |
|
134 | - |
|
135 | - /** |
|
136 | - * @ORM\Column(name="email", type="string", length=255) |
|
137 | - */ |
|
138 | - protected $email = ''; |
|
139 | - |
|
140 | - /** |
|
141 | - * @ORM\Column(name="website", type="string", length=255) |
|
142 | - */ |
|
143 | - protected $website = ''; |
|
144 | - |
|
145 | - /** |
|
146 | - * @ORM\Column(name="birthday", type="date", nullable=true) |
|
147 | - */ |
|
148 | - protected $birthday; |
|
149 | - |
|
150 | - /** |
|
151 | - * @ORM\Column(name="vdate", type="date", nullable=true) |
|
152 | - */ |
|
153 | - protected $vdate; |
|
154 | - |
|
155 | - /** |
|
156 | - * @ORM\Column(name="ctime", type="datetime") |
|
157 | - */ |
|
158 | - protected $ctime; |
|
159 | - |
|
160 | - /** |
|
161 | - * @ORM\Column(name="mtime", type="datetime") |
|
162 | - */ |
|
163 | - protected $mtime; |
|
164 | - |
|
165 | - /** |
|
166 | - * @ORM\Column(name="editor", type="string", length=255) |
|
167 | - */ |
|
168 | - protected $editor = ''; |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @inheritDoc |
|
173 | - */ |
|
174 | - public function getId() |
|
175 | - { |
|
176 | - return $this->id; |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * @inheritDoc |
|
182 | - */ |
|
183 | - public function getUsername() |
|
184 | - { |
|
185 | - return $this->username; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * @inheritDoc |
|
191 | - */ |
|
192 | - public function getSalt() |
|
193 | - { |
|
194 | - return 'mshop'; |
|
195 | - } |
|
196 | - |
|
197 | - |
|
198 | - /** |
|
199 | - * @inheritDoc |
|
200 | - */ |
|
201 | - public function getPassword() |
|
202 | - { |
|
203 | - return $this->password; |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - /** |
|
208 | - * @inheritDoc |
|
209 | - */ |
|
210 | - public function getRoles() |
|
211 | - { |
|
212 | - return array( 'ROLE_USER' ); |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * @inheritDoc |
|
218 | - */ |
|
219 | - public function eraseCredentials() |
|
220 | - { |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - /** |
|
225 | - * @see \Serializable::serialize() |
|
226 | - */ |
|
227 | - public function serialize() |
|
228 | - { |
|
229 | - return serialize( array( |
|
230 | - $this->id, |
|
231 | - $this->username, |
|
232 | - $this->password, |
|
233 | - ) ); |
|
234 | - } |
|
235 | - |
|
236 | - |
|
237 | - /** |
|
238 | - * @see \Serializable::unserialize() |
|
239 | - */ |
|
240 | - public function unserialize( $serialized ) |
|
241 | - { |
|
242 | - list ( |
|
243 | - $this->id, |
|
244 | - $this->username, |
|
245 | - $this->password, |
|
246 | - ) = unserialize( $serialized ); |
|
247 | - } |
|
23 | + /** |
|
24 | + * @ORM\Column(type="integer") |
|
25 | + * @ORM\Id |
|
26 | + * @ORM\GeneratedValue(strategy="AUTO") |
|
27 | + */ |
|
28 | + protected $id; |
|
29 | + |
|
30 | + /** |
|
31 | + * @ORM\Column(name="siteid", type="integer") |
|
32 | + */ |
|
33 | + protected $siteid; |
|
34 | + |
|
35 | + /** |
|
36 | + * @ORM\Column(type="string", length=255) |
|
37 | + */ |
|
38 | + protected $label; |
|
39 | + |
|
40 | + /** |
|
41 | + * @ORM\Column(name="code", type="string", length=32) |
|
42 | + */ |
|
43 | + protected $username; |
|
44 | + |
|
45 | + /** |
|
46 | + * @ORM\Column(type="string", length=255) |
|
47 | + */ |
|
48 | + protected $password; |
|
49 | + |
|
50 | + /** |
|
51 | + * @ORM\Column(name="status", type="smallint") |
|
52 | + */ |
|
53 | + protected $isActive; |
|
54 | + |
|
55 | + /** |
|
56 | + * @ORM\Column(name="salutation", type="string", length=8) |
|
57 | + */ |
|
58 | + protected $salutation = ''; |
|
59 | + |
|
60 | + /** |
|
61 | + * @ORM\Column(name="company", type="string", length=100) |
|
62 | + */ |
|
63 | + protected $company = ''; |
|
64 | + |
|
65 | + /** |
|
66 | + * @ORM\Column(name="vatid", type="string", length=32) |
|
67 | + */ |
|
68 | + protected $vatid = ''; |
|
69 | + |
|
70 | + /** |
|
71 | + * @ORM\Column(name="title", type="string", length=64) |
|
72 | + */ |
|
73 | + protected $title = ''; |
|
74 | + |
|
75 | + /** |
|
76 | + * @ORM\Column(name="firstname", type="string", length=64) |
|
77 | + */ |
|
78 | + protected $firstname = ''; |
|
79 | + |
|
80 | + /** |
|
81 | + * @ORM\Column(name="lastname", type="string", length=64) |
|
82 | + */ |
|
83 | + protected $lastname = ''; |
|
84 | + |
|
85 | + /** |
|
86 | + * @ORM\Column(name="address1", type="string", length=255) |
|
87 | + */ |
|
88 | + protected $address1 = ''; |
|
89 | + |
|
90 | + /** |
|
91 | + * @ORM\Column(name="address2", type="string", length=255) |
|
92 | + */ |
|
93 | + protected $address2 = ''; |
|
94 | + |
|
95 | + /** |
|
96 | + * @ORM\Column(name="address3", type="string", length=255) |
|
97 | + */ |
|
98 | + protected $address3 = ''; |
|
99 | + |
|
100 | + /** |
|
101 | + * @ORM\Column(name="postal", type="string", length=16) |
|
102 | + */ |
|
103 | + protected $postal = ''; |
|
104 | + |
|
105 | + /** |
|
106 | + * @ORM\Column(name="city", type="string", length=255) |
|
107 | + */ |
|
108 | + protected $city = ''; |
|
109 | + |
|
110 | + /** |
|
111 | + * @ORM\Column(name="state", type="string", length=255) |
|
112 | + */ |
|
113 | + protected $state = ''; |
|
114 | + |
|
115 | + /** |
|
116 | + * @ORM\Column(name="langid", type="string", length=5, nullable=true) |
|
117 | + */ |
|
118 | + protected $langid = ''; |
|
119 | + |
|
120 | + /** |
|
121 | + * @ORM\Column(name="countryid", type="string", length=2, nullable=true) |
|
122 | + */ |
|
123 | + protected $countryid = ''; |
|
124 | + |
|
125 | + /** |
|
126 | + * @ORM\Column(name="telephone", type="string", length=32) |
|
127 | + */ |
|
128 | + protected $telephone = ''; |
|
129 | + |
|
130 | + /** |
|
131 | + * @ORM\Column(name="telefax", type="string", length=255) |
|
132 | + */ |
|
133 | + protected $telefax = ''; |
|
134 | + |
|
135 | + /** |
|
136 | + * @ORM\Column(name="email", type="string", length=255) |
|
137 | + */ |
|
138 | + protected $email = ''; |
|
139 | + |
|
140 | + /** |
|
141 | + * @ORM\Column(name="website", type="string", length=255) |
|
142 | + */ |
|
143 | + protected $website = ''; |
|
144 | + |
|
145 | + /** |
|
146 | + * @ORM\Column(name="birthday", type="date", nullable=true) |
|
147 | + */ |
|
148 | + protected $birthday; |
|
149 | + |
|
150 | + /** |
|
151 | + * @ORM\Column(name="vdate", type="date", nullable=true) |
|
152 | + */ |
|
153 | + protected $vdate; |
|
154 | + |
|
155 | + /** |
|
156 | + * @ORM\Column(name="ctime", type="datetime") |
|
157 | + */ |
|
158 | + protected $ctime; |
|
159 | + |
|
160 | + /** |
|
161 | + * @ORM\Column(name="mtime", type="datetime") |
|
162 | + */ |
|
163 | + protected $mtime; |
|
164 | + |
|
165 | + /** |
|
166 | + * @ORM\Column(name="editor", type="string", length=255) |
|
167 | + */ |
|
168 | + protected $editor = ''; |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @inheritDoc |
|
173 | + */ |
|
174 | + public function getId() |
|
175 | + { |
|
176 | + return $this->id; |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * @inheritDoc |
|
182 | + */ |
|
183 | + public function getUsername() |
|
184 | + { |
|
185 | + return $this->username; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * @inheritDoc |
|
191 | + */ |
|
192 | + public function getSalt() |
|
193 | + { |
|
194 | + return 'mshop'; |
|
195 | + } |
|
196 | + |
|
197 | + |
|
198 | + /** |
|
199 | + * @inheritDoc |
|
200 | + */ |
|
201 | + public function getPassword() |
|
202 | + { |
|
203 | + return $this->password; |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + /** |
|
208 | + * @inheritDoc |
|
209 | + */ |
|
210 | + public function getRoles() |
|
211 | + { |
|
212 | + return array( 'ROLE_USER' ); |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * @inheritDoc |
|
218 | + */ |
|
219 | + public function eraseCredentials() |
|
220 | + { |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + /** |
|
225 | + * @see \Serializable::serialize() |
|
226 | + */ |
|
227 | + public function serialize() |
|
228 | + { |
|
229 | + return serialize( array( |
|
230 | + $this->id, |
|
231 | + $this->username, |
|
232 | + $this->password, |
|
233 | + ) ); |
|
234 | + } |
|
235 | + |
|
236 | + |
|
237 | + /** |
|
238 | + * @see \Serializable::unserialize() |
|
239 | + */ |
|
240 | + public function unserialize( $serialized ) |
|
241 | + { |
|
242 | + list ( |
|
243 | + $this->id, |
|
244 | + $this->username, |
|
245 | + $this->password, |
|
246 | + ) = unserialize( $serialized ); |
|
247 | + } |
|
248 | 248 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getRoles() |
211 | 211 | { |
212 | - return array( 'ROLE_USER' ); |
|
212 | + return array('ROLE_USER'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function serialize() |
228 | 228 | { |
229 | - return serialize( array( |
|
229 | + return serialize(array( |
|
230 | 230 | $this->id, |
231 | 231 | $this->username, |
232 | 232 | $this->password, |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @see \Serializable::unserialize() |
239 | 239 | */ |
240 | - public function unserialize( $serialized ) |
|
240 | + public function unserialize($serialized) |
|
241 | 241 | { |
242 | 242 | list ( |
243 | 243 | $this->id, |
244 | 244 | $this->username, |
245 | 245 | $this->password, |
246 | - ) = unserialize( $serialized ); |
|
246 | + ) = unserialize($serialized); |
|
247 | 247 | } |
248 | 248 | } |
@@ -20,532 +20,532 @@ |
||
20 | 20 | */ |
21 | 21 | class FosUser extends BaseUser |
22 | 22 | { |
23 | - /** |
|
24 | - * @ORM\Id |
|
25 | - * @ORM\Column(type="integer") |
|
26 | - * @ORM\GeneratedValue(strategy="AUTO") |
|
27 | - */ |
|
28 | - protected $id; |
|
29 | - |
|
30 | - /** |
|
31 | - * @ORM\Column(name="salutation", type="string", length=8) |
|
32 | - */ |
|
33 | - protected $salutation = ''; |
|
34 | - |
|
35 | - /** |
|
36 | - * @ORM\Column(name="company", type="string", length=100) |
|
37 | - */ |
|
38 | - protected $company = ''; |
|
39 | - |
|
40 | - /** |
|
41 | - * @ORM\Column(name="vatid", type="string", length=32) |
|
42 | - */ |
|
43 | - protected $vatid = ''; |
|
44 | - |
|
45 | - /** |
|
46 | - * @ORM\Column(name="title", type="string", length=64) |
|
47 | - */ |
|
48 | - protected $title = ''; |
|
49 | - |
|
50 | - /** |
|
51 | - * @ORM\Column(name="firstname", type="string", length=64) |
|
52 | - */ |
|
53 | - protected $firstname = ''; |
|
54 | - |
|
55 | - /** |
|
56 | - * @ORM\Column(name="lastname", type="string", length=64) |
|
57 | - */ |
|
58 | - protected $lastname = ''; |
|
59 | - |
|
60 | - /** |
|
61 | - * @ORM\Column(name="address1", type="string", length=255) |
|
62 | - */ |
|
63 | - protected $address1 = ''; |
|
64 | - |
|
65 | - /** |
|
66 | - * @ORM\Column(name="address2", type="string", length=255) |
|
67 | - */ |
|
68 | - protected $address2 = ''; |
|
69 | - |
|
70 | - /** |
|
71 | - * @ORM\Column(name="address3", type="string", length=255) |
|
72 | - */ |
|
73 | - protected $address3 = ''; |
|
74 | - |
|
75 | - /** |
|
76 | - * @ORM\Column(name="postal", type="string", length=16) |
|
77 | - */ |
|
78 | - protected $postal = ''; |
|
79 | - |
|
80 | - /** |
|
81 | - * @ORM\Column(name="city", type="string", length=255) |
|
82 | - */ |
|
83 | - protected $city = ''; |
|
84 | - |
|
85 | - /** |
|
86 | - * @ORM\Column(name="state", type="string", length=255) |
|
87 | - */ |
|
88 | - protected $state = ''; |
|
89 | - |
|
90 | - /** |
|
91 | - * @ORM\Column(name="langid", type="string", length=5, nullable=true) |
|
92 | - */ |
|
93 | - protected $langid = ''; |
|
94 | - |
|
95 | - /** |
|
96 | - * @ORM\Column(name="countryid", type="string", length=2, nullable=true) |
|
97 | - */ |
|
98 | - protected $countryid = ''; |
|
99 | - |
|
100 | - /** |
|
101 | - * @ORM\Column(name="telephone", type="string", length=32) |
|
102 | - */ |
|
103 | - protected $telephone = ''; |
|
104 | - |
|
105 | - /** |
|
106 | - * @ORM\Column(name="telefax", type="string", length=255) |
|
107 | - */ |
|
108 | - protected $telefax = ''; |
|
109 | - |
|
110 | - /** |
|
111 | - * @ORM\Column(name="website", type="string", length=255) |
|
112 | - */ |
|
113 | - protected $website = ''; |
|
114 | - |
|
115 | - /** |
|
116 | - * @ORM\Column(name="birthday", type="date", nullable=true) |
|
117 | - */ |
|
118 | - protected $birthday; |
|
119 | - |
|
120 | - /** |
|
121 | - * @ORM\Column(name="vdate", type="date", nullable=true) |
|
122 | - */ |
|
123 | - protected $vdate; |
|
124 | - |
|
125 | - /** |
|
126 | - * @ORM\Column(name="ctime", type="datetime") |
|
127 | - */ |
|
128 | - protected $ctime; |
|
129 | - |
|
130 | - /** |
|
131 | - * @ORM\Column(name="mtime", type="datetime") |
|
132 | - */ |
|
133 | - protected $mtime; |
|
134 | - |
|
135 | - /** |
|
136 | - * @ORM\Column(name="editor", type="string", length=255) |
|
137 | - */ |
|
138 | - protected $editor = ''; |
|
139 | - |
|
140 | - |
|
141 | - public function __construct() |
|
142 | - { |
|
143 | - parent::__construct(); |
|
144 | - |
|
145 | - $this->ctime = new \DateTime(); |
|
146 | - $this->mtime = new \DateTime(); |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * Returns the user unique id. |
|
152 | - * |
|
153 | - * @return mixed |
|
154 | - */ |
|
155 | - public function getId() |
|
156 | - { |
|
157 | - return $this->id; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * Returns the company name. |
|
163 | - * |
|
164 | - * @return string Company name |
|
165 | - */ |
|
166 | - public function getCompany() |
|
167 | - { |
|
168 | - return $this->company; |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - /** |
|
173 | - * Sets a new company name. |
|
174 | - * |
|
175 | - * @param string $company New company name |
|
176 | - */ |
|
177 | - public function setCompany($company) |
|
178 | - { |
|
179 | - $this->company = (string) $company; |
|
180 | - } |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * Returns the vatid. |
|
185 | - * |
|
186 | - * @return string vatid |
|
187 | - */ |
|
188 | - public function getVatID() |
|
189 | - { |
|
190 | - return $this->vatid; |
|
191 | - } |
|
192 | - |
|
193 | - |
|
194 | - /** |
|
195 | - * Sets a new vatid. |
|
196 | - * |
|
197 | - * @param string $vatid New vatid |
|
198 | - */ |
|
199 | - public function setVatID($vatid) |
|
200 | - { |
|
201 | - $this->vatid = (string) $vatid; |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * Returns the salutation constant for the person described by the address. |
|
207 | - * |
|
208 | - * @return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
|
209 | - */ |
|
210 | - public function getSalutation() |
|
211 | - { |
|
212 | - return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * Sets the new salutation for the person described by the address. |
|
218 | - * |
|
219 | - * @param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
|
220 | - */ |
|
221 | - public function setSalutation($salutation) |
|
222 | - { |
|
223 | - switch( $salutation ) |
|
224 | - { |
|
225 | - case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
|
226 | - case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
|
227 | - case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS: |
|
228 | - case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS: |
|
229 | - case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
|
230 | - break; |
|
231 | - default: |
|
232 | - throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
|
233 | - } |
|
234 | - |
|
235 | - $this->salutation = (string) $salutation; |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * Returns the title of the person. |
|
241 | - * |
|
242 | - * @return string Title of the person |
|
243 | - */ |
|
244 | - public function getTitle() |
|
245 | - { |
|
246 | - return $this->title; |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - /** |
|
251 | - * Sets a new title of the person. |
|
252 | - * |
|
253 | - * @param string $title New title of the person |
|
254 | - */ |
|
255 | - public function setTitle($title) |
|
256 | - { |
|
257 | - $this->title = (string) $title; |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * Returns the first name of the person. |
|
263 | - * |
|
264 | - * @return string First name of the person |
|
265 | - */ |
|
266 | - public function getFirstname() |
|
267 | - { |
|
268 | - return $this->firstname; |
|
269 | - } |
|
270 | - |
|
271 | - |
|
272 | - /** |
|
273 | - * Sets a new first name of the person. |
|
274 | - * |
|
275 | - * @param string $firstname New first name of the person |
|
276 | - */ |
|
277 | - public function setFirstname($firstname) |
|
278 | - { |
|
279 | - $this->firstname = (string) $firstname; |
|
280 | - } |
|
281 | - |
|
282 | - |
|
283 | - /** |
|
284 | - * Returns the last name of the person. |
|
285 | - * |
|
286 | - * @return string Last name of the person |
|
287 | - */ |
|
288 | - public function getLastname() |
|
289 | - { |
|
290 | - return $this->lastname; |
|
291 | - } |
|
292 | - |
|
293 | - |
|
294 | - /** |
|
295 | - * Sets a new last name of the person. |
|
296 | - * |
|
297 | - * @param string $lastname New last name of the person |
|
298 | - */ |
|
299 | - public function setLastname($lastname) |
|
300 | - { |
|
301 | - $this->lastname = (string) $lastname; |
|
302 | - } |
|
303 | - |
|
304 | - |
|
305 | - /** |
|
306 | - * Returns the first address part, e.g. the street name. |
|
307 | - * |
|
308 | - * @return string First address part |
|
309 | - */ |
|
310 | - public function getAddress1() |
|
311 | - { |
|
312 | - return $this->address1; |
|
313 | - } |
|
314 | - |
|
315 | - |
|
316 | - /** |
|
317 | - * Sets a new first address part, e.g. the street name. |
|
318 | - * |
|
319 | - * @param string $address1 New first address part |
|
320 | - */ |
|
321 | - public function setAddress1($address1) |
|
322 | - { |
|
323 | - $this->address1 = (string) $address1; |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * Returns the second address part, e.g. the house number. |
|
329 | - * |
|
330 | - * @return string Second address part |
|
331 | - */ |
|
332 | - public function getAddress2() |
|
333 | - { |
|
334 | - return $this->address2; |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - /** |
|
339 | - * Sets a new second address part, e.g. the house number. |
|
340 | - * |
|
341 | - * @param string $address2 New second address part |
|
342 | - */ |
|
343 | - public function setAddress2($address2) |
|
344 | - { |
|
345 | - $this->address2 = (string) $address2; |
|
346 | - } |
|
347 | - |
|
348 | - |
|
349 | - /** |
|
350 | - * Returns the third address part, e.g. the house name or floor number. |
|
351 | - * |
|
352 | - * @return string third address part |
|
353 | - */ |
|
354 | - public function getAddress3() |
|
355 | - { |
|
356 | - return $this->address3; |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - /** |
|
361 | - * Sets a new third address part, e.g. the house name or floor number. |
|
362 | - * |
|
363 | - * @param string $address3 New third address part |
|
364 | - */ |
|
365 | - public function setAddress3($address3) |
|
366 | - { |
|
367 | - $this->address3 = (string) $address3; |
|
368 | - } |
|
369 | - |
|
370 | - |
|
371 | - /** |
|
372 | - * Returns the postal code. |
|
373 | - * |
|
374 | - * @return string Postal code |
|
375 | - */ |
|
376 | - public function getPostal() |
|
377 | - { |
|
378 | - return $this->postal; |
|
379 | - } |
|
380 | - |
|
381 | - |
|
382 | - /** |
|
383 | - * Sets a new postal code. |
|
384 | - * |
|
385 | - * @param string $postal New postal code |
|
386 | - */ |
|
387 | - public function setPostal($postal) |
|
388 | - { |
|
389 | - $this->postal = (string) $postal; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - /** |
|
394 | - * Returns the city name. |
|
395 | - * |
|
396 | - * @return string City name |
|
397 | - */ |
|
398 | - public function getCity() |
|
399 | - { |
|
400 | - return $this->city; |
|
401 | - } |
|
402 | - |
|
403 | - |
|
404 | - /** |
|
405 | - * Sets a new city name. |
|
406 | - * |
|
407 | - * @param string $city New city name |
|
408 | - */ |
|
409 | - public function setCity($city) |
|
410 | - { |
|
411 | - $this->city = (string) $city; |
|
412 | - } |
|
413 | - |
|
414 | - |
|
415 | - /** |
|
416 | - * Returns the state name. |
|
417 | - * |
|
418 | - * @return string State name |
|
419 | - */ |
|
420 | - public function getState() |
|
421 | - { |
|
422 | - return $this->state; |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * Sets a new state name. |
|
428 | - * |
|
429 | - * @param string $state New state name |
|
430 | - */ |
|
431 | - public function setState($state) |
|
432 | - { |
|
433 | - $this->state = (string) $state; |
|
434 | - } |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * Sets the ID of the country the address is in. |
|
439 | - * |
|
440 | - * @param string $countryid Unique ID of the country |
|
441 | - */ |
|
442 | - public function setCountryId($countryid) |
|
443 | - { |
|
444 | - $this->countryid = strtoupper( (string) $countryid ); |
|
445 | - } |
|
446 | - |
|
447 | - |
|
448 | - /** |
|
449 | - * Returns the unique ID of the country the address belongs to. |
|
450 | - * |
|
451 | - * @return string Unique ID of the country |
|
452 | - */ |
|
453 | - public function getCountryId() |
|
454 | - { |
|
455 | - return $this->countryid; |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - /** |
|
460 | - * Sets the ID of the language. |
|
461 | - * |
|
462 | - * @param string $langid Unique ID of the language |
|
463 | - */ |
|
464 | - public function setLanguageId($langid) |
|
465 | - { |
|
466 | - $this->langid = strtolower( (string) $langid ); |
|
467 | - } |
|
468 | - |
|
469 | - |
|
470 | - /** |
|
471 | - * Returns the unique ID of the language. |
|
472 | - * |
|
473 | - * @return string Unique ID of the language |
|
474 | - */ |
|
475 | - public function getLanguageId() |
|
476 | - { |
|
477 | - return $this->langid; |
|
478 | - } |
|
479 | - |
|
480 | - |
|
481 | - /** |
|
482 | - * Returns the telephone number. |
|
483 | - * |
|
484 | - * @return string Telephone number |
|
485 | - */ |
|
486 | - public function getTelephone() |
|
487 | - { |
|
488 | - return $this->telephone; |
|
489 | - } |
|
490 | - |
|
491 | - |
|
492 | - /** |
|
493 | - * Sets a new telephone number. |
|
494 | - * |
|
495 | - * @param string $telephone New telephone number |
|
496 | - */ |
|
497 | - public function setTelephone($telephone) |
|
498 | - { |
|
499 | - $this->telephone = (string) $telephone; |
|
500 | - } |
|
501 | - |
|
502 | - |
|
503 | - /** |
|
504 | - * Returns the telefax number. |
|
505 | - * |
|
506 | - * @return string Telefax number |
|
507 | - */ |
|
508 | - public function getTelefax() |
|
509 | - { |
|
510 | - return $this->telefax; |
|
511 | - } |
|
512 | - |
|
513 | - |
|
514 | - /** |
|
515 | - * Sets a new telefax number. |
|
516 | - * |
|
517 | - * @param string $telefax New telefax number |
|
518 | - */ |
|
519 | - public function setTelefax($telefax) |
|
520 | - { |
|
521 | - $this->telefax = (string) $telefax; |
|
522 | - } |
|
523 | - |
|
524 | - |
|
525 | - /** |
|
526 | - * Returns the website URL. |
|
527 | - * |
|
528 | - * @return string Website URL |
|
529 | - */ |
|
530 | - public function getWebsite() |
|
531 | - { |
|
532 | - return $this->website; |
|
533 | - } |
|
534 | - |
|
535 | - |
|
536 | - /** |
|
537 | - * Sets a new website URL. |
|
538 | - * |
|
539 | - * @param string $website New website URL |
|
540 | - */ |
|
541 | - public function setWebsite($website) |
|
542 | - { |
|
543 | - $pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
|
544 | - |
|
545 | - if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
|
546 | - throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
|
547 | - } |
|
548 | - |
|
549 | - $this->website = (string) $website; |
|
550 | - } |
|
23 | + /** |
|
24 | + * @ORM\Id |
|
25 | + * @ORM\Column(type="integer") |
|
26 | + * @ORM\GeneratedValue(strategy="AUTO") |
|
27 | + */ |
|
28 | + protected $id; |
|
29 | + |
|
30 | + /** |
|
31 | + * @ORM\Column(name="salutation", type="string", length=8) |
|
32 | + */ |
|
33 | + protected $salutation = ''; |
|
34 | + |
|
35 | + /** |
|
36 | + * @ORM\Column(name="company", type="string", length=100) |
|
37 | + */ |
|
38 | + protected $company = ''; |
|
39 | + |
|
40 | + /** |
|
41 | + * @ORM\Column(name="vatid", type="string", length=32) |
|
42 | + */ |
|
43 | + protected $vatid = ''; |
|
44 | + |
|
45 | + /** |
|
46 | + * @ORM\Column(name="title", type="string", length=64) |
|
47 | + */ |
|
48 | + protected $title = ''; |
|
49 | + |
|
50 | + /** |
|
51 | + * @ORM\Column(name="firstname", type="string", length=64) |
|
52 | + */ |
|
53 | + protected $firstname = ''; |
|
54 | + |
|
55 | + /** |
|
56 | + * @ORM\Column(name="lastname", type="string", length=64) |
|
57 | + */ |
|
58 | + protected $lastname = ''; |
|
59 | + |
|
60 | + /** |
|
61 | + * @ORM\Column(name="address1", type="string", length=255) |
|
62 | + */ |
|
63 | + protected $address1 = ''; |
|
64 | + |
|
65 | + /** |
|
66 | + * @ORM\Column(name="address2", type="string", length=255) |
|
67 | + */ |
|
68 | + protected $address2 = ''; |
|
69 | + |
|
70 | + /** |
|
71 | + * @ORM\Column(name="address3", type="string", length=255) |
|
72 | + */ |
|
73 | + protected $address3 = ''; |
|
74 | + |
|
75 | + /** |
|
76 | + * @ORM\Column(name="postal", type="string", length=16) |
|
77 | + */ |
|
78 | + protected $postal = ''; |
|
79 | + |
|
80 | + /** |
|
81 | + * @ORM\Column(name="city", type="string", length=255) |
|
82 | + */ |
|
83 | + protected $city = ''; |
|
84 | + |
|
85 | + /** |
|
86 | + * @ORM\Column(name="state", type="string", length=255) |
|
87 | + */ |
|
88 | + protected $state = ''; |
|
89 | + |
|
90 | + /** |
|
91 | + * @ORM\Column(name="langid", type="string", length=5, nullable=true) |
|
92 | + */ |
|
93 | + protected $langid = ''; |
|
94 | + |
|
95 | + /** |
|
96 | + * @ORM\Column(name="countryid", type="string", length=2, nullable=true) |
|
97 | + */ |
|
98 | + protected $countryid = ''; |
|
99 | + |
|
100 | + /** |
|
101 | + * @ORM\Column(name="telephone", type="string", length=32) |
|
102 | + */ |
|
103 | + protected $telephone = ''; |
|
104 | + |
|
105 | + /** |
|
106 | + * @ORM\Column(name="telefax", type="string", length=255) |
|
107 | + */ |
|
108 | + protected $telefax = ''; |
|
109 | + |
|
110 | + /** |
|
111 | + * @ORM\Column(name="website", type="string", length=255) |
|
112 | + */ |
|
113 | + protected $website = ''; |
|
114 | + |
|
115 | + /** |
|
116 | + * @ORM\Column(name="birthday", type="date", nullable=true) |
|
117 | + */ |
|
118 | + protected $birthday; |
|
119 | + |
|
120 | + /** |
|
121 | + * @ORM\Column(name="vdate", type="date", nullable=true) |
|
122 | + */ |
|
123 | + protected $vdate; |
|
124 | + |
|
125 | + /** |
|
126 | + * @ORM\Column(name="ctime", type="datetime") |
|
127 | + */ |
|
128 | + protected $ctime; |
|
129 | + |
|
130 | + /** |
|
131 | + * @ORM\Column(name="mtime", type="datetime") |
|
132 | + */ |
|
133 | + protected $mtime; |
|
134 | + |
|
135 | + /** |
|
136 | + * @ORM\Column(name="editor", type="string", length=255) |
|
137 | + */ |
|
138 | + protected $editor = ''; |
|
139 | + |
|
140 | + |
|
141 | + public function __construct() |
|
142 | + { |
|
143 | + parent::__construct(); |
|
144 | + |
|
145 | + $this->ctime = new \DateTime(); |
|
146 | + $this->mtime = new \DateTime(); |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * Returns the user unique id. |
|
152 | + * |
|
153 | + * @return mixed |
|
154 | + */ |
|
155 | + public function getId() |
|
156 | + { |
|
157 | + return $this->id; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * Returns the company name. |
|
163 | + * |
|
164 | + * @return string Company name |
|
165 | + */ |
|
166 | + public function getCompany() |
|
167 | + { |
|
168 | + return $this->company; |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + /** |
|
173 | + * Sets a new company name. |
|
174 | + * |
|
175 | + * @param string $company New company name |
|
176 | + */ |
|
177 | + public function setCompany($company) |
|
178 | + { |
|
179 | + $this->company = (string) $company; |
|
180 | + } |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * Returns the vatid. |
|
185 | + * |
|
186 | + * @return string vatid |
|
187 | + */ |
|
188 | + public function getVatID() |
|
189 | + { |
|
190 | + return $this->vatid; |
|
191 | + } |
|
192 | + |
|
193 | + |
|
194 | + /** |
|
195 | + * Sets a new vatid. |
|
196 | + * |
|
197 | + * @param string $vatid New vatid |
|
198 | + */ |
|
199 | + public function setVatID($vatid) |
|
200 | + { |
|
201 | + $this->vatid = (string) $vatid; |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * Returns the salutation constant for the person described by the address. |
|
207 | + * |
|
208 | + * @return string Saluatation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
|
209 | + */ |
|
210 | + public function getSalutation() |
|
211 | + { |
|
212 | + return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * Sets the new salutation for the person described by the address. |
|
218 | + * |
|
219 | + * @param string $salutation Salutation constant defined in \Aimeos\MShop\Common\Item\Address\Base |
|
220 | + */ |
|
221 | + public function setSalutation($salutation) |
|
222 | + { |
|
223 | + switch( $salutation ) |
|
224 | + { |
|
225 | + case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
|
226 | + case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
|
227 | + case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS: |
|
228 | + case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS: |
|
229 | + case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
|
230 | + break; |
|
231 | + default: |
|
232 | + throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
|
233 | + } |
|
234 | + |
|
235 | + $this->salutation = (string) $salutation; |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * Returns the title of the person. |
|
241 | + * |
|
242 | + * @return string Title of the person |
|
243 | + */ |
|
244 | + public function getTitle() |
|
245 | + { |
|
246 | + return $this->title; |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + /** |
|
251 | + * Sets a new title of the person. |
|
252 | + * |
|
253 | + * @param string $title New title of the person |
|
254 | + */ |
|
255 | + public function setTitle($title) |
|
256 | + { |
|
257 | + $this->title = (string) $title; |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * Returns the first name of the person. |
|
263 | + * |
|
264 | + * @return string First name of the person |
|
265 | + */ |
|
266 | + public function getFirstname() |
|
267 | + { |
|
268 | + return $this->firstname; |
|
269 | + } |
|
270 | + |
|
271 | + |
|
272 | + /** |
|
273 | + * Sets a new first name of the person. |
|
274 | + * |
|
275 | + * @param string $firstname New first name of the person |
|
276 | + */ |
|
277 | + public function setFirstname($firstname) |
|
278 | + { |
|
279 | + $this->firstname = (string) $firstname; |
|
280 | + } |
|
281 | + |
|
282 | + |
|
283 | + /** |
|
284 | + * Returns the last name of the person. |
|
285 | + * |
|
286 | + * @return string Last name of the person |
|
287 | + */ |
|
288 | + public function getLastname() |
|
289 | + { |
|
290 | + return $this->lastname; |
|
291 | + } |
|
292 | + |
|
293 | + |
|
294 | + /** |
|
295 | + * Sets a new last name of the person. |
|
296 | + * |
|
297 | + * @param string $lastname New last name of the person |
|
298 | + */ |
|
299 | + public function setLastname($lastname) |
|
300 | + { |
|
301 | + $this->lastname = (string) $lastname; |
|
302 | + } |
|
303 | + |
|
304 | + |
|
305 | + /** |
|
306 | + * Returns the first address part, e.g. the street name. |
|
307 | + * |
|
308 | + * @return string First address part |
|
309 | + */ |
|
310 | + public function getAddress1() |
|
311 | + { |
|
312 | + return $this->address1; |
|
313 | + } |
|
314 | + |
|
315 | + |
|
316 | + /** |
|
317 | + * Sets a new first address part, e.g. the street name. |
|
318 | + * |
|
319 | + * @param string $address1 New first address part |
|
320 | + */ |
|
321 | + public function setAddress1($address1) |
|
322 | + { |
|
323 | + $this->address1 = (string) $address1; |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * Returns the second address part, e.g. the house number. |
|
329 | + * |
|
330 | + * @return string Second address part |
|
331 | + */ |
|
332 | + public function getAddress2() |
|
333 | + { |
|
334 | + return $this->address2; |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + /** |
|
339 | + * Sets a new second address part, e.g. the house number. |
|
340 | + * |
|
341 | + * @param string $address2 New second address part |
|
342 | + */ |
|
343 | + public function setAddress2($address2) |
|
344 | + { |
|
345 | + $this->address2 = (string) $address2; |
|
346 | + } |
|
347 | + |
|
348 | + |
|
349 | + /** |
|
350 | + * Returns the third address part, e.g. the house name or floor number. |
|
351 | + * |
|
352 | + * @return string third address part |
|
353 | + */ |
|
354 | + public function getAddress3() |
|
355 | + { |
|
356 | + return $this->address3; |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + /** |
|
361 | + * Sets a new third address part, e.g. the house name or floor number. |
|
362 | + * |
|
363 | + * @param string $address3 New third address part |
|
364 | + */ |
|
365 | + public function setAddress3($address3) |
|
366 | + { |
|
367 | + $this->address3 = (string) $address3; |
|
368 | + } |
|
369 | + |
|
370 | + |
|
371 | + /** |
|
372 | + * Returns the postal code. |
|
373 | + * |
|
374 | + * @return string Postal code |
|
375 | + */ |
|
376 | + public function getPostal() |
|
377 | + { |
|
378 | + return $this->postal; |
|
379 | + } |
|
380 | + |
|
381 | + |
|
382 | + /** |
|
383 | + * Sets a new postal code. |
|
384 | + * |
|
385 | + * @param string $postal New postal code |
|
386 | + */ |
|
387 | + public function setPostal($postal) |
|
388 | + { |
|
389 | + $this->postal = (string) $postal; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + /** |
|
394 | + * Returns the city name. |
|
395 | + * |
|
396 | + * @return string City name |
|
397 | + */ |
|
398 | + public function getCity() |
|
399 | + { |
|
400 | + return $this->city; |
|
401 | + } |
|
402 | + |
|
403 | + |
|
404 | + /** |
|
405 | + * Sets a new city name. |
|
406 | + * |
|
407 | + * @param string $city New city name |
|
408 | + */ |
|
409 | + public function setCity($city) |
|
410 | + { |
|
411 | + $this->city = (string) $city; |
|
412 | + } |
|
413 | + |
|
414 | + |
|
415 | + /** |
|
416 | + * Returns the state name. |
|
417 | + * |
|
418 | + * @return string State name |
|
419 | + */ |
|
420 | + public function getState() |
|
421 | + { |
|
422 | + return $this->state; |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * Sets a new state name. |
|
428 | + * |
|
429 | + * @param string $state New state name |
|
430 | + */ |
|
431 | + public function setState($state) |
|
432 | + { |
|
433 | + $this->state = (string) $state; |
|
434 | + } |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * Sets the ID of the country the address is in. |
|
439 | + * |
|
440 | + * @param string $countryid Unique ID of the country |
|
441 | + */ |
|
442 | + public function setCountryId($countryid) |
|
443 | + { |
|
444 | + $this->countryid = strtoupper( (string) $countryid ); |
|
445 | + } |
|
446 | + |
|
447 | + |
|
448 | + /** |
|
449 | + * Returns the unique ID of the country the address belongs to. |
|
450 | + * |
|
451 | + * @return string Unique ID of the country |
|
452 | + */ |
|
453 | + public function getCountryId() |
|
454 | + { |
|
455 | + return $this->countryid; |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + /** |
|
460 | + * Sets the ID of the language. |
|
461 | + * |
|
462 | + * @param string $langid Unique ID of the language |
|
463 | + */ |
|
464 | + public function setLanguageId($langid) |
|
465 | + { |
|
466 | + $this->langid = strtolower( (string) $langid ); |
|
467 | + } |
|
468 | + |
|
469 | + |
|
470 | + /** |
|
471 | + * Returns the unique ID of the language. |
|
472 | + * |
|
473 | + * @return string Unique ID of the language |
|
474 | + */ |
|
475 | + public function getLanguageId() |
|
476 | + { |
|
477 | + return $this->langid; |
|
478 | + } |
|
479 | + |
|
480 | + |
|
481 | + /** |
|
482 | + * Returns the telephone number. |
|
483 | + * |
|
484 | + * @return string Telephone number |
|
485 | + */ |
|
486 | + public function getTelephone() |
|
487 | + { |
|
488 | + return $this->telephone; |
|
489 | + } |
|
490 | + |
|
491 | + |
|
492 | + /** |
|
493 | + * Sets a new telephone number. |
|
494 | + * |
|
495 | + * @param string $telephone New telephone number |
|
496 | + */ |
|
497 | + public function setTelephone($telephone) |
|
498 | + { |
|
499 | + $this->telephone = (string) $telephone; |
|
500 | + } |
|
501 | + |
|
502 | + |
|
503 | + /** |
|
504 | + * Returns the telefax number. |
|
505 | + * |
|
506 | + * @return string Telefax number |
|
507 | + */ |
|
508 | + public function getTelefax() |
|
509 | + { |
|
510 | + return $this->telefax; |
|
511 | + } |
|
512 | + |
|
513 | + |
|
514 | + /** |
|
515 | + * Sets a new telefax number. |
|
516 | + * |
|
517 | + * @param string $telefax New telefax number |
|
518 | + */ |
|
519 | + public function setTelefax($telefax) |
|
520 | + { |
|
521 | + $this->telefax = (string) $telefax; |
|
522 | + } |
|
523 | + |
|
524 | + |
|
525 | + /** |
|
526 | + * Returns the website URL. |
|
527 | + * |
|
528 | + * @return string Website URL |
|
529 | + */ |
|
530 | + public function getWebsite() |
|
531 | + { |
|
532 | + return $this->website; |
|
533 | + } |
|
534 | + |
|
535 | + |
|
536 | + /** |
|
537 | + * Sets a new website URL. |
|
538 | + * |
|
539 | + * @param string $website New website URL |
|
540 | + */ |
|
541 | + public function setWebsite($website) |
|
542 | + { |
|
543 | + $pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
|
544 | + |
|
545 | + if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
|
546 | + throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
|
547 | + } |
|
548 | + |
|
549 | + $this->website = (string) $website; |
|
550 | + } |
|
551 | 551 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getSalutation() |
211 | 211 | { |
212 | - return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ); |
|
212 | + return (isset($this->salutation) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setSalutation($salutation) |
222 | 222 | { |
223 | - switch( $salutation ) |
|
223 | + switch ($salutation) |
|
224 | 224 | { |
225 | 225 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN: |
226 | 226 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY: |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR: |
230 | 230 | break; |
231 | 231 | default: |
232 | - throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) ); |
|
232 | + throw new \Exception(sprintf('Address salutation "%1$s" is unknown', $value)); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->salutation = (string) $salutation; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function setCountryId($countryid) |
443 | 443 | { |
444 | - $this->countryid = strtoupper( (string) $countryid ); |
|
444 | + $this->countryid = strtoupper((string) $countryid); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function setLanguageId($langid) |
465 | 465 | { |
466 | - $this->langid = strtolower( (string) $langid ); |
|
466 | + $this->langid = strtolower((string) $langid); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | { |
543 | 543 | $pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#'; |
544 | 544 | |
545 | - if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) { |
|
546 | - throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) ); |
|
545 | + if ($website !== '' && preg_match($pattern, $website) !== 1) { |
|
546 | + throw new \Exception(sprintf('Invalid web site URL "%1$s"', $website)); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | $this->website = (string) $website; |