@@ -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 | } |
@@ -18,14 +18,14 @@ discard block |
||
| 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 |
||
| 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,76 +50,76 @@ discard block |
||
| 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\Ezpublish(); |
| 56 | 56 | $aimeos = self::getAimeos(); |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | $paths = $aimeos->getConfigPaths(); |
| 60 | - $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
|
| 60 | + $paths[] = __DIR__.DIRECTORY_SEPARATOR.'config'; |
|
| 61 | 61 | |
| 62 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
| 63 | - $ctx->setConfig( $conf ); |
|
| 62 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
| 63 | + $ctx->setConfig($conf); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
| 67 | - $ctx->setDatabaseManager( $dbm ); |
|
| 66 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($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::createManager( $ctx ); |
|
| 87 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 86 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 87 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 88 | 88 | |
| 89 | - $ctx->setLocale( $localeItem ); |
|
| 89 | + $ctx->setLocale($localeItem); |
|
| 90 | 90 | |
| 91 | - $ctx->setEditor( 'ai-ezpublish:unittest' ); |
|
| 91 | + $ctx->setEditor('ai-ezpublish:unittest'); |
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | - $ctx->setEzUser( function( $code, $email, $password ) use ( $ctx ) { |
|
| 94 | + $ctx->setEzUser(function($code, $email, $password) use ($ctx) { |
|
| 95 | 95 | |
| 96 | - $id = mt_rand( -0x7fffffff,-1 ); |
|
| 96 | + $id = mt_rand( -0x7fffffff, -1 ); |
|
| 97 | 97 | $dbm = $ctx->getDatabaseManager(); |
| 98 | - $dbconf = $ctx->getConfig()->get( 'resource/db-customer' ); |
|
| 99 | - $dbname = ( $dbconf ? 'db-customer' : 'db' ); |
|
| 100 | - $conn = $dbm->acquire( $dbname ); |
|
| 98 | + $dbconf = $ctx->getConfig()->get('resource/db-customer'); |
|
| 99 | + $dbname = ($dbconf ? 'db-customer' : 'db'); |
|
| 100 | + $conn = $dbm->acquire($dbname); |
|
| 101 | 101 | |
| 102 | 102 | try |
| 103 | 103 | { |
| 104 | - $stmt = $conn->create( 'INSERT INTO "ezuser" ( |
|
| 104 | + $stmt = $conn->create('INSERT INTO "ezuser" ( |
|
| 105 | 105 | "contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type" |
| 106 | 106 | ) VALUES ( |
| 107 | 107 | ?, ?, ?, ?, ?, 5 |
| 108 | 108 | )' ); |
| 109 | 109 | |
| 110 | - $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 111 | - $stmt->bind( 2, $email ); |
|
| 112 | - $stmt->bind( 3, $code ); |
|
| 113 | - $stmt->bind( 4, $code ); |
|
| 114 | - $stmt->bind( 5, $password ); |
|
| 110 | + $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 111 | + $stmt->bind(2, $email); |
|
| 112 | + $stmt->bind(3, $code); |
|
| 113 | + $stmt->bind(4, $code); |
|
| 114 | + $stmt->bind(5, $password); |
|
| 115 | 115 | |
| 116 | 116 | $stmt->execute()->finish(); |
| 117 | 117 | |
| 118 | - $dbm->release( $conn, $dbname ); |
|
| 118 | + $dbm->release($conn, $dbname); |
|
| 119 | 119 | } |
| 120 | - catch( \Exception $e ) |
|
| 120 | + catch (\Exception $e) |
|
| 121 | 121 | { |
| 122 | - $dbm->release( $conn, $dbname ); |
|
| 122 | + $dbm->release($conn, $dbname); |
|
| 123 | 123 | throw $e; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -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 | |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 230 | 230 | */ |
| 231 | - public function cleanup( array $siteids ) |
|
| 231 | + public function cleanup(array $siteids) |
|
| 232 | 232 | { |
| 233 | 233 | $path = 'mshop/customer/manager/submanagers'; |
| 234 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 235 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 234 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
| 235 | + $this->getSubManager($domain)->cleanup($siteids); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @param array $ids List of IDs |
| 244 | 244 | */ |
| 245 | - public function deleteItems( array $ids ) |
|
| 245 | + public function deleteItems(array $ids) |
|
| 246 | 246 | { |
| 247 | 247 | $path = 'mshop/customer/manager/ezpublish/delete'; |
| 248 | - $this->deleteItemsBase( $ids, $path, false, 'contentobject_id' ); |
|
| 248 | + $this->deleteItemsBase($ids, $path, false, 'contentobject_id'); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 256 | 256 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 257 | 257 | */ |
| 258 | - public function getSearchAttributes( $withsub = true ) |
|
| 258 | + public function getSearchAttributes($withsub = true) |
|
| 259 | 259 | { |
| 260 | 260 | $path = 'mshop/customer/manager/submanagers'; |
| 261 | 261 | |
| 262 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 262 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -280,37 +280,37 @@ discard block |
||
| 280 | 280 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
| 281 | 281 | * @param boolean $fetch True if the new ID should be returned in the item |
| 282 | 282 | */ |
| 283 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 283 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 284 | 284 | { |
| 285 | 285 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
| 286 | - if( !( $item instanceof $iface ) ) { |
|
| 287 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 286 | + if (!($item instanceof $iface)) { |
|
| 287 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if( !$item->isModified() ) { return; } |
|
| 290 | + if (!$item->isModified()) { return; } |
|
| 291 | 291 | |
| 292 | 292 | $context = $this->getContext(); |
| 293 | 293 | |
| 294 | 294 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
| 295 | - if( !is_a( $context, $class ) ) { |
|
| 296 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
| 295 | + if (!is_a($context, $class)) { |
|
| 296 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class)); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if( $item->getId() === null ) |
|
| 299 | + if ($item->getId() === null) |
|
| 300 | 300 | { |
| 301 | 301 | $fcn = $context->getEzUser(); |
| 302 | - $contentId = $fcn( $item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword() ); |
|
| 303 | - $item->setId( $contentId ); |
|
| 302 | + $contentId = $fcn($item->getCode(), $item->getPaymentAddress()->getEmail(), $item->getPassword()); |
|
| 303 | + $item->setId($contentId); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | $dbm = $context->getDatabaseManager(); |
| 307 | 307 | $dbname = $this->getResourceName(); |
| 308 | - $conn = $dbm->acquire( $dbname ); |
|
| 308 | + $conn = $dbm->acquire($dbname); |
|
| 309 | 309 | |
| 310 | 310 | try |
| 311 | 311 | { |
| 312 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 313 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
| 312 | + $date = date('Y-m-d H:i:s'); |
|
| 313 | + $ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date); |
|
| 314 | 314 | $billingAddress = $item->getPaymentAddress(); |
| 315 | 315 | |
| 316 | 316 | /** mshop/customer/manager/ezpublish/update |
@@ -341,44 +341,44 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | $path = 'mshop/customer/manager/ezpublish/update'; |
| 343 | 343 | |
| 344 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 345 | - |
|
| 346 | - $stmt->bind( 1, $item->getCode() ); // login normalized |
|
| 347 | - $stmt->bind( 2, $item->getCode() ); // login |
|
| 348 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
| 349 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
| 350 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
| 351 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
| 352 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
| 353 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
| 354 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
| 355 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
| 356 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
| 357 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
| 358 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
| 359 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
| 360 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
| 361 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
| 362 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
| 363 | - $stmt->bind( 18, $billingAddress->getEmail() ); |
|
| 364 | - $stmt->bind( 19, $billingAddress->getTelefax() ); |
|
| 365 | - $stmt->bind( 20, $billingAddress->getWebsite() ); |
|
| 366 | - $stmt->bind( 21, $item->getBirthday() ); |
|
| 367 | - $stmt->bind( 22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 368 | - $stmt->bind( 23, $item->getDateVerified() ); |
|
| 369 | - $stmt->bind( 24, $item->getPassword() ); |
|
| 370 | - $stmt->bind( 25, $date ); // Modification time |
|
| 371 | - $stmt->bind( 26, $context->getEditor() ); |
|
| 372 | - $stmt->bind( 27, $ctime ); // Creation time |
|
| 373 | - $stmt->bind( 28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 344 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 345 | + |
|
| 346 | + $stmt->bind(1, $item->getCode()); // login normalized |
|
| 347 | + $stmt->bind(2, $item->getCode()); // login |
|
| 348 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
| 349 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
| 350 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
| 351 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
| 352 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
| 353 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
| 354 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
| 355 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
| 356 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
| 357 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
| 358 | + $stmt->bind(13, $billingAddress->getCity()); |
|
| 359 | + $stmt->bind(14, $billingAddress->getState()); |
|
| 360 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
| 361 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
| 362 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
| 363 | + $stmt->bind(18, $billingAddress->getEmail()); |
|
| 364 | + $stmt->bind(19, $billingAddress->getTelefax()); |
|
| 365 | + $stmt->bind(20, $billingAddress->getWebsite()); |
|
| 366 | + $stmt->bind(21, $item->getBirthday()); |
|
| 367 | + $stmt->bind(22, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 368 | + $stmt->bind(23, $item->getDateVerified()); |
|
| 369 | + $stmt->bind(24, $item->getPassword()); |
|
| 370 | + $stmt->bind(25, $date); // Modification time |
|
| 371 | + $stmt->bind(26, $context->getEditor()); |
|
| 372 | + $stmt->bind(27, $ctime); // Creation time |
|
| 373 | + $stmt->bind(28, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 374 | 374 | |
| 375 | 375 | $stmt->execute()->finish(); |
| 376 | 376 | |
| 377 | - $dbm->release( $conn, $dbname ); |
|
| 377 | + $dbm->release($conn, $dbname); |
|
| 378 | 378 | } |
| 379 | - catch( \Exception $e ) |
|
| 379 | + catch (\Exception $e) |
|
| 380 | 380 | { |
| 381 | - $dbm->release( $conn, $dbname ); |
|
| 381 | + $dbm->release($conn, $dbname); |
|
| 382 | 382 | throw $e; |
| 383 | 383 | } |
| 384 | 384 | } |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 393 | 393 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 394 | 394 | */ |
| 395 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 395 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null) |
|
| 396 | 396 | { |
| 397 | 397 | $dbm = $this->getContext()->getDatabaseManager(); |
| 398 | 398 | $dbname = $this->getResourceName(); |
| 399 | - $conn = $dbm->acquire( $dbname ); |
|
| 399 | + $conn = $dbm->acquire($dbname); |
|
| 400 | 400 | $map = array(); |
| 401 | 401 | |
| 402 | 402 | try |
@@ -404,22 +404,22 @@ discard block |
||
| 404 | 404 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 405 | 405 | $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
| 406 | 406 | $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
| 407 | - $required = array( 'customer' ); |
|
| 407 | + $required = array('customer'); |
|
| 408 | 408 | |
| 409 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 410 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 411 | - $map[ $row['customer.id'] ] = $row; |
|
| 409 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 410 | + while (($row = $results->fetch()) !== false) { |
|
| 411 | + $map[$row['customer.id']] = $row; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - $dbm->release( $conn, $dbname ); |
|
| 414 | + $dbm->release($conn, $dbname); |
|
| 415 | 415 | } |
| 416 | - catch( \Exception $e ) |
|
| 416 | + catch (\Exception $e) |
|
| 417 | 417 | { |
| 418 | - $dbm->release( $conn, $dbname ); |
|
| 418 | + $dbm->release($conn, $dbname); |
|
| 419 | 419 | throw $e; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
| 422 | + return $this->buildItems($map, $ref, 'customer'); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 431 | 431 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 432 | 432 | */ |
| 433 | - public function getSubManager( $manager, $name = null ) |
|
| 433 | + public function getSubManager($manager, $name = null) |
|
| 434 | 434 | { |
| 435 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 435 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | |
@@ -444,15 +444,15 @@ discard block |
||
| 444 | 444 | * @param array $refItems Items referenced by the customer item via the list items |
| 445 | 445 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 446 | 446 | */ |
| 447 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
| 447 | + protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array()) |
|
| 448 | 448 | { |
| 449 | - if( !isset( $this->addressManager ) ) { |
|
| 450 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
| 449 | + if (!isset($this->addressManager)) { |
|
| 450 | + $this->addressManager = $this->getSubManager('address'); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $helper = $this->getPasswordHelper(); |
| 454 | 454 | $address = $this->addressManager->createItem(); |
| 455 | 455 | |
| 456 | - return new \Aimeos\MShop\Customer\Item\Standard( $address, $values, $listItems, $refItems, null, $helper ); |
|
| 456 | + return new \Aimeos\MShop\Customer\Item\Standard($address, $values, $listItems, $refItems, null, $helper); |
|
| 457 | 457 | } |
| 458 | 458 | } |