@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $search->setConditions( $search->compare( '==', 'product.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 |
||
109 | 109 | { |
110 | 110 | $search = $this->object->createSearch(); |
111 | 111 | $conditions = array( |
112 | - $search->compare( '~=', 'product.property.value', '25.0'), |
|
112 | + $search->compare( '~=', 'product.property.value', '25.0' ), |
|
113 | 113 | $search->compare( '==', 'product.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 product property item found for value "%1$s".', '25.0' ) ); |
120 | 120 | } |
121 | 121 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $expr[] = $search->compare( '>=', 'product.property.type.ctime', '1970-01-01 00:00:00' ); |
167 | 167 | $expr[] = $search->compare( '==', 'product.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 |
||
177 | 177 | $search->compare( '==', 'product.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( 8, $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 |
||
191 | 191 | |
192 | 192 | public function testGetSubManager() |
193 | 193 | { |
194 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type') ); |
|
195 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type', 'Standard') ); |
|
194 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type' ) ); |
|
195 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type', 'Standard' ) ); |
|
196 | 196 | |
197 | 197 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
198 | - $this->object->getSubManager('unknown'); |
|
198 | + $this->object->getSubManager( 'unknown' ); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | public function testGetSubManagerInvalidName() |
203 | 203 | { |
204 | 204 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
205 | - $this->object->getSubManager('type', 'unknown'); |
|
205 | + $this->object->getSubManager( 'type', 'unknown' ); |
|
206 | 206 | } |
207 | 207 | } |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->editor = \TestHelperMShop::getContext()->getEditor(); |
21 | 21 | $manager = \Aimeos\MShop\Product\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 |
||
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 |
||
90 | 90 | { |
91 | 91 | $search = $this->object->createSearch(); |
92 | 92 | $search->setConditions( $search->compare( '==', 'product.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() ); |
@@ -157,25 +157,25 @@ discard block |
||
157 | 157 | $expr[] = $search->compare( '>=', 'product.property.type.ctime', '1970-01-01 00:00:00' ); |
158 | 158 | $expr[] = $search->compare( '==', 'product.property.type.editor', $this->editor ); |
159 | 159 | |
160 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
160 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
161 | 161 | $results = $this->object->searchItems( $search, [], $total ); |
162 | 162 | $this->assertEquals( 1, count( $results ) ); |
163 | 163 | |
164 | 164 | |
165 | 165 | $search = $this->object->createSearch(); |
166 | 166 | $conditions = array( |
167 | - $search->compare( '=~', 'product.property.type.code', 'package-'), |
|
167 | + $search->compare( '=~', 'product.property.type.code', 'package-' ), |
|
168 | 168 | $search->compare( '==', 'product.property.type.editor', $this->editor ) |
169 | 169 | ); |
170 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
170 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
171 | 171 | $search->setSortations( [$search->sort( '-', 'product.property.type.position' )] ); |
172 | - $search->setSlice(0, 1); |
|
173 | - $items = $this->object->searchItems( $search, [], $total); |
|
172 | + $search->setSlice( 0, 1 ); |
|
173 | + $items = $this->object->searchItems( $search, [], $total ); |
|
174 | 174 | |
175 | 175 | $this->assertEquals( 1, count( $items ) ); |
176 | 176 | $this->assertEquals( 4, $total ); |
177 | 177 | |
178 | - foreach($items as $itemId => $item) { |
|
178 | + foreach( $items as $itemId => $item ) { |
|
179 | 179 | $this->assertEquals( $itemId, $item->getId() ); |
180 | 180 | } |
181 | 181 | } |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | public function testGetSubManager() |
185 | 185 | { |
186 | 186 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
187 | - $this->object->getSubManager('unknown'); |
|
187 | + $this->object->getSubManager( 'unknown' ); |
|
188 | 188 | } |
189 | 189 | } |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | $search->setConditions( $search->compare( '==', 'attribute.property.editor', $this->editor ) ); |
64 | 64 | $results = $this->object->searchItems( $search ); |
65 | 65 | |
66 | - if( ( $item = reset($results) ) === false ) { |
|
66 | + if( ( $item = reset( $results ) ) === false ) { |
|
67 | 67 | throw new \RuntimeException( 'No property item found' ); |
68 | 68 | } |
69 | 69 | |
70 | - $item->setId(null); |
|
70 | + $item->setId( null ); |
|
71 | 71 | $item->setLanguageId( 'en' ); |
72 | 72 | $resultSaved = $this->object->saveItem( $item ); |
73 | 73 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | { |
119 | 119 | $search = $this->object->createSearch(); |
120 | 120 | $conditions = array( |
121 | - $search->compare( '~=', 'attribute.property.value', '1024'), |
|
121 | + $search->compare( '~=', 'attribute.property.value', '1024' ), |
|
122 | 122 | $search->compare( '==', 'attribute.property.editor', $this->editor ) |
123 | 123 | ); |
124 | 124 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
125 | 125 | $results = $this->object->searchItems( $search ); |
126 | 126 | |
127 | - if( ($expected = reset($results)) === false ) { |
|
127 | + if( ( $expected = reset( $results ) ) === false ) { |
|
128 | 128 | throw new \RuntimeException( sprintf( 'No attribute property item found for value "%1$s".', '1024' ) ); |
129 | 129 | } |
130 | 130 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $expr[] = $search->compare( '>=', 'attribute.property.type.ctime', '1970-01-01 00:00:00' ); |
176 | 176 | $expr[] = $search->compare( '==', 'attribute.property.type.editor', $this->editor ); |
177 | 177 | |
178 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
178 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
179 | 179 | $results = $this->object->searchItems( $search, [], $total ); |
180 | 180 | $this->assertEquals( 1, count( $results ) ); |
181 | 181 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | $search->compare( '==', 'attribute.property.editor', $this->editor ) |
187 | 187 | ); |
188 | 188 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
189 | - $search->setSlice(0, 1); |
|
189 | + $search->setSlice( 0, 1 ); |
|
190 | 190 | $items = $this->object->searchItems( $search, [], $total ); |
191 | 191 | |
192 | 192 | $this->assertEquals( 1, count( $items ) ); |
193 | 193 | $this->assertEquals( 3, $total ); |
194 | 194 | |
195 | - foreach($items as $itemId => $item) { |
|
195 | + foreach( $items as $itemId => $item ) { |
|
196 | 196 | $this->assertEquals( $itemId, $item->getId() ); |
197 | 197 | } |
198 | 198 | } |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | |
201 | 201 | public function testGetSubManager() |
202 | 202 | { |
203 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type') ); |
|
204 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type', 'Standard') ); |
|
203 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type' ) ); |
|
204 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type', 'Standard' ) ); |
|
205 | 205 | |
206 | 206 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
207 | - $this->object->getSubManager('unknown'); |
|
207 | + $this->object->getSubManager( 'unknown' ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | public function testGetSubManagerInvalidName() |
212 | 212 | { |
213 | 213 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
214 | - $this->object->getSubManager('type', 'unknown'); |
|
214 | + $this->object->getSubManager( 'type', 'unknown' ); |
|
215 | 215 | } |
216 | 216 | } |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->editor = \TestHelperMShop::getContext()->getEditor(); |
21 | 21 | $manager = \Aimeos\MShop\Attribute\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 |
||
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 |
||
90 | 90 | { |
91 | 91 | $search = $this->object->createSearch(); |
92 | 92 | $search->setConditions( $search->compare( '==', 'attribute.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() ); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
174 | 174 | $search->setSortations( [$search->sort( '-', 'attribute.property.type.position' )] ); |
175 | 175 | $search->setSlice( 0, 2 ); |
176 | - $items = $this->object->searchItems( $search, [], $total); |
|
176 | + $items = $this->object->searchItems( $search, [], $total ); |
|
177 | 177 | |
178 | 178 | $this->assertEquals( 2, count( $items ) ); |
179 | 179 | $this->assertEquals( 3, $total ); |
@@ -190,6 +190,6 @@ discard block |
||
190 | 190 | public function testGetSubManager() |
191 | 191 | { |
192 | 192 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
193 | - $this->object->getSubManager('unknown'); |
|
193 | + $this->object->getSubManager( 'unknown' ); |
|
194 | 194 | } |
195 | 195 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $search->setConditions( $search->compare( '==', 'media.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 |
||
109 | 109 | { |
110 | 110 | $search = $this->object->createSearch(); |
111 | 111 | $conditions = array( |
112 | - $search->compare( '~=', 'media.property.value', '1024'), |
|
112 | + $search->compare( '~=', 'media.property.value', '1024' ), |
|
113 | 113 | $search->compare( '==', 'media.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 media property item found for value "%1$s".', '1024' ) ); |
120 | 120 | } |
121 | 121 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $expr[] = $search->compare( '>=', 'media.property.type.ctime', '1970-01-01 00:00:00' ); |
167 | 167 | $expr[] = $search->compare( '==', 'media.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 |
||
177 | 177 | $search->compare( '==', 'media.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( 3, $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 |
||
191 | 191 | |
192 | 192 | public function testGetSubManager() |
193 | 193 | { |
194 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type') ); |
|
195 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type', 'Standard') ); |
|
194 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type' ) ); |
|
195 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type', 'Standard' ) ); |
|
196 | 196 | |
197 | 197 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
198 | - $this->object->getSubManager('unknown'); |
|
198 | + $this->object->getSubManager( 'unknown' ); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | public function testGetSubManagerInvalidName() |
203 | 203 | { |
204 | 204 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
205 | - $this->object->getSubManager('type', 'unknown'); |
|
205 | + $this->object->getSubManager( 'type', 'unknown' ); |
|
206 | 206 | } |
207 | 207 | } |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->editor = \TestHelperMShop::getContext()->getEditor(); |
21 | 21 | $manager = \Aimeos\MShop\Media\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 |
||
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 |
||
90 | 90 | { |
91 | 91 | $search = $this->object->createSearch(); |
92 | 92 | $search->setConditions( $search->compare( '==', 'media.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() ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $expr[] = $search->compare( '>=', 'media.property.type.ctime', '1970-01-01 00:00:00' ); |
158 | 158 | $expr[] = $search->compare( '==', 'media.property.type.editor', $this->editor ); |
159 | 159 | |
160 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
160 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
161 | 161 | $results = $this->object->searchItems( $search, [], $total ); |
162 | 162 | $this->assertEquals( 1, count( $results ) ); |
163 | 163 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | $search->compare( '=~', 'media.property.type.code', '' ), |
168 | 168 | $search->compare( '==', 'media.property.type.editor', $this->editor ) |
169 | 169 | ); |
170 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
170 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
171 | 171 | $search->setSortations( [$search->sort( '-', 'media.property.type.position' )] ); |
172 | - $search->setSlice(0, 1); |
|
173 | - $items = $this->object->searchItems( $search, [], $total); |
|
172 | + $search->setSlice( 0, 1 ); |
|
173 | + $items = $this->object->searchItems( $search, [], $total ); |
|
174 | 174 | |
175 | 175 | $this->assertEquals( 1, count( $items ) ); |
176 | 176 | $this->assertEquals( 3, $total ); |
177 | 177 | |
178 | - foreach($items as $itemId => $item) { |
|
178 | + foreach( $items as $itemId => $item ) { |
|
179 | 179 | $this->assertEquals( $itemId, $item->getId() ); |
180 | 180 | } |
181 | 181 | } |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | public function testGetSubManager() |
185 | 185 | { |
186 | 186 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
187 | - $this->object->getSubManager('unknown'); |
|
187 | + $this->object->getSubManager( 'unknown' ); |
|
188 | 188 | } |
189 | 189 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
83 | 83 | $results = $this->object->searchItems( $search ); |
84 | 84 | |
85 | - if( ( $item = reset($results) ) === false ) { |
|
85 | + if( ( $item = reset( $results ) ) === false ) { |
|
86 | 86 | throw new \RuntimeException( 'No list item found' ); |
87 | 87 | } |
88 | 88 | |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | |
94 | 94 | public function testGetSubManager() |
95 | 95 | { |
96 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type') ); |
|
97 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('type', 'Standard') ); |
|
96 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type' ) ); |
|
97 | + $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'type', 'Standard' ) ); |
|
98 | 98 | |
99 | 99 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
100 | - $this->object->getSubManager('unknown'); |
|
100 | + $this->object->getSubManager( 'unknown' ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | throw new \RuntimeException( 'No item found' ); |
125 | 125 | } |
126 | 126 | |
127 | - $item->setId(null); |
|
127 | + $item->setId( null ); |
|
128 | 128 | $item->setDomain( 'unittest' ); |
129 | 129 | $resultSaved = $this->object->saveItem( $item ); |
130 | 130 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -303,25 +303,25 @@ discard block |
||
303 | 303 | $expr[] = $search->compare( '>=', 'supplier.lists.ctime', '1970-01-01 00:00:00' ); |
304 | 304 | $expr[] = $search->compare( '==', 'supplier.lists.editor', $this->editor ); |
305 | 305 | |
306 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
306 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
307 | 307 | $results = $this->object->searchItems( $search, [], $total ); |
308 | 308 | $this->assertEquals( 1, count( $results ) ); |
309 | 309 | |
310 | 310 | |
311 | 311 | //search with base criteria |
312 | - $search = $this->object->createSearch(true); |
|
312 | + $search = $this->object->createSearch( true ); |
|
313 | 313 | $expr = array( |
314 | 314 | $search->compare( '==', 'supplier.lists.domain', 'text' ), |
315 | 315 | $search->compare( '==', 'supplier.lists.editor', $this->editor ), |
316 | 316 | $search->getConditions(), |
317 | 317 | ); |
318 | 318 | $search->setConditions( $search->combine( '&&', $expr ) ); |
319 | - $search->setSlice(0, 1); |
|
320 | - $results = $this->object->searchItems($search, [], $total); |
|
319 | + $search->setSlice( 0, 1 ); |
|
320 | + $results = $this->object->searchItems( $search, [], $total ); |
|
321 | 321 | $this->assertEquals( 1, count( $results ) ); |
322 | 322 | $this->assertEquals( 3, $total ); |
323 | 323 | |
324 | - foreach($results as $itemId => $item) { |
|
324 | + foreach( $results as $itemId => $item ) { |
|
325 | 325 | $this->assertEquals( $itemId, $item->getId() ); |
326 | 326 | } |
327 | 327 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | public function testGetItem() |
54 | 54 | { |
55 | 55 | $search = $this->object->createSearch(); |
56 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
57 | - $results = $this->object->searchItems($search); |
|
56 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
57 | + $results = $this->object->searchItems( $search ); |
|
58 | 58 | |
59 | - if( ( $expected = reset($results) ) === false ) { |
|
59 | + if( ( $expected = reset( $results ) ) === false ) { |
|
60 | 60 | throw new \RuntimeException( 'No attribute list type item found' ); |
61 | 61 | } |
62 | 62 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | public function testSaveUpdateDeleteItem() |
75 | 75 | { |
76 | 76 | $search = $this->object->createSearch(); |
77 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
78 | - $results = $this->object->searchItems($search); |
|
77 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
78 | + $results = $this->object->searchItems( $search ); |
|
79 | 79 | |
80 | - if( ( $item = reset($results) ) === false ) { |
|
80 | + if( ( $item = reset( $results ) ) === false ) { |
|
81 | 81 | throw new \RuntimeException( 'No type item found' ); |
82 | 82 | } |
83 | 83 | |
84 | - $item->setId(null); |
|
84 | + $item->setId( null ); |
|
85 | 85 | $item->setCode( 'unitTestSave' ); |
86 | 86 | $resultSaved = $this->object->saveItem( $item ); |
87 | 87 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | $expr[] = $search->compare( '>=', 'supplier.lists.type.ctime', '1970-01-01 00:00:00' ); |
142 | 142 | $expr[] = $search->compare( '==', 'supplier.lists.type.editor', $this->editor ); |
143 | 143 | |
144 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
144 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
145 | 145 | $search->setSortations( [$search->sort( '-', 'supplier.lists.type.position' )] ); |
146 | - $search->setSlice(0, 1); |
|
146 | + $search->setSlice( 0, 1 ); |
|
147 | 147 | $results = $this->object->searchItems( $search, [], $total ); |
148 | 148 | $this->assertEquals( 1, count( $results ) ); |
149 | 149 | $this->assertEquals( 1, $total ); |
150 | 150 | |
151 | - foreach($results as $itemId => $item) { |
|
151 | + foreach( $results as $itemId => $item ) { |
|
152 | 152 | $this->assertEquals( $itemId, $item->getId() ); |
153 | 153 | } |
154 | 154 | } |
@@ -157,6 +157,6 @@ discard block |
||
157 | 157 | public function testGetSubManager() |
158 | 158 | { |
159 | 159 | $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
160 | - $this->object->getSubManager('unknown'); |
|
160 | + $this->object->getSubManager( 'unknown' ); |
|
161 | 161 | } |
162 | 162 | } |
@@ -237,7 +237,9 @@ discard block |
||
237 | 237 | $this->assertEquals( '123', $this->object->getUserId() ); |
238 | 238 | $this->assertInstanceOf( \Aimeos\MShop\Context\Item\Iface::class, $return ); |
239 | 239 | |
240 | - $return = $this->object->setUserId( function() { return 456; } ); |
|
240 | + $return = $this->object->setUserId( function() |
|
241 | + { |
|
242 | +return 456; } ); |
|
241 | 243 | $this->assertEquals( '456', $this->object->getUserId() ); |
242 | 244 | $this->assertInstanceOf( \Aimeos\MShop\Context\Item\Iface::class, $return ); |
243 | 245 | } |
@@ -250,7 +252,9 @@ discard block |
||
250 | 252 | $this->assertEquals( array( '123' ), $this->object->getGroupIds() ); |
251 | 253 | $this->assertInstanceOf( \Aimeos\MShop\Context\Item\Iface::class, $return ); |
252 | 254 | |
253 | - $return = $this->object->setGroupIds( function() { return array( 456 ); } ); |
|
255 | + $return = $this->object->setGroupIds( function() |
|
256 | + { |
|
257 | +return array( 456 ); } ); |
|
254 | 258 | $this->assertEquals( array( '456' ), $this->object->getGroupIds() ); |
255 | 259 | $this->assertInstanceOf( \Aimeos\MShop\Context\Item\Iface::class, $return ); |
256 | 260 | } |