@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | 'customer.address.position' => 1, |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.', $addressValues ); |
|
| 25 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.', $addressValues); |
|
| 26 | 26 | |
| 27 | 27 | $values = array( |
| 28 | 28 | 'customer.id' => 541, |
@@ -54,71 +54,71 @@ discard block |
||
| 54 | 54 | 'customer.mtime'=> '2010-01-05 00:00:05', |
| 55 | 55 | 'customer.ctime'=> '2010-01-01 00:00:00', |
| 56 | 56 | 'customer.editor' => 'unitTestUser', |
| 57 | - 'roles' => array( 'ROLE_ADMIN' ), |
|
| 57 | + 'roles' => array('ROLE_ADMIN'), |
|
| 58 | 58 | 'salt' => 'test', |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - $this->object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, $values ); |
|
| 61 | + $this->object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, $values); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | protected function tearDown() |
| 65 | 65 | { |
| 66 | - unset( $this->object ); |
|
| 66 | + unset($this->object); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function testGetPassword() |
| 70 | 70 | { |
| 71 | - $this->assertEquals( 'testpwd', $this->object->getPassword() ); |
|
| 71 | + $this->assertEquals('testpwd', $this->object->getPassword()); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function testSetPassword() |
| 75 | 75 | { |
| 76 | - $this->object->setPassword( 'new' ); |
|
| 77 | - $this->assertTrue( $this->object->isModified() ); |
|
| 78 | - $this->assertEquals( 'new', $this->object->getPassword() ); |
|
| 76 | + $this->object->setPassword('new'); |
|
| 77 | + $this->assertTrue($this->object->isModified()); |
|
| 78 | + $this->assertEquals('new', $this->object->getPassword()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function testSetPasswordGenerated() |
| 82 | 82 | { |
| 83 | - $helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard( array( 'format' => '%1$s{%2$s}' ) ); |
|
| 84 | - $object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [], [], [], null, $helper ); |
|
| 83 | + $helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard(array('format' => '%1$s{%2$s}')); |
|
| 84 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, [], [], [], null, $helper); |
|
| 85 | 85 | |
| 86 | - $object->setPassword( 'newpwd' ); |
|
| 87 | - $this->assertEquals( sha1( 'newpwd{' . $object->getSalt() . '}' ), $object->getPassword() ); |
|
| 86 | + $object->setPassword('newpwd'); |
|
| 87 | + $this->assertEquals(sha1('newpwd{' . $object->getSalt() . '}'), $object->getPassword()); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function testGetRoles() |
| 91 | 91 | { |
| 92 | - $this->assertEquals( array( 'ROLE_ADMIN' ), $this->object->getRoles() ); |
|
| 92 | + $this->assertEquals(array('ROLE_ADMIN'), $this->object->getRoles()); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function testSetRoles() |
| 96 | 96 | { |
| 97 | - $this->object->setRoles( array( 'ROLE_USER' ) ); |
|
| 98 | - $this->assertTrue( $this->object->isModified() ); |
|
| 99 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
| 97 | + $this->object->setRoles(array('ROLE_USER')); |
|
| 98 | + $this->assertTrue($this->object->isModified()); |
|
| 99 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | public function testGetSalt() |
| 103 | 103 | { |
| 104 | - $this->assertEquals( 'test', $this->object->getSalt() ); |
|
| 104 | + $this->assertEquals('test', $this->object->getSalt()); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function testGetSaltGenerated() |
| 108 | 108 | { |
| 109 | - $object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [] ); |
|
| 110 | - $this->assertEquals( 'mshop', $object->getSalt() ); |
|
| 109 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, []); |
|
| 110 | + $this->assertEquals('mshop', $object->getSalt()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public function testSetSalt() |
| 114 | 114 | { |
| 115 | - $this->object->setSalt( 'new' ); |
|
| 116 | - $this->assertTrue( $this->object->isModified() ); |
|
| 117 | - $this->assertEquals( 'new', $this->object->getSalt() ); |
|
| 115 | + $this->object->setSalt('new'); |
|
| 116 | + $this->assertTrue($this->object->isModified()); |
|
| 117 | + $this->assertEquals('new', $this->object->getSalt()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function testIsModified() |
| 121 | 121 | { |
| 122 | - $this->assertFalse( $this->object->isModified() ); |
|
| 122 | + $this->assertFalse($this->object->isModified()); |
|
| 123 | 123 | } |
| 124 | 124 | } |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $context = \TestHelper::getContext(); |
| 23 | 23 | $this->editor = $context->getEditor(); |
| 24 | - $customer = new \Aimeos\MShop\Customer\Manager\FosUser( $context ); |
|
| 24 | + $customer = new \Aimeos\MShop\Customer\Manager\FosUser($context); |
|
| 25 | 25 | |
| 26 | 26 | $search = $customer->createSearch(); |
| 27 | 27 | $conditions = array( |
| 28 | - $search->compare( '==', 'customer.code', 'UTC001' ), |
|
| 29 | - $search->compare( '==', 'customer.editor', $this->editor ) |
|
| 28 | + $search->compare('==', 'customer.code', 'UTC001'), |
|
| 29 | + $search->compare('==', 'customer.editor', $this->editor) |
|
| 30 | 30 | ); |
| 31 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 32 | - $result = $customer->searchItems( $search ); |
|
| 31 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 32 | + $result = $customer->searchItems($search); |
|
| 33 | 33 | |
| 34 | - if( ( $customerItem = reset( $result ) ) === false ) { |
|
| 35 | - throw new \RuntimeException( sprintf( 'No customer item found for code "%1$s"', 'UTC001' ) ); |
|
| 34 | + if (($customerItem = reset($result)) === false) { |
|
| 35 | + throw new \RuntimeException(sprintf('No customer item found for code "%1$s"', 'UTC001')); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $this->fixture = array( |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'customer.address.siteid' => $context->getLocale()->getSiteId(), |
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - $this->object = $customer->getSubManager( 'address', 'FosUser' ); |
|
| 64 | + $this->object = $customer->getSubManager('address', 'FosUser'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -70,130 +70,130 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | protected function tearDown() |
| 72 | 72 | { |
| 73 | - unset( $this->object, $this->fixture ); |
|
| 73 | + unset($this->object, $this->fixture); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testCleanup() |
| 78 | 78 | { |
| 79 | - $this->object->cleanup( array( -1 ) ); |
|
| 79 | + $this->object->cleanup(array( -1 )); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function testGetSearchAttributes() |
| 83 | 83 | { |
| 84 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 85 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 84 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 85 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function testGetSubManager() |
| 90 | 90 | { |
| 91 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 92 | - $this->object->getSubManager( 'unknown' ); |
|
| 91 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 92 | + $this->object->getSubManager('unknown'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function testCreateItem() |
| 96 | 96 | { |
| 97 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Address\\Iface', $this->object->createItem() ); |
|
| 97 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Address\\Iface', $this->object->createItem()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function testGetItem() |
| 101 | 101 | { |
| 102 | 102 | $search = $this->object->createSearch(); |
| 103 | - $search->setConditions( $search->compare( '~=', 'customer.address.company', 'ABC GmbH' ) ); |
|
| 103 | + $search->setConditions($search->compare('~=', 'customer.address.company', 'ABC GmbH')); |
|
| 104 | 104 | |
| 105 | - $items = $this->object->searchItems( $search ); |
|
| 105 | + $items = $this->object->searchItems($search); |
|
| 106 | 106 | |
| 107 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 108 | - throw new \RuntimeException( 'No address item with company "ABC" found' ); |
|
| 107 | + if (($item = reset($items)) === false) { |
|
| 108 | + throw new \RuntimeException('No address item with company "ABC" found'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
| 111 | + $this->assertEquals($item, $this->object->getItem($item->getId())); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function testSaveUpdateDeleteItem() |
| 115 | 115 | { |
| 116 | - $item = new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.address.', $this->fixture ); |
|
| 117 | - $item->setId( null ); |
|
| 118 | - $this->object->saveItem( $item ); |
|
| 119 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 116 | + $item = new \Aimeos\MShop\Common\Item\Address\Standard('customer.address.', $this->fixture); |
|
| 117 | + $item->setId(null); |
|
| 118 | + $this->object->saveItem($item); |
|
| 119 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 120 | 120 | |
| 121 | 121 | $itemExp = clone $itemSaved; |
| 122 | - $itemExp->setPosition( 1 ); |
|
| 123 | - $itemExp->setCity( 'Berlin' ); |
|
| 124 | - $itemExp->setState( 'Berlin' ); |
|
| 125 | - $this->object->saveItem( $itemExp ); |
|
| 126 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 127 | - |
|
| 128 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - $this->assertTrue( $item->getId() !== null ); |
|
| 132 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 133 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId()); |
|
| 134 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition()); |
|
| 135 | - $this->assertEquals( $item->getCompany(), $itemSaved->getCompany()); |
|
| 136 | - $this->assertEquals( $item->getVatID(), $itemSaved->getVatID()); |
|
| 137 | - $this->assertEquals( $item->getSalutation(), $itemSaved->getSalutation()); |
|
| 138 | - $this->assertEquals( $item->getTitle(), $itemSaved->getTitle()); |
|
| 139 | - $this->assertEquals( $item->getFirstname(), $itemSaved->getFirstname()); |
|
| 140 | - $this->assertEquals( $item->getLastname(), $itemSaved->getLastname()); |
|
| 141 | - $this->assertEquals( $item->getAddress1(), $itemSaved->getAddress1()); |
|
| 142 | - $this->assertEquals( $item->getAddress2(), $itemSaved->getAddress2()); |
|
| 143 | - $this->assertEquals( $item->getAddress3(), $itemSaved->getAddress3()); |
|
| 144 | - $this->assertEquals( $item->getPostal(), $itemSaved->getPostal()); |
|
| 145 | - $this->assertEquals( $item->getCity(), $itemSaved->getCity()); |
|
| 146 | - $this->assertEquals( $item->getState(), $itemSaved->getState()); |
|
| 147 | - $this->assertEquals( $item->getCountryId(), $itemSaved->getCountryId()); |
|
| 148 | - $this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId()); |
|
| 149 | - $this->assertEquals( $item->getTelephone(), $itemSaved->getTelephone()); |
|
| 150 | - $this->assertEquals( $item->getEmail(), $itemSaved->getEmail()); |
|
| 151 | - $this->assertEquals( $item->getTelefax(), $itemSaved->getTelefax()); |
|
| 152 | - $this->assertEquals( $item->getWebsite(), $itemSaved->getWebsite()); |
|
| 153 | - $this->assertEquals( $item->getLongitude(), $itemSaved->getLongitude()); |
|
| 154 | - $this->assertEquals( $item->getLatitude(), $itemSaved->getLatitude()); |
|
| 155 | - $this->assertEquals( $item->getFlag(), $itemSaved->getFlag()); |
|
| 156 | - |
|
| 157 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 158 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 122 | + $itemExp->setPosition(1); |
|
| 123 | + $itemExp->setCity('Berlin'); |
|
| 124 | + $itemExp->setState('Berlin'); |
|
| 125 | + $this->object->saveItem($itemExp); |
|
| 126 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 127 | + |
|
| 128 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + $this->assertTrue($item->getId() !== null); |
|
| 132 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 133 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
| 134 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
| 135 | + $this->assertEquals($item->getCompany(), $itemSaved->getCompany()); |
|
| 136 | + $this->assertEquals($item->getVatID(), $itemSaved->getVatID()); |
|
| 137 | + $this->assertEquals($item->getSalutation(), $itemSaved->getSalutation()); |
|
| 138 | + $this->assertEquals($item->getTitle(), $itemSaved->getTitle()); |
|
| 139 | + $this->assertEquals($item->getFirstname(), $itemSaved->getFirstname()); |
|
| 140 | + $this->assertEquals($item->getLastname(), $itemSaved->getLastname()); |
|
| 141 | + $this->assertEquals($item->getAddress1(), $itemSaved->getAddress1()); |
|
| 142 | + $this->assertEquals($item->getAddress2(), $itemSaved->getAddress2()); |
|
| 143 | + $this->assertEquals($item->getAddress3(), $itemSaved->getAddress3()); |
|
| 144 | + $this->assertEquals($item->getPostal(), $itemSaved->getPostal()); |
|
| 145 | + $this->assertEquals($item->getCity(), $itemSaved->getCity()); |
|
| 146 | + $this->assertEquals($item->getState(), $itemSaved->getState()); |
|
| 147 | + $this->assertEquals($item->getCountryId(), $itemSaved->getCountryId()); |
|
| 148 | + $this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId()); |
|
| 149 | + $this->assertEquals($item->getTelephone(), $itemSaved->getTelephone()); |
|
| 150 | + $this->assertEquals($item->getEmail(), $itemSaved->getEmail()); |
|
| 151 | + $this->assertEquals($item->getTelefax(), $itemSaved->getTelefax()); |
|
| 152 | + $this->assertEquals($item->getWebsite(), $itemSaved->getWebsite()); |
|
| 153 | + $this->assertEquals($item->getLongitude(), $itemSaved->getLongitude()); |
|
| 154 | + $this->assertEquals($item->getLatitude(), $itemSaved->getLatitude()); |
|
| 155 | + $this->assertEquals($item->getFlag(), $itemSaved->getFlag()); |
|
| 156 | + |
|
| 157 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 158 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 159 | 159 | $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
| 160 | 160 | |
| 161 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 162 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 163 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition()); |
|
| 164 | - $this->assertEquals( $itemExp->getCompany(), $itemUpd->getCompany()); |
|
| 165 | - $this->assertEquals( $itemExp->getVatID(), $itemUpd->getVatID()); |
|
| 166 | - $this->assertEquals( $itemExp->getSalutation(), $itemUpd->getSalutation()); |
|
| 167 | - $this->assertEquals( $itemExp->getTitle(), $itemUpd->getTitle()); |
|
| 168 | - $this->assertEquals( $itemExp->getFirstname(), $itemUpd->getFirstname()); |
|
| 169 | - $this->assertEquals( $itemExp->getLastname(), $itemUpd->getLastname()); |
|
| 170 | - $this->assertEquals( $itemExp->getAddress1(), $itemUpd->getAddress1()); |
|
| 171 | - $this->assertEquals( $itemExp->getAddress2(), $itemUpd->getAddress2()); |
|
| 172 | - $this->assertEquals( $itemExp->getAddress3(), $itemUpd->getAddress3()); |
|
| 173 | - $this->assertEquals( $itemExp->getPostal(), $itemUpd->getPostal()); |
|
| 174 | - $this->assertEquals( $itemExp->getCity(), $itemUpd->getCity()); |
|
| 175 | - $this->assertEquals( $itemExp->getState(), $itemUpd->getState()); |
|
| 176 | - $this->assertEquals( $itemExp->getCountryId(), $itemUpd->getCountryId()); |
|
| 177 | - $this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId()); |
|
| 178 | - $this->assertEquals( $itemExp->getTelephone(), $itemUpd->getTelephone()); |
|
| 179 | - $this->assertEquals( $itemExp->getEmail(), $itemUpd->getEmail()); |
|
| 180 | - $this->assertEquals( $itemExp->getTelefax(), $itemUpd->getTelefax()); |
|
| 181 | - $this->assertEquals( $itemExp->getWebsite(), $itemUpd->getWebsite()); |
|
| 182 | - $this->assertEquals( $itemExp->getLongitude(), $itemUpd->getLongitude()); |
|
| 183 | - $this->assertEquals( $itemExp->getLatitude(), $itemUpd->getLatitude()); |
|
| 184 | - $this->assertEquals( $itemExp->getFlag(), $itemUpd->getFlag()); |
|
| 185 | - |
|
| 186 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 187 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 188 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 161 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 162 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 163 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
| 164 | + $this->assertEquals($itemExp->getCompany(), $itemUpd->getCompany()); |
|
| 165 | + $this->assertEquals($itemExp->getVatID(), $itemUpd->getVatID()); |
|
| 166 | + $this->assertEquals($itemExp->getSalutation(), $itemUpd->getSalutation()); |
|
| 167 | + $this->assertEquals($itemExp->getTitle(), $itemUpd->getTitle()); |
|
| 168 | + $this->assertEquals($itemExp->getFirstname(), $itemUpd->getFirstname()); |
|
| 169 | + $this->assertEquals($itemExp->getLastname(), $itemUpd->getLastname()); |
|
| 170 | + $this->assertEquals($itemExp->getAddress1(), $itemUpd->getAddress1()); |
|
| 171 | + $this->assertEquals($itemExp->getAddress2(), $itemUpd->getAddress2()); |
|
| 172 | + $this->assertEquals($itemExp->getAddress3(), $itemUpd->getAddress3()); |
|
| 173 | + $this->assertEquals($itemExp->getPostal(), $itemUpd->getPostal()); |
|
| 174 | + $this->assertEquals($itemExp->getCity(), $itemUpd->getCity()); |
|
| 175 | + $this->assertEquals($itemExp->getState(), $itemUpd->getState()); |
|
| 176 | + $this->assertEquals($itemExp->getCountryId(), $itemUpd->getCountryId()); |
|
| 177 | + $this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId()); |
|
| 178 | + $this->assertEquals($itemExp->getTelephone(), $itemUpd->getTelephone()); |
|
| 179 | + $this->assertEquals($itemExp->getEmail(), $itemUpd->getEmail()); |
|
| 180 | + $this->assertEquals($itemExp->getTelefax(), $itemUpd->getTelefax()); |
|
| 181 | + $this->assertEquals($itemExp->getWebsite(), $itemUpd->getWebsite()); |
|
| 182 | + $this->assertEquals($itemExp->getLongitude(), $itemUpd->getLongitude()); |
|
| 183 | + $this->assertEquals($itemExp->getLatitude(), $itemUpd->getLatitude()); |
|
| 184 | + $this->assertEquals($itemExp->getFlag(), $itemUpd->getFlag()); |
|
| 185 | + |
|
| 186 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 187 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 188 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 189 | 189 | |
| 190 | 190 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 191 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 191 | + $this->object->getItem($itemSaved->getId()); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | public function testCreateSearch() |
| 195 | 195 | { |
| 196 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 196 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
@@ -202,36 +202,36 @@ discard block |
||
| 202 | 202 | $search = $this->object->createSearch(); |
| 203 | 203 | |
| 204 | 204 | $expr = []; |
| 205 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 206 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 207 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 208 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 209 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 210 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 211 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 212 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 213 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 214 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 215 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 216 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 217 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 218 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 219 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 220 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 221 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 222 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 223 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 224 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 225 | - $expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' ); |
|
| 226 | - $expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' ); |
|
| 227 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 228 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 229 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 230 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 231 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 232 | - |
|
| 233 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 234 | - $this->assertEquals( 1, count( $this->object->searchItems( $search ) ) ); |
|
| 205 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
| 206 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
| 207 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
| 208 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
| 209 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
| 210 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
| 211 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
| 212 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
| 213 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
| 214 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
| 215 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
| 216 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
| 217 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
| 218 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
| 219 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
| 220 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
| 221 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
| 222 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
| 223 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
| 224 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
| 225 | + $expr[] = $search->compare('>=', 'customer.address.longitude', '10.0'); |
|
| 226 | + $expr[] = $search->compare('>=', 'customer.address.latitude', '50.0'); |
|
| 227 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
| 228 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
| 229 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
| 230 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
| 231 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
| 232 | + |
|
| 233 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 234 | + $this->assertEquals(1, count($this->object->searchItems($search))); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -241,20 +241,20 @@ discard block |
||
| 241 | 241 | $search = $this->object->createSearch(); |
| 242 | 242 | |
| 243 | 243 | $conditions = array( |
| 244 | - $search->compare( '~=', 'customer.address.company', 'ABC GmbH' ), |
|
| 245 | - $search->compare( '==', 'customer.address.editor', $this->editor ) |
|
| 244 | + $search->compare('~=', 'customer.address.company', 'ABC GmbH'), |
|
| 245 | + $search->compare('==', 'customer.address.editor', $this->editor) |
|
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 249 | - $search->setSlice( 0, 1 ); |
|
| 248 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 249 | + $search->setSlice(0, 1); |
|
| 250 | 250 | |
| 251 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 251 | + $results = $this->object->searchItems($search, [], $total); |
|
| 252 | 252 | |
| 253 | - $this->assertEquals( 1, count( $results ) ); |
|
| 254 | - $this->assertEquals( 2, $total ); |
|
| 253 | + $this->assertEquals(1, count($results)); |
|
| 254 | + $this->assertEquals(2, $total); |
|
| 255 | 255 | |
| 256 | - foreach( $results as $id => $item ) { |
|
| 257 | - $this->assertEquals( $id, $item->getId() ); |
|
| 256 | + foreach ($results as $id => $item) { |
|
| 257 | + $this->assertEquals($id, $item->getId()); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -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\FosUser( $context ); |
|
| 24 | + $this->object = new \Aimeos\MShop\Customer\Manager\FosUser($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 \RuntimeException( 'No customer item with code "UTC003" found' ); |
|
| 72 | + if (($expected = reset($items)) === false) { |
|
| 73 | + throw new \RuntimeException('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,58 +85,58 @@ 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 | - $this->assertEquals( $item->getRoles(), $itemSaved->getRoles() ); |
|
| 111 | - $this->assertEquals( $item->getSalt(), $itemSaved->getSalt() ); |
|
| 112 | - |
|
| 113 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 114 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 115 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 116 | - |
|
| 117 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 118 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 119 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 120 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 121 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 122 | - $this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() ); |
|
| 123 | - $this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() ); |
|
| 124 | - $this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() ); |
|
| 125 | - $this->assertEquals( $itemExp->getRoles(), $itemUpd->getRoles() ); |
|
| 126 | - $this->assertEquals( $itemExp->getSalt(), $itemUpd->getSalt() ); |
|
| 127 | - |
|
| 128 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 129 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 130 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 131 | - |
|
| 132 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 133 | - $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 | + $this->assertEquals($item->getRoles(), $itemSaved->getRoles()); |
|
| 111 | + $this->assertEquals($item->getSalt(), $itemSaved->getSalt()); |
|
| 112 | + |
|
| 113 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 114 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 115 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 116 | + |
|
| 117 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 118 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 119 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 120 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 121 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 122 | + $this->assertEquals($itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress()); |
|
| 123 | + $this->assertEquals($itemExp->getBirthday(), $itemUpd->getBirthday()); |
|
| 124 | + $this->assertEquals($itemExp->getPassword(), $itemUpd->getPassword()); |
|
| 125 | + $this->assertEquals($itemExp->getRoles(), $itemUpd->getRoles()); |
|
| 126 | + $this->assertEquals($itemExp->getSalt(), $itemUpd->getSalt()); |
|
| 127 | + |
|
| 128 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 129 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 130 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 131 | + |
|
| 132 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 133 | + $this->object->getItem($item->getId()); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | public function testCreateSearch() |
| 138 | 138 | { |
| 139 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 139 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -146,69 +146,69 @@ discard block |
||
| 146 | 146 | $search = $this->object->createSearch(); |
| 147 | 147 | |
| 148 | 148 | $expr = []; |
| 149 | - $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
| 150 | - $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
| 151 | - $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
| 152 | - |
|
| 153 | - $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
| 154 | - $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
| 155 | - $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
| 156 | - $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
| 157 | - $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
| 158 | - $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
| 159 | - $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
| 160 | - $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
| 161 | - $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
| 162 | - $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
| 163 | - $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
| 164 | - $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
| 165 | - $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
| 166 | - $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
| 167 | - $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
| 168 | - $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
| 169 | - $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
| 170 | - $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
| 171 | - $expr[] = $search->compare( '>=', 'customer.longitude', '10.0' ); |
|
| 172 | - $expr[] = $search->compare( '>=', 'customer.latitude', '50.0' ); |
|
| 173 | - |
|
| 174 | - $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
| 175 | - $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
| 176 | - $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
| 177 | - $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
| 178 | - $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
| 179 | - $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
| 180 | - |
|
| 181 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 182 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 183 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 184 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 185 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 186 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 187 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 188 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 189 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 190 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 191 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 192 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 193 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 194 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 195 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 196 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 197 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 198 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 199 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 200 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 201 | - $expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' ); |
|
| 202 | - $expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' ); |
|
| 203 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 204 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 205 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 206 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 207 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 208 | - |
|
| 209 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 210 | - $result = $this->object->searchItems( $search, [], $total ); |
|
| 211 | - $this->assertEquals( 1, count( $result ) ); |
|
| 149 | + $expr[] = $search->compare('!=', 'customer.id', null); |
|
| 150 | + $expr[] = $search->compare('==', 'customer.label', 'UTC002'); |
|
| 151 | + $expr[] = $search->compare('==', 'customer.code', 'UTC002'); |
|
| 152 | + |
|
| 153 | + $expr[] = $search->compare('>=', 'customer.salutation', ''); |
|
| 154 | + $expr[] = $search->compare('>=', 'customer.company', ''); |
|
| 155 | + $expr[] = $search->compare('>=', 'customer.vatid', ''); |
|
| 156 | + $expr[] = $search->compare('>=', 'customer.title', ''); |
|
| 157 | + $expr[] = $search->compare('>=', 'customer.firstname', ''); |
|
| 158 | + $expr[] = $search->compare('>=', 'customer.lastname', ''); |
|
| 159 | + $expr[] = $search->compare('>=', 'customer.address1', ''); |
|
| 160 | + $expr[] = $search->compare('>=', 'customer.address2', ''); |
|
| 161 | + $expr[] = $search->compare('>=', 'customer.address3', ''); |
|
| 162 | + $expr[] = $search->compare('>=', 'customer.postal', ''); |
|
| 163 | + $expr[] = $search->compare('>=', 'customer.city', ''); |
|
| 164 | + $expr[] = $search->compare('>=', 'customer.state', ''); |
|
| 165 | + $expr[] = $search->compare('!=', 'customer.languageid', null); |
|
| 166 | + $expr[] = $search->compare('>=', 'customer.countryid', ''); |
|
| 167 | + $expr[] = $search->compare('>=', 'customer.telephone', ''); |
|
| 168 | + $expr[] = $search->compare('>=', 'customer.email', ''); |
|
| 169 | + $expr[] = $search->compare('>=', 'customer.telefax', ''); |
|
| 170 | + $expr[] = $search->compare('>=', 'customer.website', ''); |
|
| 171 | + $expr[] = $search->compare('>=', 'customer.longitude', '10.0'); |
|
| 172 | + $expr[] = $search->compare('>=', 'customer.latitude', '50.0'); |
|
| 173 | + |
|
| 174 | + $expr[] = $search->compare('==', 'customer.birthday', '1970-01-01'); |
|
| 175 | + $expr[] = $search->compare('>=', 'customer.password', ''); |
|
| 176 | + $expr[] = $search->compare('==', 'customer.status', 0); |
|
| 177 | + $expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00'); |
|
| 178 | + $expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00'); |
|
| 179 | + $expr[] = $search->compare('==', 'customer.editor', $this->editor); |
|
| 180 | + |
|
| 181 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
| 182 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
| 183 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
| 184 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
| 185 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
| 186 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
| 187 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
| 188 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
| 189 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
| 190 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
| 191 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
| 192 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
| 193 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
| 194 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
| 195 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
| 196 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
| 197 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
| 198 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
| 199 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
| 200 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
| 201 | + $expr[] = $search->compare('>=', 'customer.address.longitude', '10.0'); |
|
| 202 | + $expr[] = $search->compare('>=', 'customer.address.latitude', '50.0'); |
|
| 203 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
| 204 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
| 205 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
| 206 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
| 207 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
| 208 | + |
|
| 209 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 210 | + $result = $this->object->searchItems($search, [], $total); |
|
| 211 | + $this->assertEquals(1, count($result)); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
@@ -217,60 +217,60 @@ discard block |
||
| 217 | 217 | $total = 0; |
| 218 | 218 | |
| 219 | 219 | $search = $this->object->createSearch(); |
| 220 | - $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
| 221 | - $search->setSlice( 0, 2 ); |
|
| 220 | + $search->setConditions($search->compare('==', 'customer.address.editor', $this->editor)); |
|
| 221 | + $search->setSlice(0, 2); |
|
| 222 | 222 | |
| 223 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 224 | - $this->assertEquals( 2, count( $results ) ); |
|
| 225 | - $this->assertEquals( 3, $total ); |
|
| 223 | + $results = $this->object->searchItems($search, [], $total); |
|
| 224 | + $this->assertEquals(2, count($results)); |
|
| 225 | + $this->assertEquals(3, $total); |
|
| 226 | 226 | |
| 227 | - foreach($results as $itemId => $item) { |
|
| 228 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 227 | + foreach ($results as $itemId => $item) { |
|
| 228 | + $this->assertEquals($itemId, $item->getId()); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | public function testSearchItemsCriteria() |
| 234 | 234 | { |
| 235 | - $search = $this->object->createSearch( true ); |
|
| 235 | + $search = $this->object->createSearch(true); |
|
| 236 | 236 | $conditions = array( |
| 237 | - $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
| 237 | + $search->compare('==', 'customer.address.editor', $this->editor), |
|
| 238 | 238 | $search->getConditions() |
| 239 | 239 | ); |
| 240 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 241 | - $this->assertEquals( 2, count( $this->object->searchItems( $search, [], $total ) ) ); |
|
| 240 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 241 | + $this->assertEquals(2, count($this->object->searchItems($search, [], $total))); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | public function testSearchItemsRef() |
| 246 | 246 | { |
| 247 | 247 | $search = $this->object->createSearch(); |
| 248 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC001' ) ); |
|
| 248 | + $search->setConditions($search->compare('==', 'customer.code', 'UTC001')); |
|
| 249 | 249 | |
| 250 | - $results = $this->object->searchItems( $search, ['address', 'text'] ); |
|
| 250 | + $results = $this->object->searchItems($search, ['address', 'text']); |
|
| 251 | 251 | |
| 252 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 253 | - throw new \Exception( 'No customer item for "UTC001" available' ); |
|
| 252 | + if (($item = reset($results)) === false) { |
|
| 253 | + throw new \Exception('No customer item for "UTC001" available'); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $this->assertEquals( 1, count( $item->getRefItems( 'text' ) ) ); |
|
| 257 | - $this->assertEquals( 1, count( $item->getAddressItems() ) ); |
|
| 256 | + $this->assertEquals(1, count($item->getRefItems('text'))); |
|
| 257 | + $this->assertEquals(1, count($item->getAddressItems())); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | public function testGetSubManager() |
| 262 | 262 | { |
| 263 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
| 264 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
| 263 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address')); |
|
| 264 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard')); |
|
| 265 | 265 | |
| 266 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 267 | - $this->object->getSubManager( 'unknown' ); |
|
| 266 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 267 | + $this->object->getSubManager('unknown'); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | public function testGetSubManagerInvalidName() |
| 272 | 272 | { |
| 273 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 274 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
| 273 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 274 | + $this->object->getSubManager('address', 'unknown'); |
|
| 275 | 275 | } |
| 276 | 276 | } |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->context = \TestHelper::getContext(); |
| 26 | 26 | $this->editor = $this->context->getEditor(); |
| 27 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'FosUser' ); |
|
| 28 | - $this->object = $manager->getSubManager( 'lists', 'FosUser' ); |
|
| 27 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'FosUser'); |
|
| 28 | + $this->object = $manager->getSubManager('lists', 'FosUser'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
@@ -37,36 +37,36 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | protected function tearDown() |
| 39 | 39 | { |
| 40 | - unset( $this->object, $this->context ); |
|
| 40 | + unset($this->object, $this->context); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testCleanup() |
| 45 | 45 | { |
| 46 | - $this->object->cleanup( array( -1 ) ); |
|
| 46 | + $this->object->cleanup(array( -1 )); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testAggregate() |
| 51 | 51 | { |
| 52 | - $search = $this->object->createSearch( true ); |
|
| 52 | + $search = $this->object->createSearch(true); |
|
| 53 | 53 | $expr = array( |
| 54 | 54 | $search->getConditions(), |
| 55 | - $search->compare( '==', 'customer.lists.editor', 'ai-fosuser:unittest' ), |
|
| 55 | + $search->compare('==', 'customer.lists.editor', 'ai-fosuser:unittest'), |
|
| 56 | 56 | ); |
| 57 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 57 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 58 | 58 | |
| 59 | - $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
| 59 | + $result = $this->object->aggregate($search, 'customer.lists.domain'); |
|
| 60 | 60 | |
| 61 | - $this->assertEquals( 1, count( $result ) ); |
|
| 62 | - $this->assertArrayHasKey( 'text', $result ); |
|
| 63 | - $this->assertEquals( 4, $result['text'] ); |
|
| 61 | + $this->assertEquals(1, count($result)); |
|
| 62 | + $this->assertArrayHasKey('text', $result); |
|
| 63 | + $this->assertEquals(4, $result['text']); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public function testCreateItem() |
| 68 | 68 | { |
| 69 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
| 69 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $search = $this->object->createSearch(); |
| 76 | 76 | $search->setSlice(0, 1); |
| 77 | - $results = $this->object->searchItems( $search ); |
|
| 77 | + $results = $this->object->searchItems($search); |
|
| 78 | 78 | |
| 79 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 80 | - throw new \RuntimeException( 'No item found' ); |
|
| 79 | + if (($item = reset($results)) === false) { |
|
| 80 | + throw new \RuntimeException('No item found'); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
| 83 | + $this->assertEquals($item, $this->object->getItem($item->getId())); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -88,144 +88,144 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $search = $this->object->createSearch(); |
| 90 | 90 | $search->setSlice(0, 1); |
| 91 | - $items = $this->object->searchItems( $search ); |
|
| 91 | + $items = $this->object->searchItems($search); |
|
| 92 | 92 | |
| 93 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 94 | - throw new \RuntimeException( 'No item found' ); |
|
| 93 | + if (($item = reset($items)) === false) { |
|
| 94 | + throw new \RuntimeException('No item found'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $item->setId( null ); |
|
| 98 | - $item->setDomain( 'unittest' ); |
|
| 99 | - $this->object->saveItem( $item ); |
|
| 100 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 97 | + $item->setId(null); |
|
| 98 | + $item->setDomain('unittest'); |
|
| 99 | + $this->object->saveItem($item); |
|
| 100 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 101 | 101 | |
| 102 | 102 | $itemExp = clone $itemSaved; |
| 103 | - $itemExp->setDomain( 'unittest2' ); |
|
| 104 | - $this->object->saveItem( $itemExp ); |
|
| 105 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 106 | - |
|
| 107 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - $this->assertTrue( $item->getId() !== null ); |
|
| 111 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 112 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 113 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 114 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 115 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 116 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
| 117 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 118 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
| 119 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
| 120 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
| 121 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 103 | + $itemExp->setDomain('unittest2'); |
|
| 104 | + $this->object->saveItem($itemExp); |
|
| 105 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 106 | + |
|
| 107 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + $this->assertTrue($item->getId() !== null); |
|
| 111 | + $this->assertTrue($itemSaved->getType() !== null); |
|
| 112 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 113 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 114 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
| 115 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
| 116 | + $this->assertEquals($item->getRefId(), $itemSaved->getRefId()); |
|
| 117 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 118 | + $this->assertEquals($item->getDateStart(), $itemSaved->getDateStart()); |
|
| 119 | + $this->assertEquals($item->getDateEnd(), $itemSaved->getDateEnd()); |
|
| 120 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
| 121 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 122 | 122 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
| 123 | 123 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
| 124 | 124 | |
| 125 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 126 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 127 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 128 | - |
|
| 129 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 130 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 131 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 132 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 133 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 134 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
| 135 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 136 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
| 137 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
| 138 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
| 139 | - |
|
| 140 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 141 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 142 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 125 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 126 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 127 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 128 | + |
|
| 129 | + $this->assertTrue($itemUpd->getType() !== null); |
|
| 130 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 131 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 132 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 133 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
| 134 | + $this->assertEquals($itemExp->getRefId(), $itemUpd->getRefId()); |
|
| 135 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 136 | + $this->assertEquals($itemExp->getDateStart(), $itemUpd->getDateStart()); |
|
| 137 | + $this->assertEquals($itemExp->getDateEnd(), $itemUpd->getDateEnd()); |
|
| 138 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
| 139 | + |
|
| 140 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 141 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 142 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 143 | 143 | |
| 144 | 144 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 145 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 145 | + $this->object->getItem($itemSaved->getId()); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | public function testMoveItemLastToFront() |
| 150 | 150 | { |
| 151 | 151 | $listItems = $this->getListItems(); |
| 152 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 152 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 153 | 153 | |
| 154 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 155 | - throw new \RuntimeException( 'No first customer list item' ); |
|
| 154 | + if (($first = reset($listItems)) === false) { |
|
| 155 | + throw new \RuntimeException('No first customer list item'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 159 | - throw new \RuntimeException( 'No last customer list item' ); |
|
| 158 | + if (($last = end($listItems)) === false) { |
|
| 159 | + throw new \RuntimeException('No last customer list item'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $this->object->moveItem( $last->getId(), $first->getId() ); |
|
| 162 | + $this->object->moveItem($last->getId(), $first->getId()); |
|
| 163 | 163 | |
| 164 | - $newFirst = $this->object->getItem( $last->getId() ); |
|
| 165 | - $newSecond = $this->object->getItem( $first->getId() ); |
|
| 164 | + $newFirst = $this->object->getItem($last->getId()); |
|
| 165 | + $newSecond = $this->object->getItem($first->getId()); |
|
| 166 | 166 | |
| 167 | - $this->object->moveItem( $last->getId() ); |
|
| 167 | + $this->object->moveItem($last->getId()); |
|
| 168 | 168 | |
| 169 | - $this->assertEquals( 1, $newFirst->getPosition() ); |
|
| 170 | - $this->assertEquals( 2, $newSecond->getPosition() ); |
|
| 169 | + $this->assertEquals(1, $newFirst->getPosition()); |
|
| 170 | + $this->assertEquals(2, $newSecond->getPosition()); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | public function testMoveItemFirstToLast() |
| 175 | 175 | { |
| 176 | 176 | $listItems = $this->getListItems(); |
| 177 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 177 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 178 | 178 | |
| 179 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 180 | - throw new \RuntimeException( 'No first customer list item' ); |
|
| 179 | + if (($first = reset($listItems)) === false) { |
|
| 180 | + throw new \RuntimeException('No first customer list item'); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 184 | - throw new \RuntimeException( 'No second customer list item' ); |
|
| 183 | + if (($second = next($listItems)) === false) { |
|
| 184 | + throw new \RuntimeException('No second customer list item'); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 188 | - throw new \RuntimeException( 'No last customer list item' ); |
|
| 187 | + if (($last = end($listItems)) === false) { |
|
| 188 | + throw new \RuntimeException('No last customer list item'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $this->object->moveItem( $first->getId() ); |
|
| 191 | + $this->object->moveItem($first->getId()); |
|
| 192 | 192 | |
| 193 | - $newBefore = $this->object->getItem( $last->getId() ); |
|
| 194 | - $newLast = $this->object->getItem( $first->getId() ); |
|
| 193 | + $newBefore = $this->object->getItem($last->getId()); |
|
| 194 | + $newLast = $this->object->getItem($first->getId()); |
|
| 195 | 195 | |
| 196 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 196 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
| 197 | 197 | |
| 198 | - $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
| 199 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 198 | + $this->assertEquals($last->getPosition() - 1, $newBefore->getPosition()); |
|
| 199 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | public function testMoveItemFirstUp() |
| 204 | 204 | { |
| 205 | 205 | $listItems = $this->getListItems(); |
| 206 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 206 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 207 | 207 | |
| 208 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 209 | - throw new \RuntimeException( 'No first customer list item' ); |
|
| 208 | + if (($first = reset($listItems)) === false) { |
|
| 209 | + throw new \RuntimeException('No first customer list item'); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 213 | - throw new \RuntimeException( 'No second customer list item' ); |
|
| 212 | + if (($second = next($listItems)) === false) { |
|
| 213 | + throw new \RuntimeException('No second customer list item'); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 217 | - throw new \RuntimeException( 'No last customer list item' ); |
|
| 216 | + if (($last = end($listItems)) === false) { |
|
| 217 | + throw new \RuntimeException('No last customer list item'); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $this->object->moveItem( $first->getId(), $last->getId() ); |
|
| 220 | + $this->object->moveItem($first->getId(), $last->getId()); |
|
| 221 | 221 | |
| 222 | - $newLast = $this->object->getItem( $last->getId() ); |
|
| 223 | - $newUp = $this->object->getItem( $first->getId() ); |
|
| 222 | + $newLast = $this->object->getItem($last->getId()); |
|
| 223 | + $newUp = $this->object->getItem($first->getId()); |
|
| 224 | 224 | |
| 225 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 225 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
| 226 | 226 | |
| 227 | - $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
| 228 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 227 | + $this->assertEquals($last->getPosition() - 1, $newUp->getPosition()); |
|
| 228 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
@@ -235,39 +235,39 @@ discard block |
||
| 235 | 235 | $search = $this->object->createSearch(); |
| 236 | 236 | |
| 237 | 237 | $expr = []; |
| 238 | - $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
| 239 | - $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
| 240 | - $expr[] = $search->compare( '>', 'customer.lists.parentid', 0 ); |
|
| 241 | - $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
| 242 | - $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
| 243 | - $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
| 244 | - $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
| 245 | - $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
| 246 | - $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
| 247 | - $expr[] = $search->compare( '>', 'customer.lists.position', 1 ); |
|
| 248 | - $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
| 249 | - $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
| 250 | - $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
| 251 | - $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
| 252 | - |
|
| 253 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 254 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 255 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 256 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 257 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 258 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 259 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 260 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 261 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 262 | - |
|
| 263 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 238 | + $expr[] = $search->compare('!=', 'customer.lists.id', null); |
|
| 239 | + $expr[] = $search->compare('!=', 'customer.lists.siteid', null); |
|
| 240 | + $expr[] = $search->compare('>', 'customer.lists.parentid', 0); |
|
| 241 | + $expr[] = $search->compare('==', 'customer.lists.domain', 'text'); |
|
| 242 | + $expr[] = $search->compare('>', 'customer.lists.typeid', 0); |
|
| 243 | + $expr[] = $search->compare('>', 'customer.lists.refid', 0); |
|
| 244 | + $expr[] = $search->compare('==', 'customer.lists.datestart', '2010-01-01 00:00:00'); |
|
| 245 | + $expr[] = $search->compare('==', 'customer.lists.dateend', '2100-01-01 00:00:00'); |
|
| 246 | + $expr[] = $search->compare('!=', 'customer.lists.config', null); |
|
| 247 | + $expr[] = $search->compare('>', 'customer.lists.position', 1); |
|
| 248 | + $expr[] = $search->compare('==', 'customer.lists.status', 1); |
|
| 249 | + $expr[] = $search->compare('>=', 'customer.lists.mtime', '1970-01-01 00:00:00'); |
|
| 250 | + $expr[] = $search->compare('>=', 'customer.lists.ctime', '1970-01-01 00:00:00'); |
|
| 251 | + $expr[] = $search->compare('==', 'customer.lists.editor', $this->editor); |
|
| 252 | + |
|
| 253 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
| 254 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
| 255 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
| 256 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
| 257 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
| 258 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
| 259 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
| 260 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
| 261 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
| 262 | + |
|
| 263 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 264 | 264 | $search->setSlice(0, 1); |
| 265 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 266 | - $this->assertEquals( 1, count( $results ) ); |
|
| 267 | - $this->assertEquals( 2, $total ); |
|
| 265 | + $results = $this->object->searchItems($search, [], $total); |
|
| 266 | + $this->assertEquals(1, count($results)); |
|
| 267 | + $this->assertEquals(2, $total); |
|
| 268 | 268 | |
| 269 | - foreach($results as $itemId => $item) { |
|
| 270 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 269 | + foreach ($results as $itemId => $item) { |
|
| 270 | + $this->assertEquals($itemId, $item->getId()); |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | public function testSearchItemsNoCriteria() |
| 276 | 276 | { |
| 277 | 277 | $search = $this->object->createSearch(); |
| 278 | - $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
| 279 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 278 | + $search->setConditions($search->compare('==', 'customer.lists.editor', $this->editor)); |
|
| 279 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -284,48 +284,48 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | $search = $this->object->createSearch(true); |
| 286 | 286 | $conditions = array( |
| 287 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 287 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
| 288 | 288 | $search->getConditions() |
| 289 | 289 | ); |
| 290 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 291 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 290 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 291 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | public function testGetSubManager() |
| 296 | 296 | { |
| 297 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 298 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 297 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
| 298 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
| 299 | 299 | |
| 300 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 301 | - $this->object->getSubManager( 'unknown' ); |
|
| 300 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 301 | + $this->object->getSubManager('unknown'); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | protected function getListItems() |
| 306 | 306 | { |
| 307 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'FosUser' ); |
|
| 307 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'FosUser'); |
|
| 308 | 308 | |
| 309 | 309 | $search = $manager->createSearch(); |
| 310 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC003' ) ); |
|
| 311 | - $search->setSlice( 0, 1 ); |
|
| 310 | + $search->setConditions($search->compare('==', 'customer.code', 'UTC003')); |
|
| 311 | + $search->setSlice(0, 1); |
|
| 312 | 312 | |
| 313 | - $results = $manager->searchItems( $search ); |
|
| 313 | + $results = $manager->searchItems($search); |
|
| 314 | 314 | |
| 315 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 316 | - throw new \RuntimeException( 'No customer item found' ); |
|
| 315 | + if (($item = reset($results)) === false) { |
|
| 316 | + throw new \RuntimeException('No customer item found'); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $search = $this->object->createSearch(); |
| 320 | 320 | $expr = array( |
| 321 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
| 322 | - $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
| 323 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 324 | - $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
| 321 | + $search->compare('==', 'customer.lists.parentid', $item->getId()), |
|
| 322 | + $search->compare('==', 'customer.lists.domain', 'text'), |
|
| 323 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
| 324 | + $search->compare('==', 'customer.lists.type.code', 'default'), |
|
| 325 | 325 | ); |
| 326 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 327 | - $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
| 326 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 327 | + $search->setSortations(array($search->sort('+', 'customer.lists.position'))); |
|
| 328 | 328 | |
| 329 | - return $this->object->searchItems( $search ); |
|
| 329 | + return $this->object->searchItems($search); |
|
| 330 | 330 | } |
| 331 | 331 | } |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | 24 | $this->editor = \TestHelper::getContext()->getEditor(); |
| 25 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'FosUser' ); |
|
| 25 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'FosUser'); |
|
| 26 | 26 | |
| 27 | - $listManager = $manager->getSubManager( 'lists', 'FosUser' ); |
|
| 28 | - $this->object = $listManager->getSubManager( 'type', 'FosUser' ); |
|
| 27 | + $listManager = $manager->getSubManager('lists', 'FosUser'); |
|
| 28 | + $this->object = $listManager->getSubManager('type', 'FosUser'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
@@ -37,35 +37,35 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | protected function tearDown() |
| 39 | 39 | { |
| 40 | - unset( $this->object ); |
|
| 40 | + unset($this->object); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testCleanup() |
| 45 | 45 | { |
| 46 | - $this->object->cleanup( array( -1 ) ); |
|
| 46 | + $this->object->cleanup(array( -1 )); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetSearchAttributes() |
| 51 | 51 | { |
| 52 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 53 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 52 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 53 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testGetSubManager() |
| 59 | 59 | { |
| 60 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 61 | - $this->object->getSubManager( 'unknown' ); |
|
| 60 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 61 | + $this->object->getSubManager('unknown'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | public function testCreateItem() |
| 66 | 66 | { |
| 67 | 67 | $item = $this->object->createItem(); |
| 68 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item ); |
|
| 68 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | $search->setSlice(0, 1); |
| 76 | 76 | $results = $this->object->searchItems($search); |
| 77 | 77 | |
| 78 | - if( ( $expected = reset($results) ) === false ) { |
|
| 79 | - throw new \RuntimeException( 'No list type item found' ); |
|
| 78 | + if (($expected = reset($results)) === false) { |
|
| 79 | + throw new \RuntimeException('No list type item found'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) ); |
|
| 82 | + $this->assertEquals($expected, $this->object->getItem($expected->getId())); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -89,48 +89,48 @@ discard block |
||
| 89 | 89 | $search->setSlice(0, 1); |
| 90 | 90 | $results = $this->object->searchItems($search); |
| 91 | 91 | |
| 92 | - if( ( $item = reset($results) ) === false ) { |
|
| 93 | - throw new \RuntimeException( 'No type item found' ); |
|
| 92 | + if (($item = reset($results)) === false) { |
|
| 93 | + throw new \RuntimeException('No type item found'); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $item->setId(null); |
| 97 | - $item->setCode( 'unitTestInit' ); |
|
| 98 | - $this->object->saveItem( $item ); |
|
| 99 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 97 | + $item->setCode('unitTestInit'); |
|
| 98 | + $this->object->saveItem($item); |
|
| 99 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 100 | 100 | |
| 101 | 101 | $itemExp = clone $itemSaved; |
| 102 | - $itemExp->setCode( 'unitTestSave' ); |
|
| 103 | - $this->object->saveItem( $itemExp ); |
|
| 104 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 102 | + $itemExp->setCode('unitTestSave'); |
|
| 103 | + $this->object->saveItem($itemExp); |
|
| 104 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 105 | 105 | |
| 106 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 106 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - $this->assertTrue( $item->getId() !== null ); |
|
| 110 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 111 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 112 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 113 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 114 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 115 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 109 | + $this->assertTrue($item->getId() !== null); |
|
| 110 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 111 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 112 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
| 113 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 114 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
| 115 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
| 116 | 116 | |
| 117 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 118 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 119 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 117 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 118 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 119 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 120 | 120 | |
| 121 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 122 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 123 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 124 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 125 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 126 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 121 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 122 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 123 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 124 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 125 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 126 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 127 | 127 | |
| 128 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 129 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 130 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 128 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 129 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 130 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 131 | 131 | |
| 132 | 132 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 133 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 133 | + $this->object->getItem($itemSaved->getId()); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -140,25 +140,25 @@ discard block |
||
| 140 | 140 | $search = $this->object->createSearch(); |
| 141 | 141 | |
| 142 | 142 | $expr = []; |
| 143 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 144 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 145 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 146 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 147 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 148 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 149 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 150 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 151 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 152 | - |
|
| 153 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 143 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
| 144 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
| 145 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
| 146 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
| 147 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
| 148 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
| 149 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
| 150 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
| 151 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
| 152 | + |
|
| 153 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 154 | 154 | $search->setSlice(0, 1); |
| 155 | 155 | |
| 156 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 157 | - $this->assertEquals( 1, count( $results ) ); |
|
| 158 | - $this->assertEquals( 1, $total ); |
|
| 156 | + $results = $this->object->searchItems($search, [], $total); |
|
| 157 | + $this->assertEquals(1, count($results)); |
|
| 158 | + $this->assertEquals(1, $total); |
|
| 159 | 159 | |
| 160 | - foreach($results as $itemId => $item) { |
|
| 161 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 160 | + foreach ($results as $itemId => $item) { |
|
| 161 | + $this->assertEquals($itemId, $item->getId()); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.lists.type.id' => array( |
| 26 | 26 | 'code'=>'customer.lists.type.id', |
| 27 | 27 | 'internalcode'=>'foslity."id"', |
| 28 | - 'internaldeps'=>array( 'LEFT JOIN "fos_user_list_type" AS foslity ON ( fosli."typeid" = foslity."id" )' ), |
|
| 28 | + 'internaldeps'=>array('LEFT JOIN "fos_user_list_type" AS foslity ON ( fosli."typeid" = foslity."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, [] ) as $domain ) { |
|
| 103 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 102 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
| 103 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/type/fosuser/delete' ); |
|
| 106 | + $this->cleanupBase($siteids, 'mshop/customer/manager/lists/type/fosuser/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, [], $withsub ); |
|
| 120 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $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 ? 'FosUser' : $name ) ); |
|
| 133 | + return $this->getSubManagerBase('customer', 'lists/type/' . $manager, ($name === null ? 'FosUser' : $name)); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.lists.id'=> array( |
| 26 | 26 | 'code'=>'customer.lists.id', |
| 27 | 27 | 'internalcode'=>'fosli."id"', |
| 28 | - 'internaldeps' => array( 'LEFT JOIN "fos_user_list" AS fosli ON ( fos."id" = fosli."parentid" )' ), |
|
| 28 | + 'internaldeps' => array('LEFT JOIN "fos_user_list" AS fosli ON ( fos."id" = fosli."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->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 139 | + foreach ($this->getContext()->getConfig()->get($path, array('type')) as $domain) { |
|
| 140 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/fosuser/delete' ); |
|
| 143 | + $this->cleanupBase($siteids, 'mshop/customer/manager/lists/fosuser/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 ? 'FosUser' : $name ) ); |
|
| 170 | + return $this->getSubManagerBase('customer', 'lists/' . $manager, ($name === null ? 'FosUser' : $name)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'label' => 'Customer address ID', |
| 27 | 27 | 'code' => 'customer.address.id', |
| 28 | 28 | 'internalcode' => 'fosad."id"', |
| 29 | - 'internaldeps' => array( 'LEFT JOIN "fos_user_address" AS fosad ON ( fos."id" = fosad."parentid" )' ), |
|
| 29 | + 'internaldeps' => array('LEFT JOIN "fos_user_address" AS fosad ON ( fos."id" = fosad."parentid" )'), |
|
| 30 | 30 | 'type' => 'integer', |
| 31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
| 32 | 32 | 'public' => false, |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 225 | 225 | */ |
| 226 | - public function cleanup( array $siteids ) |
|
| 226 | + public function cleanup(array $siteids) |
|
| 227 | 227 | { |
| 228 | 228 | $path = 'mshop/customer/manager/address/submanagers'; |
| 229 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
| 230 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 229 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
| 230 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @param array $ids List of IDs |
| 239 | 239 | */ |
| 240 | - public function deleteItems( array $ids ) |
|
| 240 | + public function deleteItems(array $ids) |
|
| 241 | 241 | { |
| 242 | 242 | $path = 'mshop/customer/manager/address/fosuser/delete'; |
| 243 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 243 | + $this->deleteItemsBase($ids, $path, false); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 251 | 251 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 252 | 252 | */ |
| 253 | - public function getSearchAttributes( $withsub = true ) |
|
| 253 | + public function getSearchAttributes($withsub = true) |
|
| 254 | 254 | { |
| 255 | 255 | $path = 'mshop/customer/manager/address/submanagers'; |
| 256 | 256 | |
| 257 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
| 257 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 266 | 266 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 267 | 267 | */ |
| 268 | - public function getSubManager( $manager, $name = null ) |
|
| 268 | + public function getSubManager($manager, $name = null) |
|
| 269 | 269 | { |
| 270 | - return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 270 | + return $this->getSubManagerBase('customer', 'address/' . $manager, ($name === null ? 'FosUser' : $name)); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 244 | 244 | */ |
| 245 | - public function cleanup( array $siteids ) |
|
| 245 | + public function cleanup(array $siteids) |
|
| 246 | 246 | { |
| 247 | 247 | $path = 'mshop/customer/manager/submanagers'; |
| 248 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 249 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 248 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
| 249 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,10 +256,10 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @param array $ids List of IDs |
| 258 | 258 | */ |
| 259 | - public function deleteItems( array $ids ) |
|
| 259 | + public function deleteItems(array $ids) |
|
| 260 | 260 | { |
| 261 | 261 | $path = 'mshop/customer/manager/fosuser/delete'; |
| 262 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 262 | + $this->deleteItemsBase($ids, $path, false); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 270 | 270 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 271 | 271 | */ |
| 272 | - public function getSearchAttributes( $withsub = true ) |
|
| 272 | + public function getSearchAttributes($withsub = true) |
|
| 273 | 273 | { |
| 274 | 274 | $path = 'mshop/customer/manager/submanagers'; |
| 275 | 275 | |
| 276 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 276 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
@@ -294,27 +294,27 @@ discard block |
||
| 294 | 294 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
| 295 | 295 | * @param boolean $fetch True if the new ID should be returned in the item |
| 296 | 296 | */ |
| 297 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 297 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 298 | 298 | { |
| 299 | 299 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\FosUser'; |
| 300 | - if( !( $item instanceof $iface ) ) { |
|
| 301 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 300 | + if (!($item instanceof $iface)) { |
|
| 301 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if( !$item->isModified() ) { return; } |
|
| 304 | + if (!$item->isModified()) { return; } |
|
| 305 | 305 | |
| 306 | 306 | $context = $this->getContext(); |
| 307 | 307 | $dbm = $context->getDatabaseManager(); |
| 308 | 308 | $dbname = $this->getResourceName(); |
| 309 | - $conn = $dbm->acquire( $dbname ); |
|
| 309 | + $conn = $dbm->acquire($dbname); |
|
| 310 | 310 | |
| 311 | 311 | try |
| 312 | 312 | { |
| 313 | 313 | $id = $item->getId(); |
| 314 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 314 | + $date = date('Y-m-d H:i:s'); |
|
| 315 | 315 | $billingAddress = $item->getPaymentAddress(); |
| 316 | 316 | |
| 317 | - if( $id === null ) |
|
| 317 | + if ($id === null) |
|
| 318 | 318 | { |
| 319 | 319 | /** mshop/customer/manager/fosuser/insert |
| 320 | 320 | * Inserts a new customer record into the database table |
@@ -378,50 +378,50 @@ discard block |
||
| 378 | 378 | $path = 'mshop/customer/manager/fosuser/update'; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 382 | - |
|
| 383 | - $stmt->bind( 1, $item->getCode() ); // canonical username |
|
| 384 | - $stmt->bind( 2, $item->getCode() ); // username |
|
| 385 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
| 386 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
| 387 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
| 388 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
| 389 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
| 390 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
| 391 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
| 392 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
| 393 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
| 394 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
| 395 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
| 396 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
| 397 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
| 398 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
| 399 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
| 400 | - $stmt->bind( 18, $billingAddress->getEmail() ); |
|
| 401 | - $stmt->bind( 19, $billingAddress->getEmail() ); |
|
| 402 | - $stmt->bind( 20, $billingAddress->getTelefax() ); |
|
| 403 | - $stmt->bind( 21, $billingAddress->getWebsite() ); |
|
| 404 | - $stmt->bind( 22, $billingAddress->getLongitude() ); |
|
| 405 | - $stmt->bind( 23, $billingAddress->getLatitude() ); |
|
| 406 | - $stmt->bind( 24, $item->getBirthday() ); |
|
| 407 | - $stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 408 | - $stmt->bind( 26, $item->getDateVerified() ); |
|
| 409 | - $stmt->bind( 27, $item->getPassword() ); |
|
| 410 | - $stmt->bind( 28, $date ); // Modification time |
|
| 411 | - $stmt->bind( 29, $context->getEditor() ); |
|
| 412 | - $stmt->bind( 30, serialize( $item->getRoles() ) ); |
|
| 413 | - $stmt->bind( 31, $item->getSalt() ); |
|
| 414 | - |
|
| 415 | - if( $id !== null ) { |
|
| 416 | - $stmt->bind( 32, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 417 | - $item->setId( $id ); |
|
| 381 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 382 | + |
|
| 383 | + $stmt->bind(1, $item->getCode()); // canonical username |
|
| 384 | + $stmt->bind(2, $item->getCode()); // username |
|
| 385 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
| 386 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
| 387 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
| 388 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
| 389 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
| 390 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
| 391 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
| 392 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
| 393 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
| 394 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
| 395 | + $stmt->bind(13, $billingAddress->getCity()); |
|
| 396 | + $stmt->bind(14, $billingAddress->getState()); |
|
| 397 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
| 398 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
| 399 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
| 400 | + $stmt->bind(18, $billingAddress->getEmail()); |
|
| 401 | + $stmt->bind(19, $billingAddress->getEmail()); |
|
| 402 | + $stmt->bind(20, $billingAddress->getTelefax()); |
|
| 403 | + $stmt->bind(21, $billingAddress->getWebsite()); |
|
| 404 | + $stmt->bind(22, $billingAddress->getLongitude()); |
|
| 405 | + $stmt->bind(23, $billingAddress->getLatitude()); |
|
| 406 | + $stmt->bind(24, $item->getBirthday()); |
|
| 407 | + $stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 408 | + $stmt->bind(26, $item->getDateVerified()); |
|
| 409 | + $stmt->bind(27, $item->getPassword()); |
|
| 410 | + $stmt->bind(28, $date); // Modification time |
|
| 411 | + $stmt->bind(29, $context->getEditor()); |
|
| 412 | + $stmt->bind(30, serialize($item->getRoles())); |
|
| 413 | + $stmt->bind(31, $item->getSalt()); |
|
| 414 | + |
|
| 415 | + if ($id !== null) { |
|
| 416 | + $stmt->bind(32, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 417 | + $item->setId($id); |
|
| 418 | 418 | } else { |
| 419 | - $stmt->bind( 32, $date ); // Creation time |
|
| 419 | + $stmt->bind(32, $date); // Creation time |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | $stmt->execute()->finish(); |
| 423 | 423 | |
| 424 | - if( $id === null && $fetch === true ) |
|
| 424 | + if ($id === null && $fetch === true) |
|
| 425 | 425 | { |
| 426 | 426 | /** mshop/customer/manager/fosuser/newid |
| 427 | 427 | * Retrieves the ID generated by the database when inserting a new record |
@@ -454,14 +454,14 @@ discard block |
||
| 454 | 454 | * @see mshop/customer/manager/fosuser/count |
| 455 | 455 | */ |
| 456 | 456 | $path = 'mshop/customer/manager/fosuser/newid'; |
| 457 | - $item->setId( $this->newId( $conn, $path ) ); |
|
| 457 | + $item->setId($this->newId($conn, $path)); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - $dbm->release( $conn, $dbname ); |
|
| 460 | + $dbm->release($conn, $dbname); |
|
| 461 | 461 | } |
| 462 | - catch( \Exception $e ) |
|
| 462 | + catch (\Exception $e) |
|
| 463 | 463 | { |
| 464 | - $dbm->release( $conn, $dbname ); |
|
| 464 | + $dbm->release($conn, $dbname); |
|
| 465 | 465 | throw $e; |
| 466 | 466 | } |
| 467 | 467 | } |
@@ -475,11 +475,11 @@ discard block |
||
| 475 | 475 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 476 | 476 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 477 | 477 | */ |
| 478 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
| 478 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
| 479 | 479 | { |
| 480 | 480 | $dbm = $this->getContext()->getDatabaseManager(); |
| 481 | 481 | $dbname = $this->getResourceName(); |
| 482 | - $conn = $dbm->acquire( $dbname ); |
|
| 482 | + $conn = $dbm->acquire($dbname); |
|
| 483 | 483 | $map = []; |
| 484 | 484 | |
| 485 | 485 | try |
@@ -487,27 +487,27 @@ discard block |
||
| 487 | 487 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 488 | 488 | $cfgPathSearch = 'mshop/customer/manager/fosuser/search'; |
| 489 | 489 | $cfgPathCount = 'mshop/customer/manager/fosuser/count'; |
| 490 | - $required = array( 'customer' ); |
|
| 490 | + $required = array('customer'); |
|
| 491 | 491 | |
| 492 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 493 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 494 | - $map[ $row['customer.id'] ] = $row; |
|
| 492 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 493 | + while (($row = $results->fetch()) !== false) { |
|
| 494 | + $map[$row['customer.id']] = $row; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - $dbm->release( $conn, $dbname ); |
|
| 497 | + $dbm->release($conn, $dbname); |
|
| 498 | 498 | } |
| 499 | - catch( \Exception $e ) |
|
| 499 | + catch (\Exception $e) |
|
| 500 | 500 | { |
| 501 | - $dbm->release( $conn, $dbname ); |
|
| 501 | + $dbm->release($conn, $dbname); |
|
| 502 | 502 | throw $e; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | $addrItems = []; |
| 506 | - if( in_array( 'address', $ref, true ) ) { |
|
| 507 | - $addrItems = $this->getAddressItems( array_keys( $map ) ); |
|
| 506 | + if (in_array('address', $ref, true)) { |
|
| 507 | + $addrItems = $this->getAddressItems(array_keys($map)); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - return $this->buildItems( $map, $ref, 'customer', $addrItems ); |
|
| 510 | + return $this->buildItems($map, $ref, 'customer', $addrItems); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
@@ -518,9 +518,9 @@ discard block |
||
| 518 | 518 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 519 | 519 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 520 | 520 | */ |
| 521 | - public function getSubManager( $manager, $name = null ) |
|
| 521 | + public function getSubManager($manager, $name = null) |
|
| 522 | 522 | { |
| 523 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 523 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name)); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | |
@@ -532,19 +532,19 @@ discard block |
||
| 532 | 532 | * @param array $refItems Items referenced by the customer item via the list items |
| 533 | 533 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 534 | 534 | */ |
| 535 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], array $addresses = [] ) |
|
| 535 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], array $addresses = []) |
|
| 536 | 536 | { |
| 537 | - if( !isset( $this->addressManager ) ) { |
|
| 538 | - $this->addressManager = $this->getObject()->getSubManager( 'address' ); |
|
| 537 | + if (!isset($this->addressManager)) { |
|
| 538 | + $this->addressManager = $this->getObject()->getSubManager('address'); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | - if( isset( $values['roles'] ) ) { |
|
| 542 | - $values['roles'] = unserialize( $values['roles'] ); |
|
| 541 | + if (isset($values['roles'])) { |
|
| 542 | + $values['roles'] = unserialize($values['roles']); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | $helper = $this->getPasswordHelper(); |
| 546 | 546 | $address = $this->addressManager->createItem(); |
| 547 | 547 | |
| 548 | - return new \Aimeos\MShop\Customer\Item\FosUser( $address, $values, $listItems, $refItems, null, $helper, $addresses ); |
|
| 548 | + return new \Aimeos\MShop\Customer\Item\FosUser($address, $values, $listItems, $refItems, null, $helper, $addresses); |
|
| 549 | 549 | } |
| 550 | 550 | } |