@@ -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,133 +70,133 @@ 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 | - $resultSaved = $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 | + $resultSaved = $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 | - $resultUpd = $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 | + $resultUpd = $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() ); |
|
| 189 | - |
|
| 190 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 191 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 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 | + |
|
| 190 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 191 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 192 | 192 | |
| 193 | 193 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 194 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 194 | + $this->object->getItem($itemSaved->getId()); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public function testCreateSearch() |
| 198 | 198 | { |
| 199 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 199 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
@@ -205,36 +205,36 @@ discard block |
||
| 205 | 205 | $search = $this->object->createSearch(); |
| 206 | 206 | |
| 207 | 207 | $expr = []; |
| 208 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 209 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 210 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 211 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 212 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 213 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 214 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 215 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 216 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 217 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 218 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 219 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 220 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 221 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 222 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 223 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 224 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 225 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 226 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 227 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 228 | - $expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' ); |
|
| 229 | - $expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' ); |
|
| 230 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 231 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 232 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 233 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 234 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 235 | - |
|
| 236 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 237 | - $this->assertEquals( 1, count( $this->object->searchItems( $search ) ) ); |
|
| 208 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
| 209 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
| 210 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
| 211 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
| 212 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
| 213 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
| 214 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
| 215 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
| 216 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
| 217 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
| 218 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
| 219 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
| 220 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
| 221 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
| 222 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
| 223 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
| 224 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
| 225 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
| 226 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
| 227 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
| 228 | + $expr[] = $search->compare('>=', 'customer.address.longitude', '10.0'); |
|
| 229 | + $expr[] = $search->compare('>=', 'customer.address.latitude', '50.0'); |
|
| 230 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
| 231 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
| 232 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
| 233 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
| 234 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
| 235 | + |
|
| 236 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 237 | + $this->assertEquals(1, count($this->object->searchItems($search))); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -244,20 +244,20 @@ discard block |
||
| 244 | 244 | $search = $this->object->createSearch(); |
| 245 | 245 | |
| 246 | 246 | $conditions = array( |
| 247 | - $search->compare( '~=', 'customer.address.company', 'ABC GmbH' ), |
|
| 248 | - $search->compare( '==', 'customer.address.editor', $this->editor ) |
|
| 247 | + $search->compare('~=', 'customer.address.company', 'ABC GmbH'), |
|
| 248 | + $search->compare('==', 'customer.address.editor', $this->editor) |
|
| 249 | 249 | ); |
| 250 | 250 | |
| 251 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 252 | - $search->setSlice( 0, 1 ); |
|
| 251 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 252 | + $search->setSlice(0, 1); |
|
| 253 | 253 | |
| 254 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 254 | + $results = $this->object->searchItems($search, [], $total); |
|
| 255 | 255 | |
| 256 | - $this->assertEquals( 1, count( $results ) ); |
|
| 257 | - $this->assertEquals( 2, $total ); |
|
| 256 | + $this->assertEquals(1, count($results)); |
|
| 257 | + $this->assertEquals(2, $total); |
|
| 258 | 258 | |
| 259 | - foreach( $results as $id => $item ) { |
|
| 260 | - $this->assertEquals( $id, $item->getId() ); |
|
| 259 | + foreach ($results as $id => $item) { |
|
| 260 | + $this->assertEquals($id, $item->getId()); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -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( '', $object->getSalt() ); |
|
| 109 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, []); |
|
| 110 | + $this->assertEquals('', $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 | } |
@@ -5,19 +5,19 @@ |
||
| 5 | 5 | * @copyright Aimeos (aimeos.org), 2014-2017 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -return array ( |
|
| 9 | - 'customer/lists/type' => array ( |
|
| 10 | - 'customer/group/default' => array( 'domain' => 'customer/group', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ), |
|
| 11 | - 'order/download' => array( 'domain' => 'order', 'code' => 'download', 'label' => 'Download', 'status' => 1 ), |
|
| 12 | - 'product/favorite' => array( 'domain' => 'product', 'code' => 'favorite', 'label' => 'Favorite', 'status' => 1 ), |
|
| 13 | - 'product/watch' => array( 'domain' => 'product', 'code' => 'watch', 'label' => 'Watch list', 'status' => 1 ), |
|
| 14 | - 'text/default' => array( 'domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ), |
|
| 8 | +return array( |
|
| 9 | + 'customer/lists/type' => array( |
|
| 10 | + 'customer/group/default' => array('domain' => 'customer/group', 'code' => 'default', 'label' => 'Standard', 'status' => 1), |
|
| 11 | + 'order/download' => array('domain' => 'order', 'code' => 'download', 'label' => 'Download', 'status' => 1), |
|
| 12 | + 'product/favorite' => array('domain' => 'product', 'code' => 'favorite', 'label' => 'Favorite', 'status' => 1), |
|
| 13 | + 'product/watch' => array('domain' => 'product', 'code' => 'watch', 'label' => 'Watch list', 'status' => 1), |
|
| 14 | + 'text/default' => array('domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1), |
|
| 15 | 15 | ), |
| 16 | 16 | |
| 17 | - 'customer/lists' => array ( |
|
| 18 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1 ), |
|
| 19 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 2, 'status' => 1 ), |
|
| 20 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 3, 'status' => 1 ), |
|
| 21 | - array( 'parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1 ), |
|
| 17 | + 'customer/lists' => array( |
|
| 18 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1), |
|
| 19 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 2, 'status' => 1), |
|
| 20 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 3, 'status' => 1), |
|
| 21 | + array('parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1), |
|
| 22 | 22 | ), |
| 23 | 23 | ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function getPostDependencies() |
| 42 | 42 | { |
| 43 | - return array( 'TablesCreateFosUser' ); |
|
| 43 | + return array('TablesCreateFosUser'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function migrate() |
| 51 | 51 | { |
| 52 | - $this->process( $this->mysql ); |
|
| 52 | + $this->process($this->mysql); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -58,22 +58,22 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * array string $stmts List of SQL statements for changing the columns |
| 60 | 60 | */ |
| 61 | - protected function process( array $stmts ) |
|
| 61 | + protected function process(array $stmts) |
|
| 62 | 62 | { |
| 63 | 63 | $table = 'fos_user_address'; |
| 64 | - $this->msg( sprintf( 'Rename "refid" to "parentid" in table "%1$s"', $table ), 0 ); $this->status( '' ); |
|
| 64 | + $this->msg(sprintf('Rename "refid" to "parentid" in table "%1$s"', $table), 0); $this->status(''); |
|
| 65 | 65 | |
| 66 | - foreach( $stmts as $column => $stmts ) |
|
| 66 | + foreach ($stmts as $column => $stmts) |
|
| 67 | 67 | { |
| 68 | - $this->msg( sprintf( 'Checking column "%1$s"', $column ), 1 ); |
|
| 68 | + $this->msg(sprintf('Checking column "%1$s"', $column), 1); |
|
| 69 | 69 | |
| 70 | - if( $this->schema->tableExists( $table ) |
|
| 71 | - && $this->schema->columnExists( $table, $column ) === true |
|
| 70 | + if ($this->schema->tableExists($table) |
|
| 71 | + && $this->schema->columnExists($table, $column) === true |
|
| 72 | 72 | ) { |
| 73 | - $this->executeList( $stmts ); |
|
| 74 | - $this->status( 'done' ); |
|
| 73 | + $this->executeList($stmts); |
|
| 74 | + $this->status('done'); |
|
| 75 | 75 | } else { |
| 76 | - $this->status( 'OK' ); |
|
| 76 | + $this->status('OK'); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -5,12 +5,12 @@ |
||
| 5 | 5 | * @copyright Aimeos (aimeos.org), 2018 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -return array ( |
|
| 8 | +return array( |
|
| 9 | 9 | 'customer/property/type' => array( |
| 10 | - 'customer/property/type/newsletter' => array( 'domain' => 'customer', 'code' => 'newsletter', 'label' => 'Newsletter', 'status' => 1 ), |
|
| 10 | + 'customer/property/type/newsletter' => array('domain' => 'customer', 'code' => 'newsletter', 'label' => 'Newsletter', 'status' => 1), |
|
| 11 | 11 | ), |
| 12 | 12 | |
| 13 | 13 | 'customer/property' => array( |
| 14 | - 'customer/property/UTC001/newsletter' => array( 'parentid' => 'customer/UTC001', 'typeid' => 'customer/property/type/newsletter', 'langid' => null, 'value' => '1' ), |
|
| 14 | + 'customer/property/UTC001/newsletter' => array('parentid' => 'customer/UTC001', 'typeid' => 'customer/property/type/newsletter', 'langid' => null, 'value' => '1'), |
|
| 15 | 15 | ), |
| 16 | 16 | ); |
| 17 | 17 | \ No newline at end of file |
@@ -20,91 +20,91 @@ discard block |
||
| 20 | 20 | $context = \TestHelper::getContext(); |
| 21 | 21 | $this->editor = $context->getEditor(); |
| 22 | 22 | |
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'FosUser' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'property', 'FosUser' ); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'FosUser'); |
|
| 24 | + $this->object = $manager->getSubManager('property', 'FosUser'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object ); |
|
| 30 | + unset($this->object); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testCleanup() |
| 35 | 35 | { |
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 36 | + $this->object->cleanup(array( -1 )); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testCreateItem() |
| 41 | 41 | { |
| 42 | 42 | $item = $this->object->createItem(); |
| 43 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item ); |
|
| 43 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | public function testSaveInvalid() |
| 48 | 48 | { |
| 49 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 50 | - $this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
|
| 49 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 50 | + $this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testSaveUpdateDeleteItem() |
| 55 | 55 | { |
| 56 | 56 | $search = $this->object->createSearch(); |
| 57 | - $search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) ); |
|
| 58 | - $results = $this->object->searchItems( $search ); |
|
| 57 | + $search->setConditions($search->compare('==', 'customer.property.editor', $this->editor)); |
|
| 58 | + $results = $this->object->searchItems($search); |
|
| 59 | 59 | |
| 60 | - if( ( $item = reset($results) ) === false ) { |
|
| 61 | - throw new \RuntimeException( 'No property item found' ); |
|
| 60 | + if (($item = reset($results)) === false) { |
|
| 61 | + throw new \RuntimeException('No property item found'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $item->setId(null); |
| 65 | - $item->setLanguageId( 'en' ); |
|
| 66 | - $resultSaved = $this->object->saveItem( $item ); |
|
| 67 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 65 | + $item->setLanguageId('en'); |
|
| 66 | + $resultSaved = $this->object->saveItem($item); |
|
| 67 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 68 | 68 | |
| 69 | 69 | $itemExp = clone $itemSaved; |
| 70 | - $itemExp->setValue( 'unittest' ); |
|
| 71 | - $resultUpd = $this->object->saveItem( $itemExp ); |
|
| 72 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 70 | + $itemExp->setValue('unittest'); |
|
| 71 | + $resultUpd = $this->object->saveItem($itemExp); |
|
| 72 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 73 | 73 | |
| 74 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 74 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 75 | 75 | |
| 76 | 76 | $context = \TestHelper::getContext(); |
| 77 | 77 | |
| 78 | - $this->assertTrue( $item->getId() !== null ); |
|
| 79 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 80 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 81 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 82 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 83 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 84 | - $this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId() ); |
|
| 85 | - $this->assertEquals( $item->getValue(), $itemSaved->getValue() ); |
|
| 86 | - |
|
| 87 | - $this->assertEquals( $context->getEditor(), $itemSaved->getEditor() ); |
|
| 88 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 89 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 90 | - |
|
| 91 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 92 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 93 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 94 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 95 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 96 | - $this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId() ); |
|
| 97 | - $this->assertEquals( $itemExp->getValue(), $itemUpd->getValue() ); |
|
| 98 | - |
|
| 99 | - $this->assertEquals( $context->getEditor(), $itemUpd->getEditor() ); |
|
| 100 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 101 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 102 | - |
|
| 103 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 104 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 105 | - |
|
| 106 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 107 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 78 | + $this->assertTrue($item->getId() !== null); |
|
| 79 | + $this->assertTrue($itemSaved->getType() !== null); |
|
| 80 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 81 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
| 82 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 83 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
| 84 | + $this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId()); |
|
| 85 | + $this->assertEquals($item->getValue(), $itemSaved->getValue()); |
|
| 86 | + |
|
| 87 | + $this->assertEquals($context->getEditor(), $itemSaved->getEditor()); |
|
| 88 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 89 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 90 | + |
|
| 91 | + $this->assertTrue($itemUpd->getType() !== null); |
|
| 92 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 93 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 94 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 95 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
| 96 | + $this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId()); |
|
| 97 | + $this->assertEquals($itemExp->getValue(), $itemUpd->getValue()); |
|
| 98 | + |
|
| 99 | + $this->assertEquals($context->getEditor(), $itemUpd->getEditor()); |
|
| 100 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 101 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 102 | + |
|
| 103 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 104 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 105 | + |
|
| 106 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 107 | + $this->object->getItem($itemSaved->getId()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -112,19 +112,19 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $search = $this->object->createSearch(); |
| 114 | 114 | $conditions = array( |
| 115 | - $search->compare( '~=', 'customer.property.value', '1'), |
|
| 116 | - $search->compare( '==', 'customer.property.editor', $this->editor ) |
|
| 115 | + $search->compare('~=', 'customer.property.value', '1'), |
|
| 116 | + $search->compare('==', 'customer.property.editor', $this->editor) |
|
| 117 | 117 | ); |
| 118 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 119 | - $results = $this->object->searchItems( $search ); |
|
| 118 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 119 | + $results = $this->object->searchItems($search); |
|
| 120 | 120 | |
| 121 | - if( ($expected = reset($results)) === false ) { |
|
| 122 | - throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) ); |
|
| 121 | + if (($expected = reset($results)) === false) { |
|
| 122 | + throw new \RuntimeException(sprintf('No customer property item found for value "%1$s".', '1')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $actual = $this->object->getItem( $expected->getId() ); |
|
| 126 | - $this->assertNotEquals( '', $actual->getTypeName() ); |
|
| 127 | - $this->assertEquals( $expected, $actual ); |
|
| 125 | + $actual = $this->object->getItem($expected->getId()); |
|
| 126 | + $this->assertNotEquals('', $actual->getTypeName()); |
|
| 127 | + $this->assertEquals($expected, $actual); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $result = $this->object->getResourceType(); |
| 134 | 134 | |
| 135 | - $this->assertContains( 'customer/property', $result ); |
|
| 136 | - $this->assertContains( 'customer/property/type', $result ); |
|
| 135 | + $this->assertContains('customer/property', $result); |
|
| 136 | + $this->assertContains('customer/property/type', $result); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | public function testGetSearchAttributes() |
| 141 | 141 | { |
| 142 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 143 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 142 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 143 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -151,51 +151,51 @@ discard block |
||
| 151 | 151 | $search = $this->object->createSearch(); |
| 152 | 152 | |
| 153 | 153 | $expr = []; |
| 154 | - $expr[] = $search->compare( '!=', 'customer.property.id', null ); |
|
| 155 | - $expr[] = $search->compare( '!=', 'customer.property.parentid', null ); |
|
| 156 | - $expr[] = $search->compare( '!=', 'customer.property.siteid', null ); |
|
| 157 | - $expr[] = $search->compare( '!=', 'customer.property.typeid', null ); |
|
| 158 | - $expr[] = $search->compare( '==', 'customer.property.languageid', null ); |
|
| 159 | - $expr[] = $search->compare( '==', 'customer.property.value', '1' ); |
|
| 160 | - $expr[] = $search->compare( '==', 'customer.property.editor', $this->editor ); |
|
| 161 | - |
|
| 162 | - $expr[] = $search->compare( '!=', 'customer.property.type.id', null ); |
|
| 163 | - $expr[] = $search->compare( '!=', 'customer.property.type.siteid', null ); |
|
| 164 | - $expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' ); |
|
| 165 | - $expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' ); |
|
| 166 | - $expr[] = $search->compare( '>', 'customer.property.type.label', '' ); |
|
| 167 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
| 168 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
| 169 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
| 170 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
| 171 | - |
|
| 172 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 173 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 174 | - $this->assertEquals( 1, count( $results ) ); |
|
| 154 | + $expr[] = $search->compare('!=', 'customer.property.id', null); |
|
| 155 | + $expr[] = $search->compare('!=', 'customer.property.parentid', null); |
|
| 156 | + $expr[] = $search->compare('!=', 'customer.property.siteid', null); |
|
| 157 | + $expr[] = $search->compare('!=', 'customer.property.typeid', null); |
|
| 158 | + $expr[] = $search->compare('==', 'customer.property.languageid', null); |
|
| 159 | + $expr[] = $search->compare('==', 'customer.property.value', '1'); |
|
| 160 | + $expr[] = $search->compare('==', 'customer.property.editor', $this->editor); |
|
| 161 | + |
|
| 162 | + $expr[] = $search->compare('!=', 'customer.property.type.id', null); |
|
| 163 | + $expr[] = $search->compare('!=', 'customer.property.type.siteid', null); |
|
| 164 | + $expr[] = $search->compare('==', 'customer.property.type.domain', 'customer'); |
|
| 165 | + $expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter'); |
|
| 166 | + $expr[] = $search->compare('>', 'customer.property.type.label', ''); |
|
| 167 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
| 168 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
| 169 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
| 170 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
| 171 | + |
|
| 172 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 173 | + $results = $this->object->searchItems($search, [], $total); |
|
| 174 | + $this->assertEquals(1, count($results)); |
|
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | $search = $this->object->createSearch(); |
| 178 | 178 | $conditions = array( |
| 179 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter' ), |
|
| 180 | - $search->compare( '==', 'customer.property.editor', $this->editor ) |
|
| 179 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
| 180 | + $search->compare('==', 'customer.property.editor', $this->editor) |
|
| 181 | 181 | ); |
| 182 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 182 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 183 | 183 | $search->setSlice(0, 1); |
| 184 | - $items = $this->object->searchItems( $search, [], $total ); |
|
| 184 | + $items = $this->object->searchItems($search, [], $total); |
|
| 185 | 185 | |
| 186 | - $this->assertEquals( 1, count( $items ) ); |
|
| 187 | - $this->assertEquals( 1, $total ); |
|
| 186 | + $this->assertEquals(1, count($items)); |
|
| 187 | + $this->assertEquals(1, $total); |
|
| 188 | 188 | |
| 189 | - foreach($items as $itemId => $item) { |
|
| 190 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 189 | + foreach ($items as $itemId => $item) { |
|
| 190 | + $this->assertEquals($itemId, $item->getId()); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | public function testGetSubManager() |
| 196 | 196 | { |
| 197 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 198 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 197 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
| 198 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
| 199 | 199 | |
| 200 | 200 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 201 | 201 | $this->object->getSubManager('unknown'); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.property.id' => array( |
| 26 | 26 | 'code' => 'customer.property.id', |
| 27 | 27 | 'internalcode' => 'fospr."id"', |
| 28 | - 'internaldeps'=>array( 'LEFT JOIN "fos_user_property" AS fospr ON ( fospr."parentid" = fos."id" )' ), |
|
| 28 | + 'internaldeps'=>array('LEFT JOIN "fos_user_property" AS fospr ON ( fospr."parentid" = fos."id" )'), |
|
| 29 | 29 | 'label' => 'Property ID', |
| 30 | 30 | 'type' => 'integer', |
| 31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 103 | 103 | */ |
| 104 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 104 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 105 | 105 | { |
| 106 | - parent::__construct( $context ); |
|
| 107 | - $this->setResourceName( 'db-customer' ); |
|
| 106 | + parent::__construct($context); |
|
| 107 | + $this->setResourceName('db-customer'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
| 115 | 115 | */ |
| 116 | - public function cleanup( array $siteids ) |
|
| 116 | + public function cleanup(array $siteids) |
|
| 117 | 117 | { |
| 118 | 118 | $path = 'mshop/customer/manager/property/submanagers'; |
| 119 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
| 120 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 119 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
| 120 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/property/fosuser/delete' ); |
|
| 123 | + $this->cleanupBase($siteids, 'mshop/customer/manager/property/fosuser/delete'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | * @param boolean $withsub Return also the resource type of sub-managers if true |
| 131 | 131 | * @return array Type of the manager and submanagers, subtypes are separated by slashes |
| 132 | 132 | */ |
| 133 | - public function getResourceType( $withsub = true ) |
|
| 133 | + public function getResourceType($withsub = true) |
|
| 134 | 134 | { |
| 135 | 135 | $path = 'mshop/customer/manager/property/submanagers'; |
| 136 | 136 | |
| 137 | - return $this->getResourceTypeBase( 'customer/property', $path, array( 'type' ), $withsub ); |
|
| 137 | + return $this->getResourceTypeBase('customer/property', $path, array('type'), $withsub); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 145 | 145 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 146 | 146 | */ |
| 147 | - public function getSearchAttributes( $withsub = true ) |
|
| 147 | + public function getSearchAttributes($withsub = true) |
|
| 148 | 148 | { |
| 149 | 149 | $path = 'mshop/customer/manager/property/submanagers'; |
| 150 | 150 | |
| 151 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'type' ), $withsub ); |
|
| 151 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('type'), $withsub); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * configuration (or Default) if null |
| 161 | 161 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc. |
| 162 | 162 | */ |
| 163 | - public function getSubManager( $manager, $name = null ) |
|
| 163 | + public function getSubManager($manager, $name = null) |
|
| 164 | 164 | { |
| 165 | - return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 165 | + return $this->getSubManagerBase('customer', 'property/' . $manager, ($name === null ? 'FosUser' : $name)); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.property.type.id' => array( |
| 26 | 26 | 'code' => 'customer.property.type.id', |
| 27 | 27 | 'internalcode' => 'fosprty."id"', |
| 28 | - 'internaldeps' => array( 'LEFT JOIN "fos_user_property_type" AS fosprty ON ( fospr."typeid" = fosprty."id" )' ), |
|
| 28 | + 'internaldeps' => array('LEFT JOIN "fos_user_property_type" AS fosprty ON ( fospr."typeid" = fosprty."id" )'), |
|
| 29 | 29 | 'label' => 'Property type ID', |
| 30 | 30 | 'type' => 'integer', |
| 31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 101 | 101 | */ |
| 102 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 102 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 103 | 103 | { |
| 104 | - parent::__construct( $context ); |
|
| 105 | - $this->setResourceName( 'db-customer' ); |
|
| 104 | + parent::__construct($context); |
|
| 105 | + $this->setResourceName('db-customer'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 113 | 113 | */ |
| 114 | - public function cleanup( array $siteids ) |
|
| 114 | + public function cleanup(array $siteids) |
|
| 115 | 115 | { |
| 116 | 116 | $path = 'mshop/customer/manager/property/type/submanagers'; |
| 117 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
| 118 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 117 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
| 118 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/property/type/fosuser/delete' ); |
|
| 121 | + $this->cleanupBase($siteids, 'mshop/customer/manager/property/type/fosuser/delete'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | * @param boolean $withsub Return also the resource type of sub-managers if true |
| 129 | 129 | * @return array Type of the manager and submanagers, subtypes are separated by slashes |
| 130 | 130 | */ |
| 131 | - public function getResourceType( $withsub = true ) |
|
| 131 | + public function getResourceType($withsub = true) |
|
| 132 | 132 | { |
| 133 | 133 | $path = 'mshop/customer/manager/property/type/submanagers'; |
| 134 | 134 | |
| 135 | - return $this->getResourceTypeBase( 'customer/property/type', $path, [], $withsub ); |
|
| 135 | + return $this->getResourceTypeBase('customer/property/type', $path, [], $withsub); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 143 | 143 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 144 | 144 | */ |
| 145 | - public function getSearchAttributes( $withsub = true ) |
|
| 145 | + public function getSearchAttributes($withsub = true) |
|
| 146 | 146 | { |
| 147 | 147 | $path = 'mshop/customer/manager/property/type/submanagers'; |
| 148 | 148 | |
| 149 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
| 149 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 158 | 158 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc. |
| 159 | 159 | */ |
| 160 | - public function getSubManager( $manager, $name = null ) |
|
| 160 | + public function getSubManager($manager, $name = null) |
|
| 161 | 161 | { |
| 162 | - return $this->getSubManagerBase( 'customer', 'property/type/' . $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 162 | + return $this->getSubManagerBase('customer', 'property/type/' . $manager, ($name === null ? 'FosUser' : $name)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $context = \TestHelper::getContext(); |
| 21 | 21 | $this->editor = $context->getEditor(); |
| 22 | 22 | |
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'FosUser' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'property', 'FosUser' )->getSubManager( 'type', 'FosUser' ); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'FosUser'); |
|
| 24 | + $this->object = $manager->getSubManager('property', 'FosUser')->getSubManager('type', 'FosUser'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function testCleanup() |
| 35 | 35 | { |
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 36 | + $this->object->cleanup(array( -1 )); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testCreateItem() |
| 41 | 41 | { |
| 42 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem() ); |
|
| 42 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem()); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $result = $this->object->getResourceType(); |
| 49 | 49 | |
| 50 | - $this->assertContains( 'customer/property/type', $result ); |
|
| 50 | + $this->assertContains('customer/property/type', $result); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testGetSearchAttributes() |
| 55 | 55 | { |
| 56 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 57 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 56 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 57 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -63,82 +63,82 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $search = $this->object->createSearch(); |
| 65 | 65 | $conditions = array( |
| 66 | - $search->compare( '==', 'customer.property.type.code', 'newsletter' ), |
|
| 67 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
| 66 | + $search->compare('==', 'customer.property.type.code', 'newsletter'), |
|
| 67 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
| 68 | 68 | ); |
| 69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 69 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 70 | 70 | |
| 71 | - $results = $this->object->searchItems( $search ); |
|
| 71 | + $results = $this->object->searchItems($search); |
|
| 72 | 72 | |
| 73 | - if( ($expected = reset($results) ) === false ) |
|
| 73 | + if (($expected = reset($results)) === false) |
|
| 74 | 74 | { |
| 75 | - throw new \RuntimeException( 'No property type item found.' ); |
|
| 75 | + throw new \RuntimeException('No property type item found.'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $actual = $this->object->getItem( $expected->getId() ); |
|
| 78 | + $actual = $this->object->getItem($expected->getId()); |
|
| 79 | 79 | |
| 80 | - $this->assertEquals( $expected, $actual ); |
|
| 80 | + $this->assertEquals($expected, $actual); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testSaveInvalid() |
| 85 | 85 | { |
| 86 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 87 | - $this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
|
| 86 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 87 | + $this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard()); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | public function testSaveUpdateDeleteItem() |
| 92 | 92 | { |
| 93 | 93 | $search = $this->object->createSearch(); |
| 94 | - $search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) ); |
|
| 94 | + $search->setConditions($search->compare('==', 'customer.property.type.editor', $this->editor)); |
|
| 95 | 95 | $results = $this->object->searchItems($search); |
| 96 | 96 | |
| 97 | - if( ( $item = reset($results) ) === false ) { |
|
| 98 | - throw new \RuntimeException( 'No type item found' ); |
|
| 97 | + if (($item = reset($results)) === false) { |
|
| 98 | + throw new \RuntimeException('No type item found'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $item->setId(null); |
| 102 | - $item->setCode( 'unitTestSave' ); |
|
| 103 | - $resultSaved = $this->object->saveItem( $item ); |
|
| 104 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 102 | + $item->setCode('unitTestSave'); |
|
| 103 | + $resultSaved = $this->object->saveItem($item); |
|
| 104 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 105 | 105 | |
| 106 | 106 | $itemExp = clone $itemSaved; |
| 107 | - $itemExp->setCode( 'unitTestSave2' ); |
|
| 108 | - $resultUpd = $this->object->saveItem( $itemExp ); |
|
| 109 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 107 | + $itemExp->setCode('unitTestSave2'); |
|
| 108 | + $resultUpd = $this->object->saveItem($itemExp); |
|
| 109 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 110 | 110 | |
| 111 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 111 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $this->assertTrue( $item->getId() !== null ); |
|
| 115 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 116 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 117 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 118 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 119 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 120 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 114 | + $this->assertTrue($item->getId() !== null); |
|
| 115 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 116 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 117 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
| 118 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 119 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
| 120 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
| 121 | 121 | |
| 122 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 123 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 124 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 122 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 123 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 124 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 125 | 125 | |
| 126 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 127 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 128 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 129 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 130 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 131 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 126 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 127 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 128 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 129 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 130 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 131 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 132 | 132 | |
| 133 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 134 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 135 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 133 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 134 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 135 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 136 | 136 | |
| 137 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 138 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 137 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 138 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 139 | 139 | |
| 140 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 141 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 140 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 141 | + $this->object->getItem($itemSaved->getId()); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
@@ -148,36 +148,36 @@ discard block |
||
| 148 | 148 | $search = $this->object->createSearch(); |
| 149 | 149 | |
| 150 | 150 | $expr = []; |
| 151 | - $expr[] = $search->compare( '!=', 'customer.property.type.id', null ); |
|
| 152 | - $expr[] = $search->compare( '!=', 'customer.property.type.siteid', null ); |
|
| 153 | - $expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' ); |
|
| 154 | - $expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' ); |
|
| 155 | - $expr[] = $search->compare( '>', 'customer.property.type.label', '' ); |
|
| 156 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
| 157 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
| 158 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
| 159 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
| 151 | + $expr[] = $search->compare('!=', 'customer.property.type.id', null); |
|
| 152 | + $expr[] = $search->compare('!=', 'customer.property.type.siteid', null); |
|
| 153 | + $expr[] = $search->compare('==', 'customer.property.type.domain', 'customer'); |
|
| 154 | + $expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter'); |
|
| 155 | + $expr[] = $search->compare('>', 'customer.property.type.label', ''); |
|
| 156 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
| 157 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
| 158 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
| 159 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
| 160 | 160 | |
| 161 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 162 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 163 | - $this->assertEquals( 1, count( $results ) ); |
|
| 161 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 162 | + $results = $this->object->searchItems($search, [], $total); |
|
| 163 | + $this->assertEquals(1, count($results)); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | $search = $this->object->createSearch(); |
| 167 | 167 | $conditions = array( |
| 168 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter'), |
|
| 169 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
| 168 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
| 169 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
| 170 | 170 | ); |
| 171 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
| 172 | - $search->setSortations( [$search->sort('-', 'customer.property.type.position' )] ); |
|
| 171 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 172 | + $search->setSortations([$search->sort('-', 'customer.property.type.position')]); |
|
| 173 | 173 | $search->setSlice(0, 1); |
| 174 | - $items = $this->object->searchItems( $search, [], $total); |
|
| 174 | + $items = $this->object->searchItems($search, [], $total); |
|
| 175 | 175 | |
| 176 | - $this->assertEquals( 1, count( $items ) ); |
|
| 177 | - $this->assertEquals( 1, $total ); |
|
| 176 | + $this->assertEquals(1, count($items)); |
|
| 177 | + $this->assertEquals(1, $total); |
|
| 178 | 178 | |
| 179 | - foreach($items as $itemId => $item) { |
|
| 180 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 179 | + foreach ($items as $itemId => $item) { |
|
| 180 | + $this->assertEquals($itemId, $item->getId()); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |