Completed
Push — master ( e4ad0a...d808c7 )
by Aimeos
10:17
created
lib/mshoplib/src/MShop/Customer/Manager/Property/Type/Standard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@
 block discarded – undo
285 285
 		 * @see mshop/customer/manager/property/type/decorators/global
286 286
 		 */
287 287
 
288
-		return $this->getSubManagerBase( 'customer', 'property/type/' . $manager, $name );
288
+		return $this->getSubManagerBase( 'customer', 'property/type/'.$manager, $name );
289 289
 	}
290 290
 
291 291
 
Please login to merge, or discard this patch.
lib/mshoplib/src/MShop/Customer/Manager/Property/Standard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@
 block discarded – undo
288 288
 		 * @see mshop/customer/manager/property/decorators/global
289 289
 		 */
290 290
 
291
-		return $this->getSubManagerBase( 'customer', 'property/' . $manager, $name );
291
+		return $this->getSubManagerBase( 'customer', 'property/'.$manager, $name );
292 292
 	}
293 293
 
294 294
 
Please login to merge, or discard this patch.
lib/mshoplib/tests/MShop/Customer/Manager/Property/StandardTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 		$search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) );
55 55
 		$results = $this->object->searchItems( $search );
56 56
 
57
-		if( ( $item = reset($results) ) === false ) {
57
+		if( ( $item = reset( $results ) ) === false ) {
58 58
 			throw new \RuntimeException( 'No property item found' );
59 59
 		}
60 60
 
61
-		$item->setId(null);
61
+		$item->setId( null );
62 62
 		$item->setLanguageId( 'en' );
63 63
 		$resultSaved = $this->object->saveItem( $item );
64 64
 		$itemSaved = $this->object->getItem( $item->getId() );
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	{
110 110
 		$search = $this->object->createSearch();
111 111
 		$conditions = array(
112
-			$search->compare( '~=', 'customer.property.value', '1'),
112
+			$search->compare( '~=', 'customer.property.value', '1' ),
113 113
 			$search->compare( '==', 'customer.property.editor', $this->editor )
114 114
 		);
115 115
 		$search->setConditions( $search->combine( '&&', $conditions ) );
116 116
 		$results = $this->object->searchItems( $search );
117 117
 
118
-		if( ($expected = reset($results)) === false ) {
118
+		if( ( $expected = reset( $results ) ) === false ) {
119 119
 			throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) );
120 120
 		}
121 121
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' );
167 167
 		$expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor );
168 168
 
169
-		$search->setConditions( $search->combine('&&', $expr) );
169
+		$search->setConditions( $search->combine( '&&', $expr ) );
170 170
 		$results = $this->object->searchItems( $search, [], $total );
171 171
 		$this->assertEquals( 1, count( $results ) );
172 172
 
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 			$search->compare( '==', 'customer.property.editor', $this->editor )
178 178
 		);
179 179
 		$search->setConditions( $search->combine( '&&', $conditions ) );
180
-		$search->setSlice(0, 1);
180
+		$search->setSlice( 0, 1 );
181 181
 		$items = $this->object->searchItems( $search, [], $total );
182 182
 
183 183
 		$this->assertEquals( 1, count( $items ) );
184 184
 		$this->assertEquals( 1, $total );
185 185
 
186
-		foreach($items as $itemId => $item) {
186
+		foreach( $items as $itemId => $item ) {
187 187
 			$this->assertEquals( $itemId, $item->getId() );
188 188
 		}
189 189
 	}
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 
192 192
 	public function testGetSubManager()
193 193
 	{
194
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') );
195
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') );
194
+		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) );
195
+		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Standard' ) );
196 196
 
197
-		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
198
-		$this->object->getSubManager('unknown');
197
+		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
198
+		$this->object->getSubManager( 'unknown' );
199 199
 	}
200 200
 
201 201
 
202 202
 	public function testGetSubManagerInvalidName()
203 203
 	{
204
-		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
205
-		$this->object->getSubManager('type', 'unknown');
204
+		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
205
+		$this->object->getSubManager( 'type', 'unknown' );
206 206
 	}
207 207
 }
Please login to merge, or discard this patch.
lib/mshoplib/tests/MShop/Customer/Manager/Property/Type/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	{
20 20
 		$this->editor = \TestHelperMShop::getContext()->getEditor();
21 21
 		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperMShop::getContext() );
22
-		$this->object = $manager->getSubManager( 'property' )->getSubManager('type');
22
+		$this->object = $manager->getSubManager( 'property' )->getSubManager( 'type' );
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28
-		unset($this->object);
28
+		unset( $this->object );
29 29
 	}
30 30
 
31 31
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$results = $this->object->searchItems( $search );
70 70
 
71
-		if( ($expected = reset($results) ) === false )
71
+		if( ( $expected = reset( $results ) ) === false )
72 72
 		{
73 73
 			throw new \RuntimeException( 'No property type item found.' );
74 74
 		}
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		$search = $this->object->createSearch();
92 92
 		$search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) );
93
-		$results = $this->object->searchItems($search);
93
+		$results = $this->object->searchItems( $search );
94 94
 
95
-		if( ( $item = reset($results) ) === false ) {
95
+		if( ( $item = reset( $results ) ) === false ) {
96 96
 			throw new \RuntimeException( 'No type item found' );
97 97
 		}
98 98
 
99
-		$item->setId(null);
99
+		$item->setId( null );
100 100
 		$item->setCode( 'unitTestSave' );
101 101
 		$resultSaved = $this->object->saveItem( $item );
102 102
 		$itemSaved = $this->object->getItem( $item->getId() );
@@ -156,24 +156,24 @@  discard block
 block discarded – undo
156 156
 		$expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' );
157 157
 		$expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor );
158 158
 
159
-		$search->setConditions( $search->combine('&&', $expr) );
159
+		$search->setConditions( $search->combine( '&&', $expr ) );
160 160
 		$results = $this->object->searchItems( $search, [], $total );
161 161
 		$this->assertEquals( 1, count( $results ) );
162 162
 
163 163
 
164 164
 		$search = $this->object->createSearch();
165 165
 		$conditions = array(
166
-			$search->compare( '=~', 'customer.property.type.code', 'newsletter'),
166
+			$search->compare( '=~', 'customer.property.type.code', 'newsletter' ),
167 167
 			$search->compare( '==', 'customer.property.type.editor', $this->editor )
168 168
 		);
169
-		$search->setConditions( $search->combine('&&', $conditions ) );
170
-		$search->setSlice(0, 1);
171
-		$items = $this->object->searchItems( $search, [], $total);
169
+		$search->setConditions( $search->combine( '&&', $conditions ) );
170
+		$search->setSlice( 0, 1 );
171
+		$items = $this->object->searchItems( $search, [], $total );
172 172
 
173 173
 		$this->assertEquals( 1, count( $items ) );
174 174
 		$this->assertEquals( 1, $total );
175 175
 
176
-		foreach($items as $itemId => $item) {
176
+		foreach( $items as $itemId => $item ) {
177 177
 			$this->assertEquals( $itemId, $item->getId() );
178 178
 		}
179 179
 	}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 	public function testGetSubManager()
183 183
 	{
184
-		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
185
-		$this->object->getSubManager('unknown');
184
+		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
185
+		$this->object->getSubManager( 'unknown' );
186 186
 	}
187 187
 }
Please login to merge, or discard this patch.
lib/mshoplib/setup/unittest/data/customer-property.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * @copyright Aimeos (aimeos.org), 2018
6 6
  */
7 7
 
8
-return array (
8
+return array(
9 9
 	'customer/property/type' => array(
10 10
 		'customer/property/type/newsletter' => array( 'domain' => 'customer', 'code' => 'newsletter', 'label' => 'Newsletter', 'status' => 1 ),
11 11
 	),
Please login to merge, or discard this patch.
lib/mshoplib/setup/unittest/CustomerAddPropertyTestData.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$this->additional->setEditor( 'core:unittest' );
52 52
 
53 53
 		$ds = DIRECTORY_SEPARATOR;
54
-		$path = __DIR__ . $ds . 'data' . $ds . 'customer-property.php';
54
+		$path = __DIR__.$ds.'data'.$ds.'customer-property.php';
55 55
 
56 56
 		if( ( $testdata = include( $path ) ) == false ) {
57 57
 			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) );
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 			$type->setStatus( $dataset['status'] );
90 90
 
91 91
 			$customerPropertyTypeManager->saveItem( $type );
92
-			$typeIds[ $key ] = $type->getId();
92
+			$typeIds[$key] = $type->getId();
93 93
 		}
94 94
 
95 95
 		$custProperty = $customerPropertyManager->createItem();
96 96
 		foreach( $testdata['customer/property'] as $key => $dataset )
97 97
 		{
98
-			if( !isset( $typeIds[ $dataset['typeid'] ] ) ) {
98
+			if( !isset( $typeIds[$dataset['typeid']] ) ) {
99 99
 				throw new \Aimeos\MW\Setup\Exception( sprintf( 'No customer property type ID found for "%1$s"', $dataset['typeid'] ) );
100 100
 			}
101 101
 
102 102
 			$custProperty->setId( null );
103
-			$custProperty->setParentId( $custIds[ $dataset['parentid'] ] );
104
-			$custProperty->setTypeId( $typeIds[ $dataset['typeid'] ] );
103
+			$custProperty->setParentId( $custIds[$dataset['parentid']] );
104
+			$custProperty->setTypeId( $typeIds[$dataset['typeid']] );
105 105
 			$custProperty->setLanguageId( $dataset['langid'] );
106 106
 			$custProperty->setValue( $dataset['value'] );
107 107
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		$search = $customerManager->createSearch();
125 125
 
126 126
 		foreach( $customerManager->searchItems( $search ) as $id => $item ) {
127
-			$entry[ 'customer/' . $item->getCode() ] = $id;
127
+			$entry['customer/'.$item->getCode()] = $id;
128 128
 		}
129 129
 
130 130
 		return $entry;
Please login to merge, or discard this patch.
lib/mshoplib/setup/default/schema/customer.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 return array(
10 10
 	'table' => array(
11
-		'mshop_customer' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
11
+		'mshop_customer' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
12 12
 
13 13
 			$table = $schema->createTable( 'mshop_customer' );
14 14
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			$table->addColumn( 'status', 'smallint', [] );
43 43
 			$table->addColumn( 'mtime', 'datetime', [] );
44 44
 			$table->addColumn( 'ctime', 'datetime', [] );
45
-			$table->addColumn( 'editor', 'string', array('length' => 255 ) );
45
+			$table->addColumn( 'editor', 'string', array( 'length' => 255 ) );
46 46
 
47 47
 			$table->setPrimaryKey( array( 'id' ), 'pk_mscus_id' );
48 48
 			$table->addUniqueIndex( array( 'siteid', 'code' ), 'unq_mscus_sid_code' );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			return $schema;
57 57
 		},
58 58
 
59
-		'mshop_customer_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
59
+		'mshop_customer_address' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
60 60
 
61 61
 			$table = $schema->createTable( 'mshop_customer_address' );
62 62
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			$table->addColumn( 'pos', 'smallint', [] );
88 88
 			$table->addColumn( 'mtime', 'datetime', [] );
89 89
 			$table->addColumn( 'ctime', 'datetime', [] );
90
-			$table->addColumn( 'editor', 'string', array('length' => 255 ) );
90
+			$table->addColumn( 'editor', 'string', array( 'length' => 255 ) );
91 91
 
92 92
 			$table->setPrimaryKey( array( 'id' ), 'pk_mscusad_id' );
93 93
 			$table->addIndex( array( 'parentid' ), 'fk_mscusad_pid' );
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			return $schema;
105 105
 		},
106 106
 
107
-		'mshop_customer_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
107
+		'mshop_customer_list_type' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
108 108
 
109 109
 			$table = $schema->createTable( 'mshop_customer_list_type' );
110 110
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			return $schema;
128 128
 		},
129 129
 
130
-		'mshop_customer_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
130
+		'mshop_customer_list' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
131 131
 
132 132
 			$table = $schema->createTable( 'mshop_customer_list' );
133 133
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			return $schema;
166 166
 		},
167 167
 
168
-		'mshop_customer_group' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
168
+		'mshop_customer_group' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
169 169
 
170 170
 			$table = $schema->createTable( 'mshop_customer_group' );
171 171
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			return $schema;
185 185
 		},
186 186
 
187
-		'mshop_customer_property_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
187
+		'mshop_customer_property_type' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
188 188
 
189 189
 			$table = $schema->createTable( 'mshop_customer_property_type' );
190 190
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			return $schema;
208 208
 		},
209 209
 
210
-		'mshop_customer_property' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
210
+		'mshop_customer_property' => function( \Doctrine\DBAL\Schema\Schema $schema ) {
211 211
 
212 212
 			$table = $schema->createTable( 'mshop_customer_property' );
213 213
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 return array(
10 10
 	'table' => array(
11
-		'mshop_customer' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
11
+		'mshop_customer' => function ( \Doctrine\DBAL\Schema\Schema $schema )
12
+		{
12 13
 
13 14
 			$table = $schema->createTable( 'mshop_customer' );
14 15
 
@@ -56,7 +57,8 @@  discard block
 block discarded – undo
56 57
 			return $schema;
57 58
 		},
58 59
 
59
-		'mshop_customer_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
60
+		'mshop_customer_address' => function ( \Doctrine\DBAL\Schema\Schema $schema )
61
+		{
60 62
 
61 63
 			$table = $schema->createTable( 'mshop_customer_address' );
62 64
 
@@ -104,7 +106,8 @@  discard block
 block discarded – undo
104 106
 			return $schema;
105 107
 		},
106 108
 
107
-		'mshop_customer_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
109
+		'mshop_customer_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema )
110
+		{
108 111
 
109 112
 			$table = $schema->createTable( 'mshop_customer_list_type' );
110 113
 
@@ -127,7 +130,8 @@  discard block
 block discarded – undo
127 130
 			return $schema;
128 131
 		},
129 132
 
130
-		'mshop_customer_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
133
+		'mshop_customer_list' => function ( \Doctrine\DBAL\Schema\Schema $schema )
134
+		{
131 135
 
132 136
 			$table = $schema->createTable( 'mshop_customer_list' );
133 137
 
@@ -165,7 +169,8 @@  discard block
 block discarded – undo
165 169
 			return $schema;
166 170
 		},
167 171
 
168
-		'mshop_customer_group' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
172
+		'mshop_customer_group' => function ( \Doctrine\DBAL\Schema\Schema $schema )
173
+		{
169 174
 
170 175
 			$table = $schema->createTable( 'mshop_customer_group' );
171 176
 
@@ -184,7 +189,8 @@  discard block
 block discarded – undo
184 189
 			return $schema;
185 190
 		},
186 191
 
187
-		'mshop_customer_property_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
192
+		'mshop_customer_property_type' => function ( \Doctrine\DBAL\Schema\Schema $schema )
193
+		{
188 194
 
189 195
 			$table = $schema->createTable( 'mshop_customer_property_type' );
190 196
 
@@ -207,7 +213,8 @@  discard block
 block discarded – undo
207 213
 			return $schema;
208 214
 		},
209 215
 
210
-		'mshop_customer_property' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
216
+		'mshop_customer_property' => function ( \Doctrine\DBAL\Schema\Schema $schema )
217
+		{
211 218
 
212 219
 			$table = $schema->createTable( 'mshop_customer_property' );
213 220
 
Please login to merge, or discard this patch.