@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | protected function tearDown() |
24 | 24 | { |
25 | - unset( $this->object ); |
|
25 | + unset($this->object); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | public function testGetEzUser() |
30 | 30 | { |
31 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
31 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
32 | 32 | $this->object->getEzUser(); |
33 | 33 | } |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | public function testSetEzUser() |
37 | 37 | { |
38 | 38 | $closure = function() {}; |
39 | - $return = $this->object->setEzUser( $closure ); |
|
39 | + $return = $this->object->setEzUser($closure); |
|
40 | 40 | |
41 | - $this->assertSame( $closure, $this->object->getEzUser() ); |
|
42 | - $this->assertInstanceOf( '\Aimeos\MShop\Context\Item\Iface', $return ); |
|
41 | + $this->assertSame($closure, $this->object->getEzUser()); |
|
42 | + $this->assertInstanceOf('\Aimeos\MShop\Context\Item\Iface', $return); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -20,43 +20,43 @@ discard block |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelper::getContext(); |
22 | 22 | $this->editor = $this->context->getEditor(); |
23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
24 | - $this->object = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'Ezpublish'); |
|
24 | + $this->object = $manager->getSubManager('lists', 'Ezpublish'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() |
29 | 29 | { |
30 | - unset( $this->object, $this->context ); |
|
30 | + unset($this->object, $this->context); |
|
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 testAggregate() |
41 | 41 | { |
42 | - $search = $this->object->createSearch( true ); |
|
42 | + $search = $this->object->createSearch(true); |
|
43 | 43 | $expr = array( |
44 | 44 | $search->getConditions(), |
45 | - $search->compare( '==', 'customer.lists.editor', 'ai-ezpublish:unittest' ), |
|
45 | + $search->compare('==', 'customer.lists.editor', 'ai-ezpublish:unittest'), |
|
46 | 46 | ); |
47 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
47 | + $search->setConditions($search->combine('&&', $expr)); |
|
48 | 48 | |
49 | - $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
49 | + $result = $this->object->aggregate($search, 'customer.lists.domain'); |
|
50 | 50 | |
51 | - $this->assertEquals( 1, count( $result ) ); |
|
52 | - $this->assertArrayHasKey( 'text', $result ); |
|
53 | - $this->assertEquals( 4, $result['text'] ); |
|
51 | + $this->assertEquals(1, count($result)); |
|
52 | + $this->assertArrayHasKey('text', $result); |
|
53 | + $this->assertEquals(4, $result['text']); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testCreateItem() |
58 | 58 | { |
59 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
59 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | { |
65 | 65 | $search = $this->object->createSearch(); |
66 | 66 | $search->setSlice(0, 1); |
67 | - $results = $this->object->searchItems( $search ); |
|
67 | + $results = $this->object->searchItems($search); |
|
68 | 68 | |
69 | - if( ( $item = reset( $results ) ) === false ) { |
|
70 | - throw new \Exception( 'No item found' ); |
|
69 | + if (($item = reset($results)) === false) { |
|
70 | + throw new \Exception('No item found'); |
|
71 | 71 | } |
72 | 72 | |
73 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
73 | + $this->assertEquals($item, $this->object->getItem($item->getId())); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -78,144 +78,144 @@ discard block |
||
78 | 78 | { |
79 | 79 | $search = $this->object->createSearch(); |
80 | 80 | $search->setSlice(0, 1); |
81 | - $items = $this->object->searchItems( $search ); |
|
81 | + $items = $this->object->searchItems($search); |
|
82 | 82 | |
83 | - if( ( $item = reset( $items ) ) === false ) { |
|
84 | - throw new \Exception( 'No item found' ); |
|
83 | + if (($item = reset($items)) === false) { |
|
84 | + throw new \Exception('No item found'); |
|
85 | 85 | } |
86 | 86 | |
87 | - $item->setId( null ); |
|
88 | - $item->setDomain( 'unittest' ); |
|
89 | - $this->object->saveItem( $item ); |
|
90 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
87 | + $item->setId(null); |
|
88 | + $item->setDomain('unittest'); |
|
89 | + $this->object->saveItem($item); |
|
90 | + $itemSaved = $this->object->getItem($item->getId()); |
|
91 | 91 | |
92 | 92 | $itemExp = clone $itemSaved; |
93 | - $itemExp->setDomain( 'unittest2' ); |
|
94 | - $this->object->saveItem( $itemExp ); |
|
95 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
96 | - |
|
97 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
98 | - |
|
99 | - |
|
100 | - $this->assertTrue( $item->getId() !== null ); |
|
101 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
104 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
105 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
106 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
107 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
108 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
109 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
110 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
93 | + $itemExp->setDomain('unittest2'); |
|
94 | + $this->object->saveItem($itemExp); |
|
95 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
96 | + |
|
97 | + $this->object->deleteItem($itemSaved->getId()); |
|
98 | + |
|
99 | + |
|
100 | + $this->assertTrue($item->getId() !== null); |
|
101 | + $this->assertTrue($itemSaved->getType() !== null); |
|
102 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
103 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
104 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
105 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
106 | + $this->assertEquals($item->getRefId(), $itemSaved->getRefId()); |
|
107 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
108 | + $this->assertEquals($item->getDateStart(), $itemSaved->getDateStart()); |
|
109 | + $this->assertEquals($item->getDateEnd(), $itemSaved->getDateEnd()); |
|
110 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
111 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
112 | 112 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
113 | 113 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
114 | 114 | |
115 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
116 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
117 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
118 | - |
|
119 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
120 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
121 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
122 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
123 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
124 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
125 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
126 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
127 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
128 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
129 | - |
|
130 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
131 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
132 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
115 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
116 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
117 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
118 | + |
|
119 | + $this->assertTrue($itemUpd->getType() !== null); |
|
120 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
121 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
122 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
123 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
124 | + $this->assertEquals($itemExp->getRefId(), $itemUpd->getRefId()); |
|
125 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
126 | + $this->assertEquals($itemExp->getDateStart(), $itemUpd->getDateStart()); |
|
127 | + $this->assertEquals($itemExp->getDateEnd(), $itemUpd->getDateEnd()); |
|
128 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
129 | + |
|
130 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
131 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
132 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
133 | 133 | |
134 | 134 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
135 | - $this->object->getItem( $itemSaved->getId() ); |
|
135 | + $this->object->getItem($itemSaved->getId()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
139 | 139 | public function testMoveItemLastToFront() |
140 | 140 | { |
141 | 141 | $listItems = $this->getListItems(); |
142 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
142 | + $this->assertGreaterThan(1, count($listItems)); |
|
143 | 143 | |
144 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
145 | - throw new \Exception( 'No first customer list item' ); |
|
144 | + if (($first = reset($listItems)) === false) { |
|
145 | + throw new \Exception('No first customer list item'); |
|
146 | 146 | } |
147 | 147 | |
148 | - if( ( $last = end( $listItems ) ) === false ) { |
|
149 | - throw new \Exception( 'No last customer list item' ); |
|
148 | + if (($last = end($listItems)) === false) { |
|
149 | + throw new \Exception('No last customer list item'); |
|
150 | 150 | } |
151 | 151 | |
152 | - $this->object->moveItem( $last->getId(), $first->getId() ); |
|
152 | + $this->object->moveItem($last->getId(), $first->getId()); |
|
153 | 153 | |
154 | - $newFirst = $this->object->getItem( $last->getId() ); |
|
155 | - $newSecond = $this->object->getItem( $first->getId() ); |
|
154 | + $newFirst = $this->object->getItem($last->getId()); |
|
155 | + $newSecond = $this->object->getItem($first->getId()); |
|
156 | 156 | |
157 | - $this->object->moveItem( $last->getId() ); |
|
157 | + $this->object->moveItem($last->getId()); |
|
158 | 158 | |
159 | - $this->assertEquals( 0, $newFirst->getPosition() ); |
|
160 | - $this->assertEquals( 1, $newSecond->getPosition() ); |
|
159 | + $this->assertEquals(0, $newFirst->getPosition()); |
|
160 | + $this->assertEquals(1, $newSecond->getPosition()); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | 164 | public function testMoveItemFirstToLast() |
165 | 165 | { |
166 | 166 | $listItems = $this->getListItems(); |
167 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
167 | + $this->assertGreaterThan(1, count($listItems)); |
|
168 | 168 | |
169 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
170 | - throw new \Exception( 'No first customer list item' ); |
|
169 | + if (($first = reset($listItems)) === false) { |
|
170 | + throw new \Exception('No first customer list item'); |
|
171 | 171 | } |
172 | 172 | |
173 | - if( ( $second = next( $listItems ) ) === false ) { |
|
174 | - throw new \Exception( 'No second customer list item' ); |
|
173 | + if (($second = next($listItems)) === false) { |
|
174 | + throw new \Exception('No second customer list item'); |
|
175 | 175 | } |
176 | 176 | |
177 | - if( ( $last = end( $listItems ) ) === false ) { |
|
178 | - throw new \Exception( 'No last customer list item' ); |
|
177 | + if (($last = end($listItems)) === false) { |
|
178 | + throw new \Exception('No last customer list item'); |
|
179 | 179 | } |
180 | 180 | |
181 | - $this->object->moveItem( $first->getId() ); |
|
181 | + $this->object->moveItem($first->getId()); |
|
182 | 182 | |
183 | - $newBefore = $this->object->getItem( $last->getId() ); |
|
184 | - $newLast = $this->object->getItem( $first->getId() ); |
|
183 | + $newBefore = $this->object->getItem($last->getId()); |
|
184 | + $newLast = $this->object->getItem($first->getId()); |
|
185 | 185 | |
186 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
186 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
187 | 187 | |
188 | - $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
189 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
188 | + $this->assertEquals($last->getPosition() - 1, $newBefore->getPosition()); |
|
189 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | 193 | public function testMoveItemFirstUp() |
194 | 194 | { |
195 | 195 | $listItems = $this->getListItems(); |
196 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
196 | + $this->assertGreaterThan(1, count($listItems)); |
|
197 | 197 | |
198 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
199 | - throw new \Exception( 'No first customer list item' ); |
|
198 | + if (($first = reset($listItems)) === false) { |
|
199 | + throw new \Exception('No first customer list item'); |
|
200 | 200 | } |
201 | 201 | |
202 | - if( ( $second = next( $listItems ) ) === false ) { |
|
203 | - throw new \Exception( 'No second customer list item' ); |
|
202 | + if (($second = next($listItems)) === false) { |
|
203 | + throw new \Exception('No second customer list item'); |
|
204 | 204 | } |
205 | 205 | |
206 | - if( ( $last = end( $listItems ) ) === false ) { |
|
207 | - throw new \Exception( 'No last customer list item' ); |
|
206 | + if (($last = end($listItems)) === false) { |
|
207 | + throw new \Exception('No last customer list item'); |
|
208 | 208 | } |
209 | 209 | |
210 | - $this->object->moveItem( $first->getId(), $last->getId() ); |
|
210 | + $this->object->moveItem($first->getId(), $last->getId()); |
|
211 | 211 | |
212 | - $newLast = $this->object->getItem( $last->getId() ); |
|
213 | - $newUp = $this->object->getItem( $first->getId() ); |
|
212 | + $newLast = $this->object->getItem($last->getId()); |
|
213 | + $newUp = $this->object->getItem($first->getId()); |
|
214 | 214 | |
215 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
215 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
216 | 216 | |
217 | - $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
218 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
217 | + $this->assertEquals($last->getPosition() - 1, $newUp->getPosition()); |
|
218 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,39 +225,39 @@ discard block |
||
225 | 225 | $search = $this->object->createSearch(); |
226 | 226 | |
227 | 227 | $expr = array(); |
228 | - $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
229 | - $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
230 | - $expr[] = $search->compare( '!=', 'customer.lists.parentid', null ); |
|
231 | - $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
232 | - $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
233 | - $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
234 | - $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
235 | - $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
236 | - $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
237 | - $expr[] = $search->compare( '>', 'customer.lists.position', 0 ); |
|
238 | - $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
239 | - $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
240 | - $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
241 | - $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
242 | - |
|
243 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
244 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
245 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
246 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
247 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
248 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
249 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
250 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
251 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
252 | - |
|
253 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
228 | + $expr[] = $search->compare('!=', 'customer.lists.id', null); |
|
229 | + $expr[] = $search->compare('!=', 'customer.lists.siteid', null); |
|
230 | + $expr[] = $search->compare('!=', 'customer.lists.parentid', null); |
|
231 | + $expr[] = $search->compare('==', 'customer.lists.domain', 'text'); |
|
232 | + $expr[] = $search->compare('>', 'customer.lists.typeid', 0); |
|
233 | + $expr[] = $search->compare('>', 'customer.lists.refid', 0); |
|
234 | + $expr[] = $search->compare('==', 'customer.lists.datestart', '2010-01-01 00:00:00'); |
|
235 | + $expr[] = $search->compare('==', 'customer.lists.dateend', '2100-01-01 00:00:00'); |
|
236 | + $expr[] = $search->compare('!=', 'customer.lists.config', null); |
|
237 | + $expr[] = $search->compare('>', 'customer.lists.position', 0); |
|
238 | + $expr[] = $search->compare('==', 'customer.lists.status', 1); |
|
239 | + $expr[] = $search->compare('>=', 'customer.lists.mtime', '1970-01-01 00:00:00'); |
|
240 | + $expr[] = $search->compare('>=', 'customer.lists.ctime', '1970-01-01 00:00:00'); |
|
241 | + $expr[] = $search->compare('==', 'customer.lists.editor', $this->editor); |
|
242 | + |
|
243 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
244 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
245 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
246 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
247 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
248 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
249 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
250 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
251 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
252 | + |
|
253 | + $search->setConditions($search->combine('&&', $expr)); |
|
254 | 254 | $search->setSlice(0, 2); |
255 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
256 | - $this->assertEquals( 2, count( $results ) ); |
|
257 | - $this->assertEquals( 3, $total ); |
|
255 | + $results = $this->object->searchItems($search, array(), $total); |
|
256 | + $this->assertEquals(2, count($results)); |
|
257 | + $this->assertEquals(3, $total); |
|
258 | 258 | |
259 | - foreach($results as $itemId => $item) { |
|
260 | - $this->assertEquals( $itemId, $item->getId() ); |
|
259 | + foreach ($results as $itemId => $item) { |
|
260 | + $this->assertEquals($itemId, $item->getId()); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | public function testSearchItemsNoCriteria() |
266 | 266 | { |
267 | 267 | $search = $this->object->createSearch(); |
268 | - $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
269 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
268 | + $search->setConditions($search->compare('==', 'customer.lists.editor', $this->editor)); |
|
269 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -274,48 +274,48 @@ discard block |
||
274 | 274 | { |
275 | 275 | $search = $this->object->createSearch(true); |
276 | 276 | $conditions = array( |
277 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
277 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
278 | 278 | $search->getConditions() |
279 | 279 | ); |
280 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
281 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
280 | + $search->setConditions($search->combine('&&', $conditions)); |
|
281 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
285 | 285 | public function testGetSubManager() |
286 | 286 | { |
287 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
288 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
287 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
288 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
289 | 289 | |
290 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
291 | - $this->object->getSubManager( 'unknown' ); |
|
290 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
291 | + $this->object->getSubManager('unknown'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | 295 | protected function getListItems() |
296 | 296 | { |
297 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
297 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'Ezpublish'); |
|
298 | 298 | |
299 | 299 | $search = $manager->createSearch(); |
300 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC003' ) ); |
|
301 | - $search->setSlice( 0, 1 ); |
|
300 | + $search->setConditions($search->compare('==', 'customer.code', 'UTC003')); |
|
301 | + $search->setSlice(0, 1); |
|
302 | 302 | |
303 | - $results = $manager->searchItems( $search ); |
|
303 | + $results = $manager->searchItems($search); |
|
304 | 304 | |
305 | - if( ( $item = reset( $results ) ) === false ) { |
|
306 | - throw new \Exception( 'No customer item found' ); |
|
305 | + if (($item = reset($results)) === false) { |
|
306 | + throw new \Exception('No customer item found'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | $search = $this->object->createSearch(); |
310 | 310 | $expr = array( |
311 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
312 | - $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
313 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
314 | - $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
311 | + $search->compare('==', 'customer.lists.parentid', $item->getId()), |
|
312 | + $search->compare('==', 'customer.lists.domain', 'text'), |
|
313 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
314 | + $search->compare('==', 'customer.lists.type.code', 'default'), |
|
315 | 315 | ); |
316 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
317 | - $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
316 | + $search->setConditions($search->combine('&&', $expr)); |
|
317 | + $search->setSortations(array($search->sort('+', 'customer.lists.position'))); |
|
318 | 318 | |
319 | - return $this->object->searchItems( $search ); |
|
319 | + return $this->object->searchItems($search); |
|
320 | 320 | } |
321 | 321 | } |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | { |
22 | 22 | $context = \TestHelper::getContext(); |
23 | 23 | $this->editor = $context->getEditor(); |
24 | - $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
24 | + $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish($context); |
|
25 | 25 | |
26 | 26 | $this->fixture = array( |
27 | 27 | 'label' => 'unitTest', |
28 | 28 | 'status' => 2, |
29 | 29 | ); |
30 | 30 | |
31 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
31 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() |
36 | 36 | { |
37 | - unset( $this->object, $this->fixture, $this->address ); |
|
37 | + unset($this->object, $this->fixture, $this->address); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | public function testCleanup() |
42 | 42 | { |
43 | - $this->object->cleanup( array( -1 ) ); |
|
43 | + $this->object->cleanup(array( -1 )); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetSearchAttributes() |
48 | 48 | { |
49 | - foreach( $this->object->getSearchAttributes() as $attribute ) |
|
49 | + foreach ($this->object->getSearchAttributes() as $attribute) |
|
50 | 50 | { |
51 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
51 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | public function testCreateItem() |
57 | 57 | { |
58 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem() ); |
|
58 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | { |
64 | 64 | $search = $this->object->createSearch(); |
65 | 65 | $conditions = array( |
66 | - $search->compare( '==', 'customer.code', 'UTC003' ), |
|
67 | - $search->compare( '==', 'customer.editor', $this->editor ) |
|
66 | + $search->compare('==', 'customer.code', 'UTC003'), |
|
67 | + $search->compare('==', 'customer.editor', $this->editor) |
|
68 | 68 | ); |
69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
70 | - $items = $this->object->searchItems( $search, array( 'text' ) ); |
|
69 | + $search->setConditions($search->combine('&&', $conditions)); |
|
70 | + $items = $this->object->searchItems($search, array('text')); |
|
71 | 71 | |
72 | - if( ( $expected = reset( $items ) ) === false ) { |
|
73 | - throw new \Exception( 'No customer item with code "UTC003" found' ); |
|
72 | + if (($expected = reset($items)) === false) { |
|
73 | + throw new \Exception('No customer item with code "UTC003" found'); |
|
74 | 74 | } |
75 | 75 | |
76 | - $actual = $this->object->getItem( $expected->getId(), array( 'text' ) ); |
|
76 | + $actual = $this->object->getItem($expected->getId(), array('text')); |
|
77 | 77 | |
78 | - $this->assertEquals( $expected, $actual ); |
|
79 | - $this->assertEquals( 3, count( $actual->getListItems( 'text' ) ) ); |
|
80 | - $this->assertEquals( 3, count( $actual->getRefItems( 'text' ) ) ); |
|
78 | + $this->assertEquals($expected, $actual); |
|
79 | + $this->assertEquals(3, count($actual->getListItems('text'))); |
|
80 | + $this->assertEquals(3, count($actual->getRefItems('text'))); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -85,54 +85,54 @@ discard block |
||
85 | 85 | { |
86 | 86 | $item = $this->object->createItem(); |
87 | 87 | |
88 | - $item->setCode( 'unitTest' ); |
|
89 | - $item->setLabel( 'unitTest' ); |
|
90 | - $this->object->saveItem( $item ); |
|
91 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
88 | + $item->setCode('unitTest'); |
|
89 | + $item->setLabel('unitTest'); |
|
90 | + $this->object->saveItem($item); |
|
91 | + $itemSaved = $this->object->getItem($item->getId()); |
|
92 | 92 | |
93 | 93 | $itemExp = clone $itemSaved; |
94 | - $itemExp->setCode( 'unitTest2' ); |
|
95 | - $itemExp->setLabel( 'unitTest2' ); |
|
96 | - $this->object->saveItem( $itemExp ); |
|
97 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
98 | - |
|
99 | - $this->object->deleteItem( $item->getId() ); |
|
100 | - |
|
101 | - $this->assertTrue( $item->getId() !== null ); |
|
102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
104 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
105 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
106 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
107 | - $this->assertEquals( $item->getPaymentAddress(), $itemSaved->getPaymentAddress() ); |
|
108 | - $this->assertEquals( $item->getBirthday(), $itemSaved->getBirthday() ); |
|
109 | - $this->assertEquals( $item->getPassword(), $itemSaved->getPassword() ); |
|
110 | - |
|
111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
112 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
113 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
114 | - |
|
115 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
116 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
117 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
118 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
119 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
120 | - $this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() ); |
|
121 | - $this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() ); |
|
122 | - $this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() ); |
|
123 | - |
|
124 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
125 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
126 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
127 | - |
|
128 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
129 | - $this->object->getItem( $item->getId() ); |
|
94 | + $itemExp->setCode('unitTest2'); |
|
95 | + $itemExp->setLabel('unitTest2'); |
|
96 | + $this->object->saveItem($itemExp); |
|
97 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
98 | + |
|
99 | + $this->object->deleteItem($item->getId()); |
|
100 | + |
|
101 | + $this->assertTrue($item->getId() !== null); |
|
102 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
103 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
104 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
105 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
106 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
107 | + $this->assertEquals($item->getPaymentAddress(), $itemSaved->getPaymentAddress()); |
|
108 | + $this->assertEquals($item->getBirthday(), $itemSaved->getBirthday()); |
|
109 | + $this->assertEquals($item->getPassword(), $itemSaved->getPassword()); |
|
110 | + |
|
111 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
112 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
113 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
114 | + |
|
115 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
116 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
117 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
118 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
119 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
120 | + $this->assertEquals($itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress()); |
|
121 | + $this->assertEquals($itemExp->getBirthday(), $itemUpd->getBirthday()); |
|
122 | + $this->assertEquals($itemExp->getPassword(), $itemUpd->getPassword()); |
|
123 | + |
|
124 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
125 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
126 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
127 | + |
|
128 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
129 | + $this->object->getItem($item->getId()); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | public function testCreateSearch() |
134 | 134 | { |
135 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
135 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -142,65 +142,65 @@ discard block |
||
142 | 142 | $search = $this->object->createSearch(); |
143 | 143 | |
144 | 144 | $expr = array(); |
145 | - $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
146 | - $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
147 | - $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
148 | - |
|
149 | - $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
150 | - $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
151 | - $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
152 | - $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
153 | - $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
154 | - $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
155 | - $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
156 | - $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
157 | - $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
158 | - $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
159 | - $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
160 | - $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
161 | - $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
162 | - $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
163 | - $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
164 | - $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
165 | - $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
166 | - $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
167 | - |
|
168 | - $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
169 | - $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
170 | - $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
171 | - $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
172 | - $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
173 | - $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
174 | - |
|
175 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
176 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
177 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
178 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
179 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
180 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
181 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
182 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
183 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
184 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
185 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
186 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
187 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
188 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
189 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
190 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
191 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
192 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
193 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
194 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
195 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
196 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
197 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
198 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
199 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
200 | - |
|
201 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
202 | - $result = $this->object->searchItems( $search, array(), $total ); |
|
203 | - $this->assertEquals( 1, count( $result ) ); |
|
145 | + $expr[] = $search->compare('!=', 'customer.id', null); |
|
146 | + $expr[] = $search->compare('==', 'customer.label', 'UTC002'); |
|
147 | + $expr[] = $search->compare('==', 'customer.code', 'UTC002'); |
|
148 | + |
|
149 | + $expr[] = $search->compare('>=', 'customer.salutation', ''); |
|
150 | + $expr[] = $search->compare('>=', 'customer.company', ''); |
|
151 | + $expr[] = $search->compare('>=', 'customer.vatid', ''); |
|
152 | + $expr[] = $search->compare('>=', 'customer.title', ''); |
|
153 | + $expr[] = $search->compare('>=', 'customer.firstname', ''); |
|
154 | + $expr[] = $search->compare('>=', 'customer.lastname', ''); |
|
155 | + $expr[] = $search->compare('>=', 'customer.address1', ''); |
|
156 | + $expr[] = $search->compare('>=', 'customer.address2', ''); |
|
157 | + $expr[] = $search->compare('>=', 'customer.address3', ''); |
|
158 | + $expr[] = $search->compare('>=', 'customer.postal', ''); |
|
159 | + $expr[] = $search->compare('>=', 'customer.city', ''); |
|
160 | + $expr[] = $search->compare('>=', 'customer.state', ''); |
|
161 | + $expr[] = $search->compare('!=', 'customer.languageid', null); |
|
162 | + $expr[] = $search->compare('>=', 'customer.countryid', ''); |
|
163 | + $expr[] = $search->compare('>=', 'customer.telephone', ''); |
|
164 | + $expr[] = $search->compare('>=', 'customer.email', ''); |
|
165 | + $expr[] = $search->compare('>=', 'customer.telefax', ''); |
|
166 | + $expr[] = $search->compare('>=', 'customer.website', ''); |
|
167 | + |
|
168 | + $expr[] = $search->compare('==', 'customer.birthday', '1970-01-01'); |
|
169 | + $expr[] = $search->compare('>=', 'customer.password', ''); |
|
170 | + $expr[] = $search->compare('==', 'customer.status', 0); |
|
171 | + $expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00'); |
|
172 | + $expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00'); |
|
173 | + $expr[] = $search->compare('==', 'customer.editor', $this->editor); |
|
174 | + |
|
175 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
176 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
177 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
178 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
179 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
180 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
181 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
182 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
183 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
184 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
185 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
186 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
187 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
188 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
189 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
190 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
191 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
192 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
193 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
194 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
195 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
196 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
197 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
198 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
199 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
200 | + |
|
201 | + $search->setConditions($search->combine('&&', $expr)); |
|
202 | + $result = $this->object->searchItems($search, array(), $total); |
|
203 | + $this->assertEquals(1, count($result)); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -209,44 +209,44 @@ discard block |
||
209 | 209 | $total = 0; |
210 | 210 | |
211 | 211 | $search = $this->object->createSearch(); |
212 | - $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
213 | - $search->setSlice( 0, 2 ); |
|
212 | + $search->setConditions($search->compare('==', 'customer.address.editor', $this->editor)); |
|
213 | + $search->setSlice(0, 2); |
|
214 | 214 | |
215 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
216 | - $this->assertEquals( 2, count( $results ) ); |
|
217 | - $this->assertEquals( 3, $total ); |
|
215 | + $results = $this->object->searchItems($search, array(), $total); |
|
216 | + $this->assertEquals(2, count($results)); |
|
217 | + $this->assertEquals(3, $total); |
|
218 | 218 | |
219 | - foreach($results as $itemId => $item) { |
|
220 | - $this->assertEquals( $itemId, $item->getId() ); |
|
219 | + foreach ($results as $itemId => $item) { |
|
220 | + $this->assertEquals($itemId, $item->getId()); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | 224 | |
225 | 225 | public function testSearchItemsBaseCriteria() |
226 | 226 | { |
227 | - $search = $this->object->createSearch( true ); |
|
227 | + $search = $this->object->createSearch(true); |
|
228 | 228 | $conditions = array( |
229 | - $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
229 | + $search->compare('==', 'customer.address.editor', $this->editor), |
|
230 | 230 | $search->getConditions() |
231 | 231 | ); |
232 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
233 | - $this->assertEquals( 2, count( $this->object->searchItems( $search, array(), $total ) ) ); |
|
232 | + $search->setConditions($search->combine('&&', $conditions)); |
|
233 | + $this->assertEquals(2, count($this->object->searchItems($search, array(), $total))); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | 237 | public function testGetSubManager() |
238 | 238 | { |
239 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
240 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
239 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address')); |
|
240 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard')); |
|
241 | 241 | |
242 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
243 | - $this->object->getSubManager( 'unknown' ); |
|
242 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
243 | + $this->object->getSubManager('unknown'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
247 | 247 | public function testGetSubManagerInvalidName() |
248 | 248 | { |
249 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
250 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
249 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
250 | + $this->object->getSubManager('address', 'unknown'); |
|
251 | 251 | } |
252 | 252 | } |
@@ -4,17 +4,17 @@ |
||
4 | 4 | * Set error reporting to maximum |
5 | 5 | */ |
6 | 6 | error_reporting( -1 ); |
7 | -ini_set( 'display_errors', true ); |
|
7 | +ini_set('display_errors', true); |
|
8 | 8 | |
9 | -date_default_timezone_set( 'UTC' ); |
|
9 | +date_default_timezone_set('UTC'); |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Set locale settings to reasonable defaults |
13 | 13 | */ |
14 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
15 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
16 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
17 | -setlocale( LC_TIME, 'POSIX' ); |
|
14 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
15 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
16 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
17 | +setlocale(LC_TIME, 'POSIX'); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | require_once 'TestHelper.php'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param \Closure $userfcn Function to create a new user and return its ID |
29 | 29 | * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls |
30 | 30 | */ |
31 | - public function setEzUser( \Closure $userfcn ) |
|
31 | + public function setEzUser(\Closure $userfcn) |
|
32 | 32 | { |
33 | 33 | $this->ezUser = $userfcn; |
34 | 34 | return $this; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getEzUser() |
44 | 44 | { |
45 | - if( !isset( $this->ezUser ) ) { |
|
46 | - throw new \Aimeos\MShop\Exception( sprintf( 'eZ user function not available' ) ); |
|
45 | + if (!isset($this->ezUser)) { |
|
46 | + throw new \Aimeos\MShop\Exception(sprintf('eZ user function not available')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return $this->ezUser; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'customer.lists.id'=> array( |
26 | 26 | 'code'=>'customer.lists.id', |
27 | 27 | 'internalcode'=>'ezuli."id"', |
28 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ), |
|
28 | + 'internaldeps' => array('LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )'), |
|
29 | 29 | 'label'=>'Customer list ID', |
30 | 30 | 'type'=> 'integer', |
31 | 31 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param array $siteids List of IDs for sites whose entries should be deleted |
135 | 135 | */ |
136 | - public function cleanup( array $siteids ) |
|
136 | + public function cleanup(array $siteids) |
|
137 | 137 | { |
138 | 138 | $path = 'mshop/customer/manager/lists/submanagers'; |
139 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) { |
|
140 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
139 | + foreach ($this->getContext()->getConfig()->get($path, array('type')) as $domain) { |
|
140 | + $this->getSubManager($domain)->cleanup($siteids); |
|
141 | 141 | } |
142 | 142 | |
143 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' ); |
|
143 | + $this->cleanupBase($siteids, 'mshop/customer/manager/lists/ezpublish/delete'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | * @param boolean $withsub Return also attributes of sub-managers if true |
151 | 151 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
152 | 152 | */ |
153 | - public function getSearchAttributes( $withsub = true ) |
|
153 | + public function getSearchAttributes($withsub = true) |
|
154 | 154 | { |
155 | 155 | $path = 'mshop/customer/manager/lists/submanagers'; |
156 | 156 | |
157 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'type' ), $withsub ); |
|
157 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('type'), $withsub); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
166 | 166 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
167 | 167 | */ |
168 | - public function getSubManager( $manager, $name = null ) |
|
168 | + public function getSubManager($manager, $name = null) |
|
169 | 169 | { |
170 | - return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
170 | + return $this->getSubManagerBase('customer', 'lists/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'customer.lists.type.id' => array( |
26 | 26 | 'code'=>'customer.lists.type.id', |
27 | 27 | 'internalcode'=>'ezulity."id"', |
28 | - 'internaldeps'=>array( 'LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )' ), |
|
28 | + 'internaldeps'=>array('LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )'), |
|
29 | 29 | 'label'=>'Customer list type ID', |
30 | 30 | 'type'=> 'integer', |
31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @param array $siteids List of IDs for sites whose entries should be deleted |
98 | 98 | */ |
99 | - public function cleanup( array $siteids ) |
|
99 | + public function cleanup(array $siteids) |
|
100 | 100 | { |
101 | 101 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
102 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
103 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
102 | + foreach ($this->getContext()->getConfig()->get($path, array()) as $domain) { |
|
103 | + $this->getSubManager($domain)->cleanup($siteids); |
|
104 | 104 | } |
105 | 105 | |
106 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/type/ezpublish/delete' ); |
|
106 | + $this->cleanupBase($siteids, 'mshop/customer/manager/lists/type/ezpublish/delete'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | * @param boolean $withsub Return also attributes of sub-managers if true |
114 | 114 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
115 | 115 | */ |
116 | - public function getSearchAttributes( $withsub = true ) |
|
116 | + public function getSearchAttributes($withsub = true) |
|
117 | 117 | { |
118 | 118 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
119 | 119 | |
120 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
|
120 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array(), $withsub); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
129 | 129 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
130 | 130 | */ |
131 | - public function getSubManager( $manager, $name = null ) |
|
131 | + public function getSubManager($manager, $name = null) |
|
132 | 132 | { |
133 | - return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
133 | + return $this->getSubManagerBase('customer', 'lists/type/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'label' => 'Customer address ID', |
27 | 27 | 'code' => 'customer.address.id', |
28 | 28 | 'internalcode' => 'ezuad."id"', |
29 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
29 | + 'internaldeps' => array('LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )'), |
|
30 | 30 | 'type' => 'integer', |
31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
32 | 32 | 'public' => false, |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param array $siteids List of IDs for sites whose entries should be deleted |
211 | 211 | */ |
212 | - public function cleanup( array $siteids ) |
|
212 | + public function cleanup(array $siteids) |
|
213 | 213 | { |
214 | 214 | $path = 'mshop/customer/manager/address/submanagers'; |
215 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
216 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
215 | + foreach ($this->getContext()->getConfig()->get($path, array()) as $domain) { |
|
216 | + $this->getSubManager($domain)->cleanup($siteids); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @param array $ids List of IDs |
225 | 225 | */ |
226 | - public function deleteItems( array $ids ) |
|
226 | + public function deleteItems(array $ids) |
|
227 | 227 | { |
228 | 228 | $path = 'mshop/customer/manager/address/ezpublish/delete'; |
229 | - $this->deleteItemsBase( $ids, $path, false ); |
|
229 | + $this->deleteItemsBase($ids, $path, false); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @param boolean $withsub Return also attributes of sub-managers if true |
237 | 237 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
238 | 238 | */ |
239 | - public function getSearchAttributes( $withsub = true ) |
|
239 | + public function getSearchAttributes($withsub = true) |
|
240 | 240 | { |
241 | 241 | $path = 'mshop/customer/manager/address/submanagers'; |
242 | 242 | |
243 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
|
243 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array(), $withsub); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
252 | 252 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
253 | 253 | */ |
254 | - public function getSubManager( $manager, $name = null ) |
|
254 | + public function getSubManager($manager, $name = null) |
|
255 | 255 | { |
256 | - return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
256 | + return $this->getSubManagerBase('customer', 'address/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function getPostDependencies() |
23 | 23 | { |
24 | - return array( 'MShopAddTypeData' ); |
|
24 | + return array('MShopAddTypeData'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function migrate() |
32 | 32 | { |
33 | - $this->msg( 'Creating Aimeos ezPublish tables', 0 ); |
|
34 | - $this->status( '' ); |
|
33 | + $this->msg('Creating Aimeos ezPublish tables', 0); |
|
34 | + $this->status(''); |
|
35 | 35 | |
36 | 36 | $ds = DIRECTORY_SEPARATOR; |
37 | 37 | |
38 | 38 | $files = array( |
39 | - 'db-customer' => __DIR__ . $ds . 'default' . $ds . 'schema' . $ds . 'customer.php', |
|
39 | + 'db-customer' => __DIR__.$ds.'default'.$ds.'schema'.$ds.'customer.php', |
|
40 | 40 | ); |
41 | 41 | |
42 | - $this->setupSchema( $files ); |
|
42 | + $this->setupSchema($files); |
|
43 | 43 | } |
44 | 44 | } |