Completed
Push — master ( b3ada7...c8cdf3 )
by Aimeos
02:30
created
lib/custom/tests/MShop/Customer/Manager/Address/LaravelTest.php 1 patch
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		$context = \TestHelper::getContext();
23 23
 		$this->editor = $context->getEditor();
24
-		$customer = new \Aimeos\MShop\Customer\Manager\Laravel( $context );
24
+		$customer = new \Aimeos\MShop\Customer\Manager\Laravel($context);
25 25
 
26 26
 		$search = $customer->createSearch();
27 27
 		$conditions = array(
28
-			$search->compare( '==', 'customer.code', 'unitCustomer1' ),
29
-			$search->compare( '==', 'customer.editor', $this->editor )
28
+			$search->compare('==', 'customer.code', 'unitCustomer1'),
29
+			$search->compare('==', 'customer.editor', $this->editor)
30 30
 		);
31
-		$search->setConditions( $search->combine( '&&', $conditions ) );
32
-		$result = $customer->searchItems( $search );
31
+		$search->setConditions($search->combine('&&', $conditions));
32
+		$result = $customer->searchItems($search);
33 33
 
34
-		if( ( $customerItem = reset( $result ) ) === false ) {
35
-			throw new \RuntimeException( sprintf( 'No customer item found for code "%1$s"', 'unitCustomer1' ) );
34
+		if (($customerItem = reset($result)) === false) {
35
+			throw new \RuntimeException(sprintf('No customer item found for code "%1$s"', 'unitCustomer1'));
36 36
 		}
37 37
 
38 38
 		$this->fixture = array(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'customer.address.siteid' => $context->getLocale()->getSiteId(),
62 62
 		);
63 63
 
64
-		$this->object = $customer->getSubManager( 'address', 'Laravel' );
64
+		$this->object = $customer->getSubManager('address', 'Laravel');
65 65
 	}
66 66
 
67 67
 
@@ -70,130 +70,130 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function tearDown()
72 72
 	{
73
-		unset( $this->object, $this->fixture );
73
+		unset($this->object, $this->fixture);
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testCleanup()
78 78
 	{
79
-		$this->object->cleanup( array( -1 ) );
79
+		$this->object->cleanup(array( -1 ));
80 80
 	}
81 81
 
82 82
 	public function testGetSearchAttributes()
83 83
 	{
84
-		foreach( $this->object->getSearchAttributes() as $attribute ) {
85
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
84
+		foreach ($this->object->getSearchAttributes() as $attribute) {
85
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
86 86
 		}
87 87
 	}
88 88
 
89 89
 	public function testCreateItem()
90 90
 	{
91
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Address\\Iface', $this->object->createItem() );
91
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Address\\Iface', $this->object->createItem());
92 92
 	}
93 93
 
94 94
 	public function testGetItem()
95 95
 	{
96 96
 		$search = $this->object->createSearch();
97
-		$search->setConditions( $search->compare( '~=', 'customer.address.company', 'ABC GmbH' ) );
97
+		$search->setConditions($search->compare('~=', 'customer.address.company', 'ABC GmbH'));
98 98
 
99
-		$items = $this->object->searchItems( $search );
99
+		$items = $this->object->searchItems($search);
100 100
 
101
-		if( ( $item = reset( $items ) ) === false ) {
102
-			throw new \RuntimeException( 'No address item with company "ABC" found' );
101
+		if (($item = reset($items)) === false) {
102
+			throw new \RuntimeException('No address item with company "ABC" found');
103 103
 		}
104 104
 
105
-		$this->assertEquals( $item, $this->object->getItem( $item->getId() ) );
105
+		$this->assertEquals($item, $this->object->getItem($item->getId()));
106 106
 	}
107 107
 
108 108
 	public function testGetSubManager()
109 109
 	{
110
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
111
-		$this->object->getSubManager( 'unknown' );
110
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
111
+		$this->object->getSubManager('unknown');
112 112
 	}
113 113
 
114 114
 	public function testSaveUpdateDeleteItem()
115 115
 	{
116
-		$item = new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.address.', $this->fixture );
117
-		$item->setId( null );
118
-		$this->object->saveItem( $item );
119
-		$itemSaved = $this->object->getItem( $item->getId() );
116
+		$item = new \Aimeos\MShop\Common\Item\Address\Standard('customer.address.', $this->fixture);
117
+		$item->setId(null);
118
+		$this->object->saveItem($item);
119
+		$itemSaved = $this->object->getItem($item->getId());
120 120
 
121 121
 		$itemExp = clone $itemSaved;
122
-		$itemExp->setPosition( 1 );
123
-		$itemExp->setCity( 'Berlin' );
124
-		$itemExp->setState( 'Berlin' );
125
-		$this->object->saveItem( $itemExp );
126
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
127
-
128
-		$this->object->deleteItem( $itemSaved->getId() );
129
-
130
-
131
-		$this->assertTrue( $item->getId() !== null );
132
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
133
-		$this->assertEquals( $item->getParentId(), $itemSaved->getParentId());
134
-		$this->assertEquals( $item->getPosition(), $itemSaved->getPosition());
135
-		$this->assertEquals( $item->getCompany(), $itemSaved->getCompany());
136
-		$this->assertEquals( $item->getVatID(), $itemSaved->getVatID());
137
-		$this->assertEquals( $item->getSalutation(), $itemSaved->getSalutation());
138
-		$this->assertEquals( $item->getTitle(), $itemSaved->getTitle());
139
-		$this->assertEquals( $item->getFirstname(), $itemSaved->getFirstname());
140
-		$this->assertEquals( $item->getLastname(), $itemSaved->getLastname());
141
-		$this->assertEquals( $item->getAddress1(), $itemSaved->getAddress1());
142
-		$this->assertEquals( $item->getAddress2(), $itemSaved->getAddress2());
143
-		$this->assertEquals( $item->getAddress3(), $itemSaved->getAddress3());
144
-		$this->assertEquals( $item->getPostal(), $itemSaved->getPostal());
145
-		$this->assertEquals( $item->getCity(), $itemSaved->getCity());
146
-		$this->assertEquals( $item->getState(), $itemSaved->getState());
147
-		$this->assertEquals( $item->getCountryId(), $itemSaved->getCountryId());
148
-		$this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId());
149
-		$this->assertEquals( $item->getTelephone(), $itemSaved->getTelephone());
150
-		$this->assertEquals( $item->getEmail(), $itemSaved->getEmail());
151
-		$this->assertEquals( $item->getTelefax(), $itemSaved->getTelefax());
152
-		$this->assertEquals( $item->getWebsite(), $itemSaved->getWebsite());
153
-		$this->assertEquals( $item->getLongitude(), $itemSaved->getLongitude());
154
-		$this->assertEquals( $item->getLatitude(), $itemSaved->getLatitude());
155
-		$this->assertEquals( $item->getFlag(), $itemSaved->getFlag());
156
-
157
-		$this->assertEquals( $this->editor, $itemSaved->getEditor() );
158
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
122
+		$itemExp->setPosition(1);
123
+		$itemExp->setCity('Berlin');
124
+		$itemExp->setState('Berlin');
125
+		$this->object->saveItem($itemExp);
126
+		$itemUpd = $this->object->getItem($itemExp->getId());
127
+
128
+		$this->object->deleteItem($itemSaved->getId());
129
+
130
+
131
+		$this->assertTrue($item->getId() !== null);
132
+		$this->assertEquals($item->getId(), $itemSaved->getId());
133
+		$this->assertEquals($item->getParentId(), $itemSaved->getParentId());
134
+		$this->assertEquals($item->getPosition(), $itemSaved->getPosition());
135
+		$this->assertEquals($item->getCompany(), $itemSaved->getCompany());
136
+		$this->assertEquals($item->getVatID(), $itemSaved->getVatID());
137
+		$this->assertEquals($item->getSalutation(), $itemSaved->getSalutation());
138
+		$this->assertEquals($item->getTitle(), $itemSaved->getTitle());
139
+		$this->assertEquals($item->getFirstname(), $itemSaved->getFirstname());
140
+		$this->assertEquals($item->getLastname(), $itemSaved->getLastname());
141
+		$this->assertEquals($item->getAddress1(), $itemSaved->getAddress1());
142
+		$this->assertEquals($item->getAddress2(), $itemSaved->getAddress2());
143
+		$this->assertEquals($item->getAddress3(), $itemSaved->getAddress3());
144
+		$this->assertEquals($item->getPostal(), $itemSaved->getPostal());
145
+		$this->assertEquals($item->getCity(), $itemSaved->getCity());
146
+		$this->assertEquals($item->getState(), $itemSaved->getState());
147
+		$this->assertEquals($item->getCountryId(), $itemSaved->getCountryId());
148
+		$this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId());
149
+		$this->assertEquals($item->getTelephone(), $itemSaved->getTelephone());
150
+		$this->assertEquals($item->getEmail(), $itemSaved->getEmail());
151
+		$this->assertEquals($item->getTelefax(), $itemSaved->getTelefax());
152
+		$this->assertEquals($item->getWebsite(), $itemSaved->getWebsite());
153
+		$this->assertEquals($item->getLongitude(), $itemSaved->getLongitude());
154
+		$this->assertEquals($item->getLatitude(), $itemSaved->getLatitude());
155
+		$this->assertEquals($item->getFlag(), $itemSaved->getFlag());
156
+
157
+		$this->assertEquals($this->editor, $itemSaved->getEditor());
158
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
159 159
 		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
160 160
 
161
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
162
-		$this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId());
163
-		$this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition());
164
-		$this->assertEquals( $itemExp->getCompany(), $itemUpd->getCompany());
165
-		$this->assertEquals( $itemExp->getVatID(), $itemUpd->getVatID());
166
-		$this->assertEquals( $itemExp->getSalutation(), $itemUpd->getSalutation());
167
-		$this->assertEquals( $itemExp->getTitle(), $itemUpd->getTitle());
168
-		$this->assertEquals( $itemExp->getFirstname(), $itemUpd->getFirstname());
169
-		$this->assertEquals( $itemExp->getLastname(), $itemUpd->getLastname());
170
-		$this->assertEquals( $itemExp->getAddress1(), $itemUpd->getAddress1());
171
-		$this->assertEquals( $itemExp->getAddress2(), $itemUpd->getAddress2());
172
-		$this->assertEquals( $itemExp->getAddress3(), $itemUpd->getAddress3());
173
-		$this->assertEquals( $itemExp->getPostal(), $itemUpd->getPostal());
174
-		$this->assertEquals( $itemExp->getCity(), $itemUpd->getCity());
175
-		$this->assertEquals( $itemExp->getState(), $itemUpd->getState());
176
-		$this->assertEquals( $itemExp->getCountryId(), $itemUpd->getCountryId());
177
-		$this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId());
178
-		$this->assertEquals( $itemExp->getTelephone(), $itemUpd->getTelephone());
179
-		$this->assertEquals( $itemExp->getEmail(), $itemUpd->getEmail());
180
-		$this->assertEquals( $itemExp->getTelefax(), $itemUpd->getTelefax());
181
-		$this->assertEquals( $itemExp->getWebsite(), $itemUpd->getWebsite());
182
-		$this->assertEquals( $itemExp->getLongitude(), $itemUpd->getLongitude());
183
-		$this->assertEquals( $itemExp->getLatitude(), $itemUpd->getLatitude());
184
-		$this->assertEquals( $itemExp->getFlag(), $itemUpd->getFlag());
185
-
186
-		$this->assertEquals( $this->editor, $itemUpd->getEditor() );
187
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
188
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
161
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
162
+		$this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId());
163
+		$this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition());
164
+		$this->assertEquals($itemExp->getCompany(), $itemUpd->getCompany());
165
+		$this->assertEquals($itemExp->getVatID(), $itemUpd->getVatID());
166
+		$this->assertEquals($itemExp->getSalutation(), $itemUpd->getSalutation());
167
+		$this->assertEquals($itemExp->getTitle(), $itemUpd->getTitle());
168
+		$this->assertEquals($itemExp->getFirstname(), $itemUpd->getFirstname());
169
+		$this->assertEquals($itemExp->getLastname(), $itemUpd->getLastname());
170
+		$this->assertEquals($itemExp->getAddress1(), $itemUpd->getAddress1());
171
+		$this->assertEquals($itemExp->getAddress2(), $itemUpd->getAddress2());
172
+		$this->assertEquals($itemExp->getAddress3(), $itemUpd->getAddress3());
173
+		$this->assertEquals($itemExp->getPostal(), $itemUpd->getPostal());
174
+		$this->assertEquals($itemExp->getCity(), $itemUpd->getCity());
175
+		$this->assertEquals($itemExp->getState(), $itemUpd->getState());
176
+		$this->assertEquals($itemExp->getCountryId(), $itemUpd->getCountryId());
177
+		$this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId());
178
+		$this->assertEquals($itemExp->getTelephone(), $itemUpd->getTelephone());
179
+		$this->assertEquals($itemExp->getEmail(), $itemUpd->getEmail());
180
+		$this->assertEquals($itemExp->getTelefax(), $itemUpd->getTelefax());
181
+		$this->assertEquals($itemExp->getWebsite(), $itemUpd->getWebsite());
182
+		$this->assertEquals($itemExp->getLongitude(), $itemUpd->getLongitude());
183
+		$this->assertEquals($itemExp->getLatitude(), $itemUpd->getLatitude());
184
+		$this->assertEquals($itemExp->getFlag(), $itemUpd->getFlag());
185
+
186
+		$this->assertEquals($this->editor, $itemUpd->getEditor());
187
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
188
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
189 189
 
190 190
 		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
191
-		$this->object->getItem( $itemSaved->getId() );
191
+		$this->object->getItem($itemSaved->getId());
192 192
 	}
193 193
 
194 194
 	public function testCreateSearch()
195 195
 	{
196
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() );
196
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch());
197 197
 	}
198 198
 
199 199
 
@@ -202,36 +202,36 @@  discard block
 block discarded – undo
202 202
 		$search = $this->object->createSearch();
203 203
 
204 204
 		$expr = array();
205
-		$expr[] = $search->compare( '!=', 'customer.address.id', null );
206
-		$expr[] = $search->compare( '!=', 'customer.address.parentid', null );
207
-		$expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' );
208
-		$expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' );
209
-		$expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' );
210
-		$expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' );
211
-		$expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' );
212
-		$expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' );
213
-		$expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' );
214
-		$expr[] = $search->compare( '==', 'customer.address.address2', '2-4' );
215
-		$expr[] = $search->compare( '==', 'customer.address.address3', '' );
216
-		$expr[] = $search->compare( '==', 'customer.address.postal', '11099' );
217
-		$expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' );
218
-		$expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' );
219
-		$expr[] = $search->compare( '==', 'customer.address.languageid', 'de' );
220
-		$expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' );
221
-		$expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' );
222
-		$expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' );
223
-		$expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' );
224
-		$expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' );
225
-		$expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' );
226
-		$expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' );
227
-		$expr[] = $search->compare( '==', 'customer.address.flag', 0 );
228
-		$expr[] = $search->compare( '==', 'customer.address.position', 1 );
229
-		$expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' );
230
-		$expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' );
231
-		$expr[] = $search->compare( '==', 'customer.address.editor', $this->editor );
232
-
233
-		$search->setConditions( $search->combine( '&&', $expr ) );
234
-		$this->assertEquals( 1, count( $this->object->searchItems( $search ) ) );
205
+		$expr[] = $search->compare('!=', 'customer.address.id', null);
206
+		$expr[] = $search->compare('!=', 'customer.address.parentid', null);
207
+		$expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH');
208
+		$expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999');
209
+		$expr[] = $search->compare('==', 'customer.address.salutation', 'mr');
210
+		$expr[] = $search->compare('==', 'customer.address.title', 'Dr.');
211
+		$expr[] = $search->compare('==', 'customer.address.firstname', 'Good');
212
+		$expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest');
213
+		$expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben');
214
+		$expr[] = $search->compare('==', 'customer.address.address2', '2-4');
215
+		$expr[] = $search->compare('==', 'customer.address.address3', '');
216
+		$expr[] = $search->compare('==', 'customer.address.postal', '11099');
217
+		$expr[] = $search->compare('==', 'customer.address.city', 'Berlin');
218
+		$expr[] = $search->compare('==', 'customer.address.state', 'Berlin');
219
+		$expr[] = $search->compare('==', 'customer.address.languageid', 'de');
220
+		$expr[] = $search->compare('==', 'customer.address.countryid', 'DE');
221
+		$expr[] = $search->compare('==', 'customer.address.telephone', '055544332221');
222
+		$expr[] = $search->compare('==', 'customer.address.email', '[email protected]');
223
+		$expr[] = $search->compare('==', 'customer.address.telefax', '055544333212');
224
+		$expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org');
225
+		$expr[] = $search->compare('>=', 'customer.address.longitude', '10.0');
226
+		$expr[] = $search->compare('>=', 'customer.address.latitude', '50.0');
227
+		$expr[] = $search->compare('==', 'customer.address.flag', 0);
228
+		$expr[] = $search->compare('==', 'customer.address.position', 1);
229
+		$expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00');
230
+		$expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00');
231
+		$expr[] = $search->compare('==', 'customer.address.editor', $this->editor);
232
+
233
+		$search->setConditions($search->combine('&&', $expr));
234
+		$this->assertEquals(1, count($this->object->searchItems($search)));
235 235
 	}
236 236
 
237 237
 
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 		$search = $this->object->createSearch();
242 242
 
243 243
 		$conditions = array(
244
-			$search->compare( '~=', 'customer.address.company', 'ABC GmbH' ),
245
-			$search->compare( '==', 'customer.address.editor', $this->editor )
244
+			$search->compare('~=', 'customer.address.company', 'ABC GmbH'),
245
+			$search->compare('==', 'customer.address.editor', $this->editor)
246 246
 		);
247 247
 
248
-		$search->setConditions( $search->combine( '&&', $conditions ) );
249
-		$search->setSlice( 0, 1 );
248
+		$search->setConditions($search->combine('&&', $conditions));
249
+		$search->setSlice(0, 1);
250 250
 
251
-		$results = $this->object->searchItems( $search, array(), $total );
251
+		$results = $this->object->searchItems($search, array(), $total);
252 252
 
253
-		$this->assertEquals( 1, count( $results ) );
254
-		$this->assertEquals( 2, $total );
253
+		$this->assertEquals(1, count($results));
254
+		$this->assertEquals(2, $total);
255 255
 
256
-		foreach( $results as $id => $item ) {
257
-			$this->assertEquals( $id, $item->getId() );
256
+		foreach ($results as $id => $item) {
257
+			$this->assertEquals($id, $item->getId());
258 258
 		}
259 259
 	}
260 260
 }
Please login to merge, or discard this patch.