Completed
Push — master ( 5c752e...17dc2a )
by Aimeos
01:57
created
lib/custom/tests/MShop/Customer/Manager/Lists/Type/FosUserTest.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@  discard block
 block discarded – undo
16 16
 	protected function setUp()
17 17
 	{
18 18
 		$this->editor = \TestHelper::getContext()->getEditor();
19
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::create( \TestHelper::getContext(), 'FosUser' );
19
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::create(\TestHelper::getContext(), 'FosUser');
20 20
 
21
-		$listManager = $manager->getSubManager( 'lists', 'FosUser' );
22
-		$this->object = $listManager->getSubManager( 'type', 'FosUser' );
21
+		$listManager = $manager->getSubManager('lists', 'FosUser');
22
+		$this->object = $listManager->getSubManager('type', 'FosUser');
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
 
32 32
 	public function testCleanup()
33 33
 	{
34
-		$this->object->cleanup( array( -1 ) );
34
+		$this->object->cleanup(array( -1 ));
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetSearchAttributes()
39 39
 	{
40
-		foreach( $this->object->getSearchAttributes() as $attribute ) {
41
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
40
+		foreach ($this->object->getSearchAttributes() as $attribute) {
41
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
42 42
 		}
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testGetSubManager()
47 47
 	{
48
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
49
-		$this->object->getSubManager( 'unknown' );
48
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
49
+		$this->object->getSubManager('unknown');
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testCreateItem()
54 54
 	{
55 55
 		$item = $this->object->createItem();
56
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item );
56
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item);
57 57
 	}
58 58
 
59 59
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 		$search->setSlice(0, 1);
64 64
 		$results = $this->object->searchItems($search);
65 65
 
66
-		if( ( $expected = reset($results) ) === false ) {
67
-			throw new \RuntimeException( 'No list type item found' );
66
+		if (($expected = reset($results)) === false) {
67
+			throw new \RuntimeException('No list type item found');
68 68
 		}
69 69
 
70
-		$this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) );
70
+		$this->assertEquals($expected, $this->object->getItem($expected->getId()));
71 71
 	}
72 72
 
73 73
 
@@ -77,51 +77,51 @@  discard block
 block discarded – undo
77 77
 		$search->setSlice(0, 1);
78 78
 		$results = $this->object->searchItems($search);
79 79
 
80
-		if( ( $item = reset($results) ) === false ) {
81
-			throw new \RuntimeException( 'No type item found' );
80
+		if (($item = reset($results)) === false) {
81
+			throw new \RuntimeException('No type item found');
82 82
 		}
83 83
 
84 84
 		$item->setId(null);
85
-		$item->setCode( 'unitTestInit' );
86
-		$resultSaved = $this->object->saveItem( $item );
87
-		$itemSaved = $this->object->getItem( $item->getId() );
85
+		$item->setCode('unitTestInit');
86
+		$resultSaved = $this->object->saveItem($item);
87
+		$itemSaved = $this->object->getItem($item->getId());
88 88
 
89 89
 		$itemExp = clone $itemSaved;
90
-		$itemExp->setCode( 'unitTestSave' );
91
-		$resultUpd = $this->object->saveItem( $itemExp );
92
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
90
+		$itemExp->setCode('unitTestSave');
91
+		$resultUpd = $this->object->saveItem($itemExp);
92
+		$itemUpd = $this->object->getItem($itemExp->getId());
93 93
 
94
-		$this->object->deleteItem( $itemSaved->getId() );
94
+		$this->object->deleteItem($itemSaved->getId());
95 95
 
96 96
 
97
-		$this->assertTrue( $item->getId() !== null );
98
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
99
-		$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() );
100
-		$this->assertEquals( $item->getCode(), $itemSaved->getCode() );
101
-		$this->assertEquals( $item->getDomain(), $itemSaved->getDomain() );
102
-		$this->assertEquals( $item->getLabel(), $itemSaved->getLabel() );
103
-		$this->assertEquals( $item->getStatus(), $itemSaved->getStatus() );
97
+		$this->assertTrue($item->getId() !== null);
98
+		$this->assertEquals($item->getId(), $itemSaved->getId());
99
+		$this->assertEquals($item->getSiteId(), $itemSaved->getSiteId());
100
+		$this->assertEquals($item->getCode(), $itemSaved->getCode());
101
+		$this->assertEquals($item->getDomain(), $itemSaved->getDomain());
102
+		$this->assertEquals($item->getLabel(), $itemSaved->getLabel());
103
+		$this->assertEquals($item->getStatus(), $itemSaved->getStatus());
104 104
 
105
-		$this->assertEquals( $this->editor, $itemSaved->getEditor() );
106
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
107
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
105
+		$this->assertEquals($this->editor, $itemSaved->getEditor());
106
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
107
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
108 108
 
109
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
110
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
111
-		$this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() );
112
-		$this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() );
113
-		$this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() );
114
-		$this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() );
109
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
110
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
111
+		$this->assertEquals($itemExp->getCode(), $itemUpd->getCode());
112
+		$this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain());
113
+		$this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel());
114
+		$this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus());
115 115
 
116
-		$this->assertEquals( $this->editor, $itemUpd->getEditor() );
117
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
118
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
116
+		$this->assertEquals($this->editor, $itemUpd->getEditor());
117
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
118
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
119 119
 
120
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved );
121
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd );
120
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved);
121
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd);
122 122
 
123 123
 		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
124
-		$this->object->getItem( $itemSaved->getId() );
124
+		$this->object->getItem($itemSaved->getId());
125 125
 	}
126 126
 
127 127
 
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
 		$search = $this->object->createSearch();
132 132
 
133 133
 		$expr = [];
134
-		$expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 );
135
-		$expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null );
136
-		$expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' );
137
-		$expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' );
138
-		$expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' );
139
-		$expr[] = $search->compare( '==', 'customer.lists.type.status', 1 );
140
-		$expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' );
141
-		$expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' );
142
-		$expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor );
143
-
144
-		$search->setConditions( $search->combine( '&&', $expr ) );
134
+		$expr[] = $search->compare('!=', 'customer.lists.type.id', 0);
135
+		$expr[] = $search->compare('!=', 'customer.lists.type.siteid', null);
136
+		$expr[] = $search->compare('==', 'customer.lists.type.code', 'default');
137
+		$expr[] = $search->compare('==', 'customer.lists.type.domain', 'text');
138
+		$expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard');
139
+		$expr[] = $search->compare('==', 'customer.lists.type.status', 1);
140
+		$expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00');
141
+		$expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00');
142
+		$expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor);
143
+
144
+		$search->setConditions($search->combine('&&', $expr));
145 145
 		$search->setSlice(0, 1);
146 146
 
147
-		$results = $this->object->searchItems( $search, [], $total );
148
-		$this->assertEquals( 1, count( $results ) );
149
-		$this->assertEquals( 1, $total );
147
+		$results = $this->object->searchItems($search, [], $total);
148
+		$this->assertEquals(1, count($results));
149
+		$this->assertEquals(1, $total);
150 150
 
151
-		foreach($results as $itemId => $item) {
152
-			$this->assertEquals( $itemId, $item->getId() );
151
+		foreach ($results as $itemId => $item) {
152
+			$this->assertEquals($itemId, $item->getId());
153 153
 		}
154 154
 	}
155 155
 
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/Property/FosUserTest.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -20,89 +20,89 @@  discard block
 block discarded – undo
20 20
 		$context = \TestHelper::getContext();
21 21
 		$this->editor = $context->getEditor();
22 22
 
23
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::create( $context, 'FosUser' );
24
-		$this->object = $manager->getSubManager( 'property', 'FosUser' );
23
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::create($context, 'FosUser');
24
+		$this->object = $manager->getSubManager('property', 'FosUser');
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object );
30
+		unset($this->object);
31 31
 	}
32 32
 
33 33
 
34 34
 	public function testCleanup()
35 35
 	{
36
-		$this->object->cleanup( array( -1 ) );
36
+		$this->object->cleanup(array( -1 ));
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateItem()
41 41
 	{
42 42
 		$item = $this->object->createItem();
43
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item );
43
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item);
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testSaveInvalid()
48 48
 	{
49
-		$this->setExpectedException( \Aimeos\MW\Common\Exception::class );
50
-		$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() );
49
+		$this->setExpectedException(\Aimeos\MW\Common\Exception::class);
50
+		$this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard());
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testSaveUpdateDeleteItem()
55 55
 	{
56 56
 		$search = $this->object->createSearch();
57
-		$search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) );
58
-		$results = $this->object->searchItems( $search );
57
+		$search->setConditions($search->compare('==', 'customer.property.editor', $this->editor));
58
+		$results = $this->object->searchItems($search);
59 59
 
60
-		if( ( $item = reset($results) ) === false ) {
61
-			throw new \RuntimeException( 'No property item found' );
60
+		if (($item = reset($results)) === false) {
61
+			throw new \RuntimeException('No property item found');
62 62
 		}
63 63
 
64 64
 		$item->setId(null);
65
-		$item->setLanguageId( 'en' );
66
-		$resultSaved = $this->object->saveItem( $item );
67
-		$itemSaved = $this->object->getItem( $item->getId() );
65
+		$item->setLanguageId('en');
66
+		$resultSaved = $this->object->saveItem($item);
67
+		$itemSaved = $this->object->getItem($item->getId());
68 68
 
69 69
 		$itemExp = clone $itemSaved;
70
-		$itemExp->setValue( 'unittest' );
71
-		$resultUpd = $this->object->saveItem( $itemExp );
72
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
70
+		$itemExp->setValue('unittest');
71
+		$resultUpd = $this->object->saveItem($itemExp);
72
+		$itemUpd = $this->object->getItem($itemExp->getId());
73 73
 
74
-		$this->object->deleteItem( $itemSaved->getId() );
74
+		$this->object->deleteItem($itemSaved->getId());
75 75
 
76 76
 		$context = \TestHelper::getContext();
77 77
 
78
-		$this->assertTrue( $item->getId() !== null );
79
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
80
-		$this->assertEquals( $item->getParentId(), $itemSaved->getParentId() );
81
-		$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() );
82
-		$this->assertEquals( $item->getType(), $itemSaved->getType() );
83
-		$this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId() );
84
-		$this->assertEquals( $item->getValue(), $itemSaved->getValue() );
85
-
86
-		$this->assertEquals( $context->getEditor(), $itemSaved->getEditor() );
87
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
88
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
89
-
90
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
91
-		$this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() );
92
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
93
-		$this->assertEquals( $itemExp->getType(), $itemUpd->getType() );
94
-		$this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId() );
95
-		$this->assertEquals( $itemExp->getValue(), $itemUpd->getValue() );
96
-
97
-		$this->assertEquals( $context->getEditor(), $itemUpd->getEditor() );
98
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
99
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
100
-
101
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved );
102
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd );
103
-
104
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
105
-		$this->object->getItem( $itemSaved->getId() );
78
+		$this->assertTrue($item->getId() !== null);
79
+		$this->assertEquals($item->getId(), $itemSaved->getId());
80
+		$this->assertEquals($item->getParentId(), $itemSaved->getParentId());
81
+		$this->assertEquals($item->getSiteId(), $itemSaved->getSiteId());
82
+		$this->assertEquals($item->getType(), $itemSaved->getType());
83
+		$this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId());
84
+		$this->assertEquals($item->getValue(), $itemSaved->getValue());
85
+
86
+		$this->assertEquals($context->getEditor(), $itemSaved->getEditor());
87
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
88
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
89
+
90
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
91
+		$this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId());
92
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
93
+		$this->assertEquals($itemExp->getType(), $itemUpd->getType());
94
+		$this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId());
95
+		$this->assertEquals($itemExp->getValue(), $itemUpd->getValue());
96
+
97
+		$this->assertEquals($context->getEditor(), $itemUpd->getEditor());
98
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
99
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
100
+
101
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved);
102
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd);
103
+
104
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
105
+		$this->object->getItem($itemSaved->getId());
106 106
 	}
107 107
 
108 108
 
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$search = $this->object->createSearch();
112 112
 		$conditions = array(
113
-			$search->compare( '~=', 'customer.property.value', '1'),
114
-			$search->compare( '==', 'customer.property.editor', $this->editor )
113
+			$search->compare('~=', 'customer.property.value', '1'),
114
+			$search->compare('==', 'customer.property.editor', $this->editor)
115 115
 		);
116
-		$search->setConditions( $search->combine( '&&', $conditions ) );
117
-		$results = $this->object->searchItems( $search );
116
+		$search->setConditions($search->combine('&&', $conditions));
117
+		$results = $this->object->searchItems($search);
118 118
 
119
-		if( ($expected = reset($results)) === false ) {
120
-			throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) );
119
+		if (($expected = reset($results)) === false) {
120
+			throw new \RuntimeException(sprintf('No customer property item found for value "%1$s".', '1'));
121 121
 		}
122 122
 
123
-		$actual = $this->object->getItem( $expected->getId() );
124
-		$this->assertEquals( $expected, $actual );
123
+		$actual = $this->object->getItem($expected->getId());
124
+		$this->assertEquals($expected, $actual);
125 125
 	}
126 126
 
127 127
 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	{
130 130
 		$result = $this->object->getResourceType();
131 131
 
132
-		$this->assertContains( 'customer/property', $result );
132
+		$this->assertContains('customer/property', $result);
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testGetSearchAttributes()
137 137
 	{
138
-		foreach( $this->object->getSearchAttributes() as $attribute ) {
139
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
138
+		foreach ($this->object->getSearchAttributes() as $attribute) {
139
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
140 140
 		}
141 141
 	}
142 142
 
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 		$search = $this->object->createSearch();
148 148
 
149 149
 		$expr = [];
150
-		$expr[] = $search->compare( '!=', 'customer.property.id', null );
151
-		$expr[] = $search->compare( '!=', 'customer.property.parentid', null );
152
-		$expr[] = $search->compare( '!=', 'customer.property.siteid', null );
153
-		$expr[] = $search->compare( '==', 'customer.property.type', 'newsletter' );
154
-		$expr[] = $search->compare( '==', 'customer.property.languageid', null );
155
-		$expr[] = $search->compare( '==', 'customer.property.value', '1' );
156
-		$expr[] = $search->compare( '==', 'customer.property.editor', $this->editor );
157
-
158
-		$search->setConditions( $search->combine('&&', $expr) );
159
-		$results = $this->object->searchItems( $search, [], $total );
160
-		$this->assertEquals( 1, count( $results ) );
150
+		$expr[] = $search->compare('!=', 'customer.property.id', null);
151
+		$expr[] = $search->compare('!=', 'customer.property.parentid', null);
152
+		$expr[] = $search->compare('!=', 'customer.property.siteid', null);
153
+		$expr[] = $search->compare('==', 'customer.property.type', 'newsletter');
154
+		$expr[] = $search->compare('==', 'customer.property.languageid', null);
155
+		$expr[] = $search->compare('==', 'customer.property.value', '1');
156
+		$expr[] = $search->compare('==', 'customer.property.editor', $this->editor);
157
+
158
+		$search->setConditions($search->combine('&&', $expr));
159
+		$results = $this->object->searchItems($search, [], $total);
160
+		$this->assertEquals(1, count($results));
161 161
 	}
162 162
 
163 163
 
164 164
 	public function testGetSubManager()
165 165
 	{
166
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') );
167
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') );
166
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type'));
167
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard'));
168 168
 
169 169
 		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
170 170
 		$this->object->getSubManager('unknown');
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/Property/Type/FosUserTest.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 		$context = \TestHelper::getContext();
21 21
 		$this->editor = $context->getEditor();
22 22
 
23
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::create( $context, 'FosUser' );
24
-		$this->object = $manager->getSubManager( 'property', 'FosUser' )->getSubManager( 'type', 'FosUser' );
23
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::create($context, 'FosUser');
24
+		$this->object = $manager->getSubManager('property', 'FosUser')->getSubManager('type', 'FosUser');
25 25
 	}
26 26
 
27 27
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function testCleanup()
35 35
 	{
36
-		$this->object->cleanup( array( -1 ) );
36
+		$this->object->cleanup(array( -1 ));
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateItem()
41 41
 	{
42
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem() );
42
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem());
43 43
 	}
44 44
 
45 45
 
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$result = $this->object->getResourceType();
49 49
 
50
-		$this->assertContains( 'customer/property/type', $result );
50
+		$this->assertContains('customer/property/type', $result);
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testGetSearchAttributes()
55 55
 	{
56
-		foreach( $this->object->getSearchAttributes() as $attribute ) {
57
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
56
+		foreach ($this->object->getSearchAttributes() as $attribute) {
57
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
58 58
 		}
59 59
 	}
60 60
 
@@ -63,82 +63,82 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		$search = $this->object->createSearch();
65 65
 		$conditions = array(
66
-			$search->compare( '==', 'customer.property.type.code', 'newsletter' ),
67
-			$search->compare( '==', 'customer.property.type.editor', $this->editor )
66
+			$search->compare('==', 'customer.property.type.code', 'newsletter'),
67
+			$search->compare('==', 'customer.property.type.editor', $this->editor)
68 68
 		);
69
-		$search->setConditions( $search->combine( '&&', $conditions ) );
69
+		$search->setConditions($search->combine('&&', $conditions));
70 70
 
71
-		$results = $this->object->searchItems( $search );
71
+		$results = $this->object->searchItems($search);
72 72
 
73
-		if( ($expected = reset($results) ) === false )
73
+		if (($expected = reset($results)) === false)
74 74
 		{
75
-			throw new \RuntimeException( 'No property type item found.' );
75
+			throw new \RuntimeException('No property type item found.');
76 76
 		}
77 77
 
78
-		$actual = $this->object->getItem( $expected->getId() );
78
+		$actual = $this->object->getItem($expected->getId());
79 79
 
80
-		$this->assertEquals( $expected, $actual );
80
+		$this->assertEquals($expected, $actual);
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testSaveInvalid()
85 85
 	{
86
-		$this->setExpectedException( \Aimeos\MW\Common\Exception::class );
87
-		$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() );
86
+		$this->setExpectedException(\Aimeos\MW\Common\Exception::class);
87
+		$this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard());
88 88
 	}
89 89
 
90 90
 
91 91
 	public function testSaveUpdateDeleteItem()
92 92
 	{
93 93
 		$search = $this->object->createSearch();
94
-		$search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) );
94
+		$search->setConditions($search->compare('==', 'customer.property.type.editor', $this->editor));
95 95
 		$results = $this->object->searchItems($search);
96 96
 
97
-		if( ( $item = reset($results) ) === false ) {
98
-			throw new \RuntimeException( 'No type item found' );
97
+		if (($item = reset($results)) === false) {
98
+			throw new \RuntimeException('No type item found');
99 99
 		}
100 100
 
101 101
 		$item->setId(null);
102
-		$item->setCode( 'unitTestSave' );
103
-		$resultSaved = $this->object->saveItem( $item );
104
-		$itemSaved = $this->object->getItem( $item->getId() );
102
+		$item->setCode('unitTestSave');
103
+		$resultSaved = $this->object->saveItem($item);
104
+		$itemSaved = $this->object->getItem($item->getId());
105 105
 
106 106
 		$itemExp = clone $itemSaved;
107
-		$itemExp->setCode( 'unitTestSave2' );
108
-		$resultUpd = $this->object->saveItem( $itemExp );
109
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
107
+		$itemExp->setCode('unitTestSave2');
108
+		$resultUpd = $this->object->saveItem($itemExp);
109
+		$itemUpd = $this->object->getItem($itemExp->getId());
110 110
 
111
-		$this->object->deleteItem( $itemSaved->getId() );
111
+		$this->object->deleteItem($itemSaved->getId());
112 112
 
113 113
 
114
-		$this->assertTrue( $item->getId() !== null );
115
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
116
-		$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() );
117
-		$this->assertEquals( $item->getCode(), $itemSaved->getCode() );
118
-		$this->assertEquals( $item->getDomain(), $itemSaved->getDomain() );
119
-		$this->assertEquals( $item->getLabel(), $itemSaved->getLabel() );
120
-		$this->assertEquals( $item->getStatus(), $itemSaved->getStatus() );
114
+		$this->assertTrue($item->getId() !== null);
115
+		$this->assertEquals($item->getId(), $itemSaved->getId());
116
+		$this->assertEquals($item->getSiteId(), $itemSaved->getSiteId());
117
+		$this->assertEquals($item->getCode(), $itemSaved->getCode());
118
+		$this->assertEquals($item->getDomain(), $itemSaved->getDomain());
119
+		$this->assertEquals($item->getLabel(), $itemSaved->getLabel());
120
+		$this->assertEquals($item->getStatus(), $itemSaved->getStatus());
121 121
 
122
-		$this->assertEquals( $this->editor, $itemSaved->getEditor() );
123
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
124
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
122
+		$this->assertEquals($this->editor, $itemSaved->getEditor());
123
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
124
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
125 125
 
126
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
127
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
128
-		$this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() );
129
-		$this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() );
130
-		$this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() );
131
-		$this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() );
126
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
127
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
128
+		$this->assertEquals($itemExp->getCode(), $itemUpd->getCode());
129
+		$this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain());
130
+		$this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel());
131
+		$this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus());
132 132
 
133
-		$this->assertEquals( $this->editor, $itemUpd->getEditor() );
134
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
135
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
133
+		$this->assertEquals($this->editor, $itemUpd->getEditor());
134
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
135
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
136 136
 
137
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved );
138
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd );
137
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved);
138
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd);
139 139
 
140
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
141
-		$this->object->getItem( $itemSaved->getId() );
140
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
141
+		$this->object->getItem($itemSaved->getId());
142 142
 	}
143 143
 
144 144
 
@@ -148,36 +148,36 @@  discard block
 block discarded – undo
148 148
 		$search = $this->object->createSearch();
149 149
 
150 150
 		$expr = [];
151
-		$expr[] = $search->compare( '!=', 'customer.property.type.id', null );
152
-		$expr[] = $search->compare( '!=', 'customer.property.type.siteid', null );
153
-		$expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' );
154
-		$expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' );
155
-		$expr[] = $search->compare( '>', 'customer.property.type.label', '' );
156
-		$expr[] = $search->compare( '==', 'customer.property.type.status', 1 );
157
-		$expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' );
158
-		$expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' );
159
-		$expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor );
151
+		$expr[] = $search->compare('!=', 'customer.property.type.id', null);
152
+		$expr[] = $search->compare('!=', 'customer.property.type.siteid', null);
153
+		$expr[] = $search->compare('==', 'customer.property.type.domain', 'customer');
154
+		$expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter');
155
+		$expr[] = $search->compare('>', 'customer.property.type.label', '');
156
+		$expr[] = $search->compare('==', 'customer.property.type.status', 1);
157
+		$expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00');
158
+		$expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00');
159
+		$expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor);
160 160
 
161
-		$search->setConditions( $search->combine('&&', $expr) );
162
-		$results = $this->object->searchItems( $search, [], $total );
163
-		$this->assertEquals( 1, count( $results ) );
161
+		$search->setConditions($search->combine('&&', $expr));
162
+		$results = $this->object->searchItems($search, [], $total);
163
+		$this->assertEquals(1, count($results));
164 164
 
165 165
 
166 166
 		$search = $this->object->createSearch();
167 167
 		$conditions = array(
168
-			$search->compare( '=~', 'customer.property.type.code', 'newsletter'),
169
-			$search->compare( '==', 'customer.property.type.editor', $this->editor )
168
+			$search->compare('=~', 'customer.property.type.code', 'newsletter'),
169
+			$search->compare('==', 'customer.property.type.editor', $this->editor)
170 170
 		);
171
-		$search->setConditions( $search->combine('&&', $conditions ) );
172
-		$search->setSortations( [$search->sort('-', 'customer.property.type.position' )] );
171
+		$search->setConditions($search->combine('&&', $conditions));
172
+		$search->setSortations([$search->sort('-', 'customer.property.type.position')]);
173 173
 		$search->setSlice(0, 1);
174
-		$items = $this->object->searchItems( $search, [], $total);
174
+		$items = $this->object->searchItems($search, [], $total);
175 175
 
176
-		$this->assertEquals( 1, count( $items ) );
177
-		$this->assertEquals( 1, $total );
176
+		$this->assertEquals(1, count($items));
177
+		$this->assertEquals(1, $total);
178 178
 
179
-		foreach($items as $itemId => $item) {
180
-			$this->assertEquals( $itemId, $item->getId() );
179
+		foreach ($items as $itemId => $item) {
180
+			$this->assertEquals($itemId, $item->getId());
181 181
 		}
182 182
 	}
183 183
 
Please login to merge, or discard this patch.
lib/custom/tests/TestHelper.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$includepaths = $aimeos->getIncludePaths();
20 20
 		$includepaths[] = get_include_path();
21
-		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
+		set_include_path(implode(PATH_SEPARATOR, $includepaths));
22 22
 	}
23 23
 
24 24
 
25
-	public static function getContext( $site = 'unittest' )
25
+	public static function getContext($site = 'unittest')
26 26
 	{
27
-		if( !isset( self::$context[$site] ) ) {
28
-			self::$context[$site] = self::createContext( $site );
27
+		if (!isset(self::$context[$site])) {
28
+			self::$context[$site] = self::createContext($site);
29 29
 		}
30 30
 
31 31
 		return clone self::$context[$site];
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 
35 35
 	private static function getAimeos()
36 36
 	{
37
-		if( !isset( self::$aimeos ) )
37
+		if (!isset(self::$aimeos))
38 38
 		{
39 39
 			require_once 'Bootstrap.php';
40
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
40
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
41 41
 
42
-			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
43
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
42
+			$extdir = dirname(dirname(dirname(__DIR__)));
43
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
44 44
 		}
45 45
 
46 46
 		return self::$aimeos;
@@ -50,45 +50,45 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * @param string $site
52 52
 	 */
53
-	private static function createContext( $site )
53
+	private static function createContext($site)
54 54
 	{
55 55
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
56 56
 		$aimeos = self::getAimeos();
57 57
 
58 58
 
59
-		$paths = $aimeos->getConfigPaths( 'mysql' );
59
+		$paths = $aimeos->getConfigPaths('mysql');
60 60
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
61 61
 
62
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
63
-		$ctx->setConfig( $conf );
62
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
63
+		$ctx->setConfig($conf);
64 64
 
65 65
 
66
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
67
-		$ctx->setDatabaseManager( $dbm );
66
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
67
+		$ctx->setDatabaseManager($dbm);
68 68
 
69 69
 
70
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
71
-		$ctx->setLogger( $logger );
70
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
71
+		$ctx->setLogger($logger);
72 72
 
73 73
 
74 74
 		$cache = new \Aimeos\MW\Cache\None();
75
-		$ctx->setCache( $cache );
75
+		$ctx->setCache($cache);
76 76
 
77 77
 
78
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
79
-		$ctx->setI18n( array( 'de' => $i18n ) );
78
+		$i18n = new \Aimeos\MW\Translation\None('de');
79
+		$ctx->setI18n(array('de' => $i18n));
80 80
 
81 81
 
82 82
 		$session = new \Aimeos\MW\Session\None();
83
-		$ctx->setSession( $session );
83
+		$ctx->setSession($session);
84 84
 
85 85
 
86
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx );
87
-		$localeItem = $localeManager->bootstrap( $site, '', '', false );
86
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx);
87
+		$localeItem = $localeManager->bootstrap($site, '', '', false);
88 88
 
89
-		$ctx->setLocale( $localeItem );
89
+		$ctx->setLocale($localeItem);
90 90
 
91
-		$ctx->setEditor( 'ai-fosuser:unittest' );
91
+		$ctx->setEditor('ai-fosuser:unittest');
92 92
 
93 93
 		return $ctx;
94 94
 	}
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/FosUser.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
243 243
 	 */
244
-	public function cleanup( array $siteids )
244
+	public function cleanup(array $siteids)
245 245
 	{
246 246
 		$path = 'mshop/customer/manager/submanagers';
247 247
 		$default = ['address', 'group', 'lists', 'property'];
248 248
 
249
-		foreach( $this->getContext()->getConfig()->get( $path, $default ) as $domain ) {
250
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
249
+		foreach ($this->getContext()->getConfig()->get($path, $default) as $domain) {
250
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
251 251
 		}
252 252
 	}
253 253
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @param array $ids List of IDs
259 259
 	 */
260
-	public function deleteItems( array $ids )
260
+	public function deleteItems(array $ids)
261 261
 	{
262 262
 		$path = 'mshop/customer/manager/fosuser/delete';
263
-		$this->deleteItemsBase( $ids, $path, false );
263
+		$this->deleteItemsBase($ids, $path, false);
264 264
 	}
265 265
 
266 266
 
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 * @param boolean $withsub Return also attributes of sub-managers if true
271 271
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
272 272
 	 */
273
-	public function getSearchAttributes( $withsub = true )
273
+	public function getSearchAttributes($withsub = true)
274 274
 	{
275 275
 		$path = 'mshop/customer/manager/submanagers';
276 276
 		$default = ['address', 'group', 'lists', 'property'];
277 277
 
278
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub );
278
+		return $this->getSearchAttributesBase($this->searchConfig, $path, $default, $withsub);
279 279
 	}
280 280
 
281 281
 
@@ -286,29 +286,29 @@  discard block
 block discarded – undo
286 286
 	 * @param boolean $fetch True if the new ID should be returned in the item
287 287
 	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
288 288
 	 */
289
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
289
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
290 290
 	{
291
-		self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\FosUser', $item );
291
+		self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\FosUser', $item);
292 292
 
293
-		if( !$item->isModified() )
293
+		if (!$item->isModified())
294 294
 		{
295
-			$item = $this->savePropertyItems( $item, 'customer' );
296
-			$item = $this->saveAddressItems( $item, 'customer' );
297
-			return $this->saveListItems( $item, 'customer' );
295
+			$item = $this->savePropertyItems($item, 'customer');
296
+			$item = $this->saveAddressItems($item, 'customer');
297
+			return $this->saveListItems($item, 'customer');
298 298
 		}
299 299
 
300 300
 		$context = $this->getContext();
301 301
 		$dbm = $context->getDatabaseManager();
302 302
 		$dbname = $this->getResourceName();
303
-		$conn = $dbm->acquire( $dbname );
303
+		$conn = $dbm->acquire($dbname);
304 304
 
305 305
 		try
306 306
 		{
307 307
 			$id = $item->getId();
308
-			$date = date( 'Y-m-d H:i:s' );
308
+			$date = date('Y-m-d H:i:s');
309 309
 			$billingAddress = $item->getPaymentAddress();
310 310
 
311
-			if( $id === null )
311
+			if ($id === null)
312 312
 			{
313 313
 				/** mshop/customer/manager/fosuser/insert
314 314
 				 * Inserts a new customer record into the database table
@@ -372,51 +372,51 @@  discard block
 block discarded – undo
372 372
 				$path = 'mshop/customer/manager/fosuser/update';
373 373
 			}
374 374
 
375
-			$stmt = $this->getCachedStatement( $conn, $path );
376
-
377
-			$stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
378
-			$stmt->bind( 2, $item->getCode() ); // canonical username
379
-			$stmt->bind( 3, $item->getCode() ); // username
380
-			$stmt->bind( 4, $billingAddress->getCompany() );
381
-			$stmt->bind( 5, $billingAddress->getVatID() );
382
-			$stmt->bind( 6, $billingAddress->getSalutation() );
383
-			$stmt->bind( 7, $billingAddress->getTitle() );
384
-			$stmt->bind( 8, $billingAddress->getFirstname() );
385
-			$stmt->bind( 9, $billingAddress->getLastname() );
386
-			$stmt->bind( 10, $billingAddress->getAddress1() );
387
-			$stmt->bind( 11, $billingAddress->getAddress2() );
388
-			$stmt->bind( 12, $billingAddress->getAddress3() );
389
-			$stmt->bind( 13, $billingAddress->getPostal() );
390
-			$stmt->bind( 14, $billingAddress->getCity() );
391
-			$stmt->bind( 15, $billingAddress->getState() );
392
-			$stmt->bind( 16, $billingAddress->getCountryId() );
393
-			$stmt->bind( 17, $billingAddress->getLanguageId() );
394
-			$stmt->bind( 18, $billingAddress->getTelephone() );
395
-			$stmt->bind( 19, $billingAddress->getEmail() );
396
-			$stmt->bind( 20, $billingAddress->getEmail() );
397
-			$stmt->bind( 21, $billingAddress->getTelefax() );
398
-			$stmt->bind( 22, $billingAddress->getWebsite() );
399
-			$stmt->bind( 23, $billingAddress->getLongitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT );
400
-			$stmt->bind( 24, $billingAddress->getLatitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT );
401
-			$stmt->bind( 25, $item->getBirthday() );
402
-			$stmt->bind( 26, ( $item->getStatus() > 0 ? true : false ), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL );
403
-			$stmt->bind( 27, $item->getDateVerified() );
404
-			$stmt->bind( 28, $item->getPassword() );
405
-			$stmt->bind( 29, $date ); // Modification time
406
-			$stmt->bind( 30, $context->getEditor() );
407
-			$stmt->bind( 31, serialize( $item->getRoles() ) );
408
-			$stmt->bind( 32, $item->getSalt() );
409
-
410
-			if( $id !== null ) {
411
-				$stmt->bind( 33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
412
-				$item->setId( $id );
375
+			$stmt = $this->getCachedStatement($conn, $path);
376
+
377
+			$stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
378
+			$stmt->bind(2, $item->getCode()); // canonical username
379
+			$stmt->bind(3, $item->getCode()); // username
380
+			$stmt->bind(4, $billingAddress->getCompany());
381
+			$stmt->bind(5, $billingAddress->getVatID());
382
+			$stmt->bind(6, $billingAddress->getSalutation());
383
+			$stmt->bind(7, $billingAddress->getTitle());
384
+			$stmt->bind(8, $billingAddress->getFirstname());
385
+			$stmt->bind(9, $billingAddress->getLastname());
386
+			$stmt->bind(10, $billingAddress->getAddress1());
387
+			$stmt->bind(11, $billingAddress->getAddress2());
388
+			$stmt->bind(12, $billingAddress->getAddress3());
389
+			$stmt->bind(13, $billingAddress->getPostal());
390
+			$stmt->bind(14, $billingAddress->getCity());
391
+			$stmt->bind(15, $billingAddress->getState());
392
+			$stmt->bind(16, $billingAddress->getCountryId());
393
+			$stmt->bind(17, $billingAddress->getLanguageId());
394
+			$stmt->bind(18, $billingAddress->getTelephone());
395
+			$stmt->bind(19, $billingAddress->getEmail());
396
+			$stmt->bind(20, $billingAddress->getEmail());
397
+			$stmt->bind(21, $billingAddress->getTelefax());
398
+			$stmt->bind(22, $billingAddress->getWebsite());
399
+			$stmt->bind(23, $billingAddress->getLongitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT);
400
+			$stmt->bind(24, $billingAddress->getLatitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT);
401
+			$stmt->bind(25, $item->getBirthday());
402
+			$stmt->bind(26, ($item->getStatus() > 0 ? true : false), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
403
+			$stmt->bind(27, $item->getDateVerified());
404
+			$stmt->bind(28, $item->getPassword());
405
+			$stmt->bind(29, $date); // Modification time
406
+			$stmt->bind(30, $context->getEditor());
407
+			$stmt->bind(31, serialize($item->getRoles()));
408
+			$stmt->bind(32, $item->getSalt());
409
+
410
+			if ($id !== null) {
411
+				$stmt->bind(33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
412
+				$item->setId($id);
413 413
 			} else {
414
-				$stmt->bind( 33, $date ); // Creation time
414
+				$stmt->bind(33, $date); // Creation time
415 415
 			}
416 416
 
417 417
 			$stmt->execute()->finish();
418 418
 
419
-			if( $id === null && $fetch === true )
419
+			if ($id === null && $fetch === true)
420 420
 			{
421 421
 				/** mshop/customer/manager/fosuser/newid
422 422
 				 * Retrieves the ID generated by the database when inserting a new record
@@ -449,22 +449,22 @@  discard block
 block discarded – undo
449 449
 				 * @see mshop/customer/manager/fosuser/count
450 450
 				 */
451 451
 				$path = 'mshop/customer/manager/fosuser/newid';
452
-				$item->setId( $this->newId( $conn, $path ) );
452
+				$item->setId($this->newId($conn, $path));
453 453
 			}
454 454
 
455
-			$dbm->release( $conn, $dbname );
455
+			$dbm->release($conn, $dbname);
456 456
 		}
457
-		catch( \Exception $e )
457
+		catch (\Exception $e)
458 458
 		{
459
-			$dbm->release( $conn, $dbname );
459
+			$dbm->release($conn, $dbname);
460 460
 			throw $e;
461 461
 		}
462 462
 
463
-		$this->addGroups( $item );
463
+		$this->addGroups($item);
464 464
 
465
-		$item = $this->savePropertyItems( $item, 'customer' );
466
-		$item = $this->saveAddressItems( $item, 'customer' );
467
-		return $this->saveListItems( $item, 'customer' );
465
+		$item = $this->savePropertyItems($item, 'customer');
466
+		$item = $this->saveAddressItems($item, 'customer');
467
+		return $this->saveListItems($item, 'customer');
468 468
 	}
469 469
 
470 470
 
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
477 477
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
478 478
 	 */
479
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
479
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
480 480
 	{
481 481
 		$dbm = $this->getContext()->getDatabaseManager();
482 482
 		$dbname = $this->getResourceName();
483
-		$conn = $dbm->acquire( $dbname );
483
+		$conn = $dbm->acquire($dbname);
484 484
 		$map = [];
485 485
 
486 486
 		try
@@ -488,32 +488,32 @@  discard block
 block discarded – undo
488 488
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
489 489
 			$cfgPathSearch = 'mshop/customer/manager/fosuser/search';
490 490
 			$cfgPathCount = 'mshop/customer/manager/fosuser/count';
491
-			$required = array( 'customer' );
491
+			$required = array('customer');
492 492
 
493
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
494
-			while( ( $row = $results->fetch() ) !== false ) {
495
-				$map[ $row['customer.id'] ] = $row;
493
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
494
+			while (($row = $results->fetch()) !== false) {
495
+				$map[$row['customer.id']] = $row;
496 496
 			}
497 497
 
498
-			$dbm->release( $conn, $dbname );
498
+			$dbm->release($conn, $dbname);
499 499
 		}
500
-		catch( \Exception $e )
500
+		catch (\Exception $e)
501 501
 		{
502
-			$dbm->release( $conn, $dbname  );
502
+			$dbm->release($conn, $dbname);
503 503
 			throw $e;
504 504
 		}
505 505
 
506 506
 		$addrItems = [];
507
-		if( in_array( 'customer/address', $ref, true ) ) {
508
-			$addrItems = $this->getAddressItems( array_keys( $map ), 'customer' );
507
+		if (in_array('customer/address', $ref, true)) {
508
+			$addrItems = $this->getAddressItems(array_keys($map), 'customer');
509 509
 		}
510 510
 
511 511
 		$propItems = [];
512
-		if( in_array( 'customer/property', $ref, true ) ) {
513
-			$propItems = $this->getPropertyItems( array_keys( $map ), 'customer' );
512
+		if (in_array('customer/property', $ref, true)) {
513
+			$propItems = $this->getPropertyItems(array_keys($map), 'customer');
514 514
 		}
515 515
 
516
-		return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems );
516
+		return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems);
517 517
 	}
518 518
 
519 519
 
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
525 525
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
526 526
 	 */
527
-	public function getSubManager( $manager, $name = null )
527
+	public function getSubManager($manager, $name = null)
528 528
 	{
529
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) );
529
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name));
530 530
 	}
531 531
 
532 532
 
@@ -540,15 +540,15 @@  discard block
 block discarded – undo
540 540
 	 * @param \Aimeos\MShop\Common\Item\Property\Iface[] $propItems List of property items
541 541
 	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item
542 542
 	 */
543
-	protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [],
544
-		array $addrItems = [], array $propItems = [] )
543
+	protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [],
544
+		array $addrItems = [], array $propItems = [])
545 545
 	{
546
-		if( isset( $values['roles'] ) ) {
547
-			$values['roles'] = unserialize( $values['roles'] );
546
+		if (isset($values['roles'])) {
547
+			$values['roles'] = unserialize($values['roles']);
548 548
 		}
549 549
 
550 550
 		$helper = $this->getPasswordHelper();
551
-		$address = new \Aimeos\MShop\Common\Item\Address\Simple( 'customer.', $values );
551
+		$address = new \Aimeos\MShop\Common\Item\Address\Simple('customer.', $values);
552 552
 
553 553
 		return new \Aimeos\MShop\Customer\Item\FosUser(
554 554
 			$address, $values, $listItems, $refItems, $addrItems, $propItems, $helper
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Item/FosUser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 * @param \Aimeos\MShop\Common\Item\Helper\Password\Iface|null $helper Password encryption helper object
36 36
 	 * @param string|null $salt Password salt
37 37
 	 */
38
-	public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = [],
38
+	public function __construct(\Aimeos\MShop\Common\Item\Address\Iface $address, array $values = [],
39 39
 		array $listItems = [], array $refItems = [], array $addrItems = [], array $propItems = [],
40
-		\Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null, $salt = null )
40
+		\Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null, $salt = null)
41 41
 	{
42
-		parent::__construct( $address, $values, $listItems, $refItems, $addrItems, $propItems, $helper, $salt );
42
+		parent::__construct($address, $values, $listItems, $refItems, $addrItems, $propItems, $helper, $salt);
43 43
 
44 44
 		$this->values = $values;
45 45
 		$this->helper = $helper;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function getPassword()
56 56
 	{
57
-		if( isset( $this->values['customer.password'] ) ) {
57
+		if (isset($this->values['customer.password'])) {
58 58
 			return (string) $this->values['customer.password'];
59 59
 		}
60 60
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * @param string $value Password of the customer item
69 69
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
70 70
 	 */
71
-	public function setPassword( $value )
71
+	public function setPassword($value)
72 72
 	{
73
-		if( (string) $value !== $this->getPassword() )
73
+		if ((string) $value !== $this->getPassword())
74 74
 		{
75
-			if( $this->helper !== null ) {
76
-				$value = $this->helper->encode( $value, $this->getSalt() );
75
+			if ($this->helper !== null) {
76
+				$value = $this->helper->encode($value, $this->getSalt());
77 77
 			}
78 78
 
79 79
 			$this->values['customer.password'] = (string) $value;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function getRoles()
93 93
 	{
94
-		if( isset( $this->values['roles'] ) ) {
94
+		if (isset($this->values['roles'])) {
95 95
 			return (array) $this->values['roles'];
96 96
 		}
97 97
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @param array $roles List of Symfony roles
106 106
 	 */
107
-	public function setRoles( array $roles )
107
+	public function setRoles(array $roles)
108 108
 	{
109 109
 		$this->values['roles'] = $roles;
110 110
 		$this->setModified();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getSalt()
122 122
 	{
123
-		if( isset( $this->values['salt'] ) ) {
123
+		if (isset($this->values['salt'])) {
124 124
 			return $this->values['salt'];
125 125
 		}
126 126
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param string $value Password salt
135 135
 	 */
136
-	public function setSalt( $value )
136
+	public function setSalt($value)
137 137
 	{
138
-		if( (string) $value !== $this->getSalt() )
138
+		if ((string) $value !== $this->getSalt())
139 139
 		{
140 140
 			$this->values['salt'] = (string) $value;
141 141
 			$this->setModified();
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Item/FosUserTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -47,72 +47,72 @@
 block discarded – undo
47 47
 			'customer.mtime'=> '2010-01-05 00:00:05',
48 48
 			'customer.ctime'=> '2010-01-01 00:00:00',
49 49
 			'customer.editor' => 'unitTestUser',
50
-			'roles' => array( 'ROLE_ADMIN' ),
50
+			'roles' => array('ROLE_ADMIN'),
51 51
 			'salt' => 'test',
52 52
 		);
53 53
 
54
-		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.', $values );
55
-		$this->object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, $values );
54
+		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard('customer.', $values);
55
+		$this->object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, $values);
56 56
 	}
57 57
 
58 58
 	protected function tearDown()
59 59
 	{
60
-		unset( $this->object );
60
+		unset($this->object);
61 61
 	}
62 62
 
63 63
 	public function testGetPassword()
64 64
 	{
65
-		$this->assertEquals( 'testpwd', $this->object->getPassword() );
65
+		$this->assertEquals('testpwd', $this->object->getPassword());
66 66
 	}
67 67
 
68 68
 	public function testSetPassword()
69 69
 	{
70
-		$this->object->setPassword( 'new' );
71
-		$this->assertTrue( $this->object->isModified() );
72
-		$this->assertEquals( 'new', $this->object->getPassword() );
70
+		$this->object->setPassword('new');
71
+		$this->assertTrue($this->object->isModified());
72
+		$this->assertEquals('new', $this->object->getPassword());
73 73
 	}
74 74
 
75 75
 	public function testSetPasswordGenerated()
76 76
 	{
77
-		$helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard( array( 'format' => '%1$s{%2$s}' ) );
78
-		$object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [], [], [], [], [], $helper );
77
+		$helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard(array('format' => '%1$s{%2$s}'));
78
+		$object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, [], [], [], [], [], $helper);
79 79
 
80
-		$object->setPassword( 'newpwd' );
81
-		$this->assertEquals( sha1( 'newpwd{' . $object->getSalt() . '}' ), $object->getPassword() );
80
+		$object->setPassword('newpwd');
81
+		$this->assertEquals(sha1('newpwd{' . $object->getSalt() . '}'), $object->getPassword());
82 82
 	}
83 83
 
84 84
 	public function testGetRoles()
85 85
 	{
86
-		$this->assertEquals( array( 'ROLE_ADMIN' ), $this->object->getRoles() );
86
+		$this->assertEquals(array('ROLE_ADMIN'), $this->object->getRoles());
87 87
 	}
88 88
 
89 89
 	public function testSetRoles()
90 90
 	{
91
-		$this->object->setRoles( array( 'ROLE_USER' ) );
92
-		$this->assertTrue( $this->object->isModified() );
93
-		$this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() );
91
+		$this->object->setRoles(array('ROLE_USER'));
92
+		$this->assertTrue($this->object->isModified());
93
+		$this->assertEquals(array('ROLE_USER'), $this->object->getRoles());
94 94
 	}
95 95
 
96 96
 	public function testGetSalt()
97 97
 	{
98
-		$this->assertEquals( 'test', $this->object->getSalt() );
98
+		$this->assertEquals('test', $this->object->getSalt());
99 99
 	}
100 100
 
101 101
 	public function testGetSaltGenerated()
102 102
 	{
103
-		$object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [] );
104
-		$this->assertEquals( '', $object->getSalt() );
103
+		$object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, []);
104
+		$this->assertEquals('', $object->getSalt());
105 105
 	}
106 106
 
107 107
 	public function testSetSalt()
108 108
 	{
109
-		$this->object->setSalt( 'new' );
110
-		$this->assertTrue( $this->object->isModified() );
111
-		$this->assertEquals( 'new', $this->object->getSalt() );
109
+		$this->object->setSalt('new');
110
+		$this->assertTrue($this->object->isModified());
111
+		$this->assertEquals('new', $this->object->getSalt());
112 112
 	}
113 113
 
114 114
 	public function testIsModified()
115 115
 	{
116
-		$this->assertFalse( $this->object->isModified() );
116
+		$this->assertFalse($this->object->isModified());
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
lib/custom/setup/TablesUpdateCharsetCollationFosuser.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,11 +50,11 @@
 block discarded – undo
50 50
 	 */
51 51
 	public function migrate()
52 52
 	{
53
-		$this->msg( 'Update charset and collation for FosUser tables', 0 );
54
-		$this->status( '' );
53
+		$this->msg('Update charset and collation for FosUser tables', 0);
54
+		$this->status('');
55 55
 
56
-		foreach( $this->tables as $rname => $list ) {
57
-			$this->checkTables( $list, $rname );
56
+		foreach ($this->tables as $rname => $list) {
57
+			$this->checkTables($list, $rname);
58 58
 		}
59 59
 	}
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.