Completed
Push — master ( aabfab...16fce1 )
by Aimeos
24:03
created
lib/mshoplib/setup/unittest/SupplierListAddTestData.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 		$this->additional->setEditor( 'core:unittest' );
51 51
 
52 52
 		$ds = DIRECTORY_SEPARATOR;
53
-		$path = __DIR__ . $ds . 'data' . $ds . 'supplier-list.php';
53
+		$path = __DIR__.$ds.'data'.$ds.'supplier-list.php';
54 54
 
55
-		if( ( $testdata = include( $path ) ) == false ){
55
+		if( ( $testdata = include( $path ) ) == false ) {
56 56
 			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for supplier list domain', $path ) );
57 57
 		}
58 58
 
59 59
 		$refKeys = [];
60 60
 		foreach( $testdata['supplier/lists'] as $dataset ) {
61
-			$refKeys[ $dataset['domain'] ][] = $dataset['refid'];
61
+			$refKeys[$dataset['domain']][] = $dataset['refid'];
62 62
 		}
63 63
 
64 64
 		$refIds = [];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		$refIds = [];
103 103
 		foreach( $mediaManager->searchItems( $search ) as $item ) {
104
-			$refIds['media/' . $item->getUrl()] = $item->getId();
104
+			$refIds['media/'.$item->getUrl()] = $item->getId();
105 105
 		}
106 106
 
107 107
 		return $refIds;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$codes = [];
122 122
 		foreach( $keys as $dataset )
123 123
 		{
124
-			if( ( $pos = strpos( $dataset, '/' ) ) === false || ( $str = substr( $dataset, $pos+1 ) ) === false ) {
124
+			if( ( $pos = strpos( $dataset, '/' ) ) === false || ( $str = substr( $dataset, $pos + 1 ) ) === false ) {
125 125
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'Some keys for ref products are set wrong "%1$s"', $dataset ) );
126 126
 			}
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$refIds = [];
135 135
 		foreach( $manager->searchItems( $search ) as $item ) {
136
-			$refIds[ 'product/' . $item->getCode() ] = $item->getId();
136
+			$refIds['product/'.$item->getCode()] = $item->getId();
137 137
 		}
138 138
 
139 139
 		return $refIds;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		$labels = [];
154 154
 		foreach( $keys as $dataset )
155 155
 		{
156
-			if( ( $pos = strpos( $dataset, '/' ) ) === false || ( $str = substr( $dataset, $pos+1 ) ) === false ) {
156
+			if( ( $pos = strpos( $dataset, '/' ) ) === false || ( $str = substr( $dataset, $pos + 1 ) ) === false ) {
157 157
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'Some keys for ref text are set wrong "%1$s"', $dataset ) );
158 158
 			}
159 159
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 		$search->setConditions( $search->compare( '==', 'text.label', $labels ) );
165 165
 
166 166
 		$refIds = [];
167
-		foreach( $textManager->searchItems( $search ) as $item )	{
168
-			$refIds[ 'text/'.$item->getLabel() ] = $item->getId();
167
+		foreach( $textManager->searchItems( $search ) as $item ) {
168
+			$refIds['text/'.$item->getLabel()] = $item->getId();
169 169
 		}
170 170
 
171 171
 		return $refIds;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$itemCode = [];
190 190
 		foreach( $testdata['supplier/lists'] as $dataset )
191 191
 		{
192
-			if( ( $pos = strpos( $dataset['parentid'], '/' ) ) === false || ( $str = substr( $dataset['parentid'], $pos+1 ) ) === false ) {
192
+			if( ( $pos = strpos( $dataset['parentid'], '/' ) ) === false || ( $str = substr( $dataset['parentid'], $pos + 1 ) ) === false ) {
193 193
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'Some keys for parentid are set wrong "%1$s"', $dataset['parentid'] ) );
194 194
 			}
195 195
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 		}
198 198
 
199 199
 		$search = $supplierManager->createSearch();
200
-		$search->setConditions( $search->compare( '==', 'supplier.code', $itemCode) );
200
+		$search->setConditions( $search->compare( '==', 'supplier.code', $itemCode ) );
201 201
 
202 202
 		$parentIds = [];
203
-		foreach( $supplierManager->searchItems( $search ) as $item )	{
204
-			$parentIds[ 'supplier/'.$item->getCode() ] = $item->getId();
203
+		foreach( $supplierManager->searchItems( $search ) as $item ) {
204
+			$parentIds['supplier/'.$item->getCode()] = $item->getId();
205 205
 		}
206 206
 
207 207
 		$listItemTypeIds = [];
@@ -218,28 +218,28 @@  discard block
 block discarded – undo
218 218
 			$listItemType->setStatus( $dataset['status'] );
219 219
 
220 220
 			$supplierListTypeManager->saveItem( $listItemType );
221
-			$listItemTypeIds[ $key ] = $listItemType->getId();
221
+			$listItemTypeIds[$key] = $listItemType->getId();
222 222
 		}
223 223
 
224 224
 		$listItem = $supplierListManager->createItem();
225 225
 		foreach( $testdata['supplier/lists'] as $dataset )
226 226
 		{
227
-			if( !isset( $parentIds[ $dataset['parentid'] ] ) ) {
227
+			if( !isset( $parentIds[$dataset['parentid']] ) ) {
228 228
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'No supplier ID found for "%1$s"', $dataset['parentid'] ) );
229 229
 			}
230 230
 
231
-			if( !isset( $refIds[ $dataset['domain'] ][ $dataset['refid'] ] ) ) {
231
+			if( !isset( $refIds[$dataset['domain']][$dataset['refid']] ) ) {
232 232
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'No "%2$s" ref ID found for "%1$s"', $dataset['refid'], $dataset['domain'] ) );
233 233
 			}
234 234
 
235
-			if( !isset( $listItemTypeIds[ $dataset['typeid'] ] ) ) {
235
+			if( !isset( $listItemTypeIds[$dataset['typeid']] ) ) {
236 236
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'No supplier list type ID found for "%1$s"', $dataset['typeid'] ) );
237 237
 			}
238 238
 
239 239
 			$listItem->setId( null );
240
-			$listItem->setParentId( $parentIds[ $dataset['parentid'] ] );
241
-			$listItem->setTypeId( $listItemTypeIds[ $dataset['typeid'] ] );
242
-			$listItem->setRefId( $refIds[ $dataset['domain'] ] [ $dataset['refid'] ] );
240
+			$listItem->setParentId( $parentIds[$dataset['parentid']] );
241
+			$listItem->setTypeId( $listItemTypeIds[$dataset['typeid']] );
242
+			$listItem->setRefId( $refIds[$dataset['domain']] [$dataset['refid']] );
243 243
 			$listItem->setDomain( $dataset['domain'] );
244 244
 			$listItem->setDateStart( $dataset['start'] );
245 245
 			$listItem->setDateEnd( $dataset['end'] );
Please login to merge, or discard this patch.
lib/mshoplib/setup/unittest/data/supplier-list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
  * @copyright Aimeos (aimeos.org), 2015-2017
6 6
  */
7 7
 
8
-return array (
9
-	'supplier/lists/type' => array (
8
+return array(
9
+	'supplier/lists/type' => array(
10 10
 		'product/default' => array( 'domain' => 'product', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ),
11 11
 		'text/default' => array( 'domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ),
12 12
 		'media/default' => array( 'domain' => 'media', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ),
13 13
 	),
14 14
 
15
-	'supplier/lists' => array (
15
+	'supplier/lists' => array(
16 16
 		array( 'parentid' => 'supplier/unitCode001', 'typeid' => 'product/default', 'domain' => 'product', 'refid' => 'product/CNC', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1 ),
17 17
 		array( 'parentid' => 'supplier/unitCode001', 'typeid' => 'product/default', 'domain' => 'product', 'refid' => 'product/CNE', 'start' => '2010-01-01 00:00:00', 'end' => null, 'config' => [], 'pos' => 2, 'status' => 1 ),
18 18
 
Please login to merge, or discard this patch.