@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 245 | 245 | */ |
| 246 | - public function cleanup( array $siteids ) |
|
| 246 | + public function cleanup(array $siteids) |
|
| 247 | 247 | { |
| 248 | 248 | $path = 'mshop/customer/manager/submanagers'; |
| 249 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 250 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 249 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
| 250 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @param array $ids List of IDs |
| 259 | 259 | */ |
| 260 | - public function deleteItems( array $ids ) |
|
| 260 | + public function deleteItems(array $ids) |
|
| 261 | 261 | { |
| 262 | 262 | $path = 'mshop/customer/manager/fosuser/delete'; |
| 263 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 263 | + $this->deleteItemsBase($ids, $path, false); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 271 | 271 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 272 | 272 | */ |
| 273 | - public function getSearchAttributes( $withsub = true ) |
|
| 273 | + public function getSearchAttributes($withsub = true) |
|
| 274 | 274 | { |
| 275 | 275 | $path = 'mshop/customer/manager/submanagers'; |
| 276 | 276 | |
| 277 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 277 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function createItem() |
| 287 | 287 | { |
| 288 | - return $this->createItemBase( ['customer.siteid' => $this->getContext()->getLocale()->getSiteId()] ); |
|
| 288 | + return $this->createItemBase(['customer.siteid' => $this->getContext()->getLocale()->getSiteId()]); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | |
@@ -296,31 +296,31 @@ discard block |
||
| 296 | 296 | * @param boolean $fetch True if the new ID should be returned in the item |
| 297 | 297 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
| 298 | 298 | */ |
| 299 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 299 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 300 | 300 | { |
| 301 | 301 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\FosUser'; |
| 302 | - if( !( $item instanceof $iface ) ) { |
|
| 303 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 302 | + if (!($item instanceof $iface)) { |
|
| 303 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if( !$item->isModified() ) |
|
| 306 | + if (!$item->isModified()) |
|
| 307 | 307 | { |
| 308 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 309 | - return $this->saveRefItems( $item, 'customer' ); |
|
| 308 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 309 | + return $this->saveRefItems($item, 'customer'); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $context = $this->getContext(); |
| 313 | 313 | $dbm = $context->getDatabaseManager(); |
| 314 | 314 | $dbname = $this->getResourceName(); |
| 315 | - $conn = $dbm->acquire( $dbname ); |
|
| 315 | + $conn = $dbm->acquire($dbname); |
|
| 316 | 316 | |
| 317 | 317 | try |
| 318 | 318 | { |
| 319 | 319 | $id = $item->getId(); |
| 320 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 320 | + $date = date('Y-m-d H:i:s'); |
|
| 321 | 321 | $billingAddress = $item->getPaymentAddress(); |
| 322 | 322 | |
| 323 | - if( $id === null ) |
|
| 323 | + if ($id === null) |
|
| 324 | 324 | { |
| 325 | 325 | /** mshop/customer/manager/fosuser/insert |
| 326 | 326 | * Inserts a new customer record into the database table |
@@ -384,51 +384,51 @@ discard block |
||
| 384 | 384 | $path = 'mshop/customer/manager/fosuser/update'; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 388 | - |
|
| 389 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 390 | - $stmt->bind( 2, $item->getCode() ); // canonical username |
|
| 391 | - $stmt->bind( 3, $item->getCode() ); // username |
|
| 392 | - $stmt->bind( 4, $billingAddress->getCompany() ); |
|
| 393 | - $stmt->bind( 5, $billingAddress->getVatID() ); |
|
| 394 | - $stmt->bind( 6, $billingAddress->getSalutation() ); |
|
| 395 | - $stmt->bind( 7, $billingAddress->getTitle() ); |
|
| 396 | - $stmt->bind( 8, $billingAddress->getFirstname() ); |
|
| 397 | - $stmt->bind( 9, $billingAddress->getLastname() ); |
|
| 398 | - $stmt->bind( 10, $billingAddress->getAddress1() ); |
|
| 399 | - $stmt->bind( 11, $billingAddress->getAddress2() ); |
|
| 400 | - $stmt->bind( 12, $billingAddress->getAddress3() ); |
|
| 401 | - $stmt->bind( 13, $billingAddress->getPostal() ); |
|
| 402 | - $stmt->bind( 14, $billingAddress->getCity() ); |
|
| 403 | - $stmt->bind( 15, $billingAddress->getState() ); |
|
| 404 | - $stmt->bind( 16, $billingAddress->getCountryId() ); |
|
| 405 | - $stmt->bind( 17, $billingAddress->getLanguageId() ); |
|
| 406 | - $stmt->bind( 18, $billingAddress->getTelephone() ); |
|
| 407 | - $stmt->bind( 19, $billingAddress->getEmail() ); |
|
| 408 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
| 409 | - $stmt->bind( 21, $billingAddress->getTelefax() ); |
|
| 410 | - $stmt->bind( 22, $billingAddress->getWebsite() ); |
|
| 411 | - $stmt->bind( 23, $billingAddress->getLongitude() ); |
|
| 412 | - $stmt->bind( 24, $billingAddress->getLatitude() ); |
|
| 413 | - $stmt->bind( 25, $item->getBirthday() ); |
|
| 414 | - $stmt->bind( 26, ( $item->getStatus() > 0 ? true : false ), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL ); |
|
| 415 | - $stmt->bind( 27, $item->getDateVerified() ); |
|
| 416 | - $stmt->bind( 28, $item->getPassword() ); |
|
| 417 | - $stmt->bind( 29, $date ); // Modification time |
|
| 418 | - $stmt->bind( 30, $context->getEditor() ); |
|
| 419 | - $stmt->bind( 31, serialize( $item->getRoles() ) ); |
|
| 420 | - $stmt->bind( 32, $item->getSalt() ); |
|
| 421 | - |
|
| 422 | - if( $id !== null ) { |
|
| 423 | - $stmt->bind( 33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 424 | - $item->setId( $id ); |
|
| 387 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 388 | + |
|
| 389 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 390 | + $stmt->bind(2, $item->getCode()); // canonical username |
|
| 391 | + $stmt->bind(3, $item->getCode()); // username |
|
| 392 | + $stmt->bind(4, $billingAddress->getCompany()); |
|
| 393 | + $stmt->bind(5, $billingAddress->getVatID()); |
|
| 394 | + $stmt->bind(6, $billingAddress->getSalutation()); |
|
| 395 | + $stmt->bind(7, $billingAddress->getTitle()); |
|
| 396 | + $stmt->bind(8, $billingAddress->getFirstname()); |
|
| 397 | + $stmt->bind(9, $billingAddress->getLastname()); |
|
| 398 | + $stmt->bind(10, $billingAddress->getAddress1()); |
|
| 399 | + $stmt->bind(11, $billingAddress->getAddress2()); |
|
| 400 | + $stmt->bind(12, $billingAddress->getAddress3()); |
|
| 401 | + $stmt->bind(13, $billingAddress->getPostal()); |
|
| 402 | + $stmt->bind(14, $billingAddress->getCity()); |
|
| 403 | + $stmt->bind(15, $billingAddress->getState()); |
|
| 404 | + $stmt->bind(16, $billingAddress->getCountryId()); |
|
| 405 | + $stmt->bind(17, $billingAddress->getLanguageId()); |
|
| 406 | + $stmt->bind(18, $billingAddress->getTelephone()); |
|
| 407 | + $stmt->bind(19, $billingAddress->getEmail()); |
|
| 408 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
| 409 | + $stmt->bind(21, $billingAddress->getTelefax()); |
|
| 410 | + $stmt->bind(22, $billingAddress->getWebsite()); |
|
| 411 | + $stmt->bind(23, $billingAddress->getLongitude()); |
|
| 412 | + $stmt->bind(24, $billingAddress->getLatitude()); |
|
| 413 | + $stmt->bind(25, $item->getBirthday()); |
|
| 414 | + $stmt->bind(26, ($item->getStatus() > 0 ? true : false), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL); |
|
| 415 | + $stmt->bind(27, $item->getDateVerified()); |
|
| 416 | + $stmt->bind(28, $item->getPassword()); |
|
| 417 | + $stmt->bind(29, $date); // Modification time |
|
| 418 | + $stmt->bind(30, $context->getEditor()); |
|
| 419 | + $stmt->bind(31, serialize($item->getRoles())); |
|
| 420 | + $stmt->bind(32, $item->getSalt()); |
|
| 421 | + |
|
| 422 | + if ($id !== null) { |
|
| 423 | + $stmt->bind(33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 424 | + $item->setId($id); |
|
| 425 | 425 | } else { |
| 426 | - $stmt->bind( 33, $date ); // Creation time |
|
| 426 | + $stmt->bind(33, $date); // Creation time |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $stmt->execute()->finish(); |
| 430 | 430 | |
| 431 | - if( $id === null && $fetch === true ) |
|
| 431 | + if ($id === null && $fetch === true) |
|
| 432 | 432 | { |
| 433 | 433 | /** mshop/customer/manager/fosuser/newid |
| 434 | 434 | * Retrieves the ID generated by the database when inserting a new record |
@@ -461,21 +461,21 @@ discard block |
||
| 461 | 461 | * @see mshop/customer/manager/fosuser/count |
| 462 | 462 | */ |
| 463 | 463 | $path = 'mshop/customer/manager/fosuser/newid'; |
| 464 | - $item->setId( $this->newId( $conn, $path ) ); |
|
| 464 | + $item->setId($this->newId($conn, $path)); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - $dbm->release( $conn, $dbname ); |
|
| 467 | + $dbm->release($conn, $dbname); |
|
| 468 | 468 | } |
| 469 | - catch( \Exception $e ) |
|
| 469 | + catch (\Exception $e) |
|
| 470 | 470 | { |
| 471 | - $dbm->release( $conn, $dbname ); |
|
| 471 | + $dbm->release($conn, $dbname); |
|
| 472 | 472 | throw $e; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $this->addGroups( $item ); |
|
| 475 | + $this->addGroups($item); |
|
| 476 | 476 | |
| 477 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 478 | - return $this->saveRefItems( $item, 'customer' ); |
|
| 477 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 478 | + return $this->saveRefItems($item, 'customer'); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
@@ -487,11 +487,11 @@ discard block |
||
| 487 | 487 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 488 | 488 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 489 | 489 | */ |
| 490 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
| 490 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
| 491 | 491 | { |
| 492 | 492 | $dbm = $this->getContext()->getDatabaseManager(); |
| 493 | 493 | $dbname = $this->getResourceName(); |
| 494 | - $conn = $dbm->acquire( $dbname ); |
|
| 494 | + $conn = $dbm->acquire($dbname); |
|
| 495 | 495 | $map = []; |
| 496 | 496 | |
| 497 | 497 | try |
@@ -499,32 +499,32 @@ discard block |
||
| 499 | 499 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 500 | 500 | $cfgPathSearch = 'mshop/customer/manager/fosuser/search'; |
| 501 | 501 | $cfgPathCount = 'mshop/customer/manager/fosuser/count'; |
| 502 | - $required = array( 'customer' ); |
|
| 502 | + $required = array('customer'); |
|
| 503 | 503 | |
| 504 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 505 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 506 | - $map[ $row['customer.id'] ] = $row; |
|
| 504 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 505 | + while (($row = $results->fetch()) !== false) { |
|
| 506 | + $map[$row['customer.id']] = $row; |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - $dbm->release( $conn, $dbname ); |
|
| 509 | + $dbm->release($conn, $dbname); |
|
| 510 | 510 | } |
| 511 | - catch( \Exception $e ) |
|
| 511 | + catch (\Exception $e) |
|
| 512 | 512 | { |
| 513 | - $dbm->release( $conn, $dbname ); |
|
| 513 | + $dbm->release($conn, $dbname); |
|
| 514 | 514 | throw $e; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | $addrItems = []; |
| 518 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
| 519 | - $addrItems = $this->getAddressItems( array_keys( $map ) ); |
|
| 518 | + if (in_array('customer/address', $ref, true)) { |
|
| 519 | + $addrItems = $this->getAddressItems(array_keys($map)); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | $propItems = []; |
| 523 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
| 524 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
| 523 | + if (in_array('customer/property', $ref, true)) { |
|
| 524 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
| 527 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | |
@@ -535,9 +535,9 @@ discard block |
||
| 535 | 535 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 536 | 536 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 537 | 537 | */ |
| 538 | - public function getSubManager( $manager, $name = null ) |
|
| 538 | + public function getSubManager($manager, $name = null) |
|
| 539 | 539 | { |
| 540 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 540 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name)); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | |
@@ -551,15 +551,15 @@ discard block |
||
| 551 | 551 | * @param array $propItems List of property items of the customer item |
| 552 | 552 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 553 | 553 | */ |
| 554 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], |
|
| 555 | - array $addresses = [], array $propItems = [] ) |
|
| 554 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], |
|
| 555 | + array $addresses = [], array $propItems = []) |
|
| 556 | 556 | { |
| 557 | - if( !isset( $this->addressManager ) ) { |
|
| 558 | - $this->addressManager = $this->getObject()->getSubManager( 'address' ); |
|
| 557 | + if (!isset($this->addressManager)) { |
|
| 558 | + $this->addressManager = $this->getObject()->getSubManager('address'); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if( isset( $values['roles'] ) ) { |
|
| 562 | - $values['roles'] = unserialize( $values['roles'] ); |
|
| 561 | + if (isset($values['roles'])) { |
|
| 562 | + $values['roles'] = unserialize($values['roles']); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | $helper = $this->getPasswordHelper(); |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items |
| 33 | 33 | * @param \Aimeos\MShop\Common\Item\Helper\Password\Iface|null $helper Password encryption helper object |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, |
|
| 35 | + public function __construct(\Aimeos\MShop\Common\Item\Address\Iface $address, |
|
| 36 | 36 | array $values = [], array $listItems = [], array $refItems = [], $salt = '', |
| 37 | - \Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null, array $addresses = [], array $propItems = [] ) |
|
| 37 | + \Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null, array $addresses = [], array $propItems = []) |
|
| 38 | 38 | { |
| 39 | - parent::__construct( $address, $values, $listItems, $refItems, $salt, $helper, $addresses, $propItems, $propItems ); |
|
| 39 | + parent::__construct($address, $values, $listItems, $refItems, $salt, $helper, $addresses, $propItems, $propItems); |
|
| 40 | 40 | |
| 41 | 41 | $this->values = $values; |
| 42 | 42 | $this->helper = $helper; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getPassword() |
| 53 | 53 | { |
| 54 | - if( isset( $this->values['customer.password'] ) ) { |
|
| 54 | + if (isset($this->values['customer.password'])) { |
|
| 55 | 55 | return (string) $this->values['customer.password']; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | * @param string $value Password of the customer item |
| 66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
| 67 | 67 | */ |
| 68 | - public function setPassword( $value ) |
|
| 68 | + public function setPassword($value) |
|
| 69 | 69 | { |
| 70 | - if( (string) $value !== $this->getPassword() ) |
|
| 70 | + if ((string) $value !== $this->getPassword()) |
|
| 71 | 71 | { |
| 72 | - if( $this->helper !== null ) { |
|
| 73 | - $value = $this->helper->encode( $value, $this->getSalt() ); |
|
| 72 | + if ($this->helper !== null) { |
|
| 73 | + $value = $this->helper->encode($value, $this->getSalt()); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $this->values['customer.password'] = (string) $value; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function getRoles() |
| 90 | 90 | { |
| 91 | - if( isset( $this->values['roles'] ) ) { |
|
| 91 | + if (isset($this->values['roles'])) { |
|
| 92 | 92 | return (array) $this->values['roles']; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param array $roles List of Symfony roles |
| 103 | 103 | */ |
| 104 | - public function setRoles( array $roles ) |
|
| 104 | + public function setRoles(array $roles) |
|
| 105 | 105 | { |
| 106 | 106 | $this->values['roles'] = $roles; |
| 107 | 107 | $this->setModified(); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getSalt() |
| 119 | 119 | { |
| 120 | - if( isset( $this->values['salt'] ) ) { |
|
| 120 | + if (isset($this->values['salt'])) { |
|
| 121 | 121 | return $this->values['salt']; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @param string $value Password salt |
| 132 | 132 | */ |
| 133 | - public function setSalt( $value ) |
|
| 133 | + public function setSalt($value) |
|
| 134 | 134 | { |
| 135 | - if( (string) $value !== $this->getSalt() ) |
|
| 135 | + if ((string) $value !== $this->getSalt()) |
|
| 136 | 136 | { |
| 137 | 137 | $this->values['salt'] = (string) $value; |
| 138 | 138 | $this->setModified(); |
@@ -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,78 +85,78 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $item = $this->object->createItem(); |
| 87 | 87 | |
| 88 | - $item->setCode( 'unitTest' ); |
|
| 89 | - $item->setLabel( 'unitTest' ); |
|
| 90 | - $resultSaved = $this->object->saveItem( $item ); |
|
| 91 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 88 | + $item->setCode('unitTest'); |
|
| 89 | + $item->setLabel('unitTest'); |
|
| 90 | + $resultSaved = $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 | - $resultUpd = $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->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 133 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 134 | - |
|
| 135 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 136 | - $this->object->getItem( $item->getId() ); |
|
| 94 | + $itemExp->setCode('unitTest2'); |
|
| 95 | + $itemExp->setLabel('unitTest2'); |
|
| 96 | + $resultUpd = $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->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 133 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 134 | + |
|
| 135 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 136 | + $this->object->getItem($item->getId()); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | public function testGetSavePropertyItems() |
| 141 | 141 | { |
| 142 | - $item = $this->object->findItem( 'UTC001', ['customer/property'] ); |
|
| 142 | + $item = $this->object->findItem('UTC001', ['customer/property']); |
|
| 143 | 143 | |
| 144 | - $item->setId( null )->setCode( 'xyz' ); |
|
| 145 | - $item->getPaymentAddress()->setEmail( '[email protected]' ); |
|
| 146 | - $this->object->saveItem( $item ); |
|
| 144 | + $item->setId(null)->setCode('xyz'); |
|
| 145 | + $item->getPaymentAddress()->setEmail('[email protected]'); |
|
| 146 | + $this->object->saveItem($item); |
|
| 147 | 147 | |
| 148 | - $item2 = $this->object->findItem( 'UTC001', ['customer/property'] ); |
|
| 148 | + $item2 = $this->object->findItem('UTC001', ['customer/property']); |
|
| 149 | 149 | |
| 150 | - $this->object->deleteItem( $item->getId() ); |
|
| 150 | + $this->object->deleteItem($item->getId()); |
|
| 151 | 151 | |
| 152 | - $this->assertEquals( 1, count( $item->getPropertyItems() ) ); |
|
| 153 | - $this->assertEquals( 1, count( $item2->getPropertyItems() ) ); |
|
| 152 | + $this->assertEquals(1, count($item->getPropertyItems())); |
|
| 153 | + $this->assertEquals(1, count($item2->getPropertyItems())); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | public function testCreateSearch() |
| 158 | 158 | { |
| 159 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 159 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -166,69 +166,69 @@ discard block |
||
| 166 | 166 | $search = $this->object->createSearch(); |
| 167 | 167 | |
| 168 | 168 | $expr = []; |
| 169 | - $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
| 170 | - $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
| 171 | - $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
| 172 | - |
|
| 173 | - $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
| 174 | - $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
| 175 | - $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
| 176 | - $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
| 177 | - $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
| 178 | - $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
| 179 | - $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
| 180 | - $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
| 181 | - $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
| 182 | - $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
| 183 | - $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
| 184 | - $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
| 185 | - $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
| 186 | - $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
| 187 | - $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
| 188 | - $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
| 189 | - $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
| 190 | - $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
| 191 | - $expr[] = $search->compare( '>=', 'customer.longitude', '10.0' ); |
|
| 192 | - $expr[] = $search->compare( '>=', 'customer.latitude', '50.0' ); |
|
| 193 | - |
|
| 194 | - $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
| 195 | - $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
| 196 | - $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
| 197 | - $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
| 198 | - $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
| 199 | - $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
| 200 | - |
|
| 201 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 202 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 203 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 204 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 205 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 206 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 207 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 208 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 209 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 210 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 211 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 212 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 213 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 214 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 215 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 216 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 217 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 218 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 219 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 220 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 221 | - $expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' ); |
|
| 222 | - $expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' ); |
|
| 223 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 224 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 225 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 226 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 227 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 228 | - |
|
| 229 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 230 | - $result = $this->object->searchItems( $search, [], $total ); |
|
| 231 | - $this->assertEquals( 1, count( $result ) ); |
|
| 169 | + $expr[] = $search->compare('!=', 'customer.id', null); |
|
| 170 | + $expr[] = $search->compare('==', 'customer.label', 'UTC002'); |
|
| 171 | + $expr[] = $search->compare('==', 'customer.code', 'UTC002'); |
|
| 172 | + |
|
| 173 | + $expr[] = $search->compare('>=', 'customer.salutation', ''); |
|
| 174 | + $expr[] = $search->compare('>=', 'customer.company', ''); |
|
| 175 | + $expr[] = $search->compare('>=', 'customer.vatid', ''); |
|
| 176 | + $expr[] = $search->compare('>=', 'customer.title', ''); |
|
| 177 | + $expr[] = $search->compare('>=', 'customer.firstname', ''); |
|
| 178 | + $expr[] = $search->compare('>=', 'customer.lastname', ''); |
|
| 179 | + $expr[] = $search->compare('>=', 'customer.address1', ''); |
|
| 180 | + $expr[] = $search->compare('>=', 'customer.address2', ''); |
|
| 181 | + $expr[] = $search->compare('>=', 'customer.address3', ''); |
|
| 182 | + $expr[] = $search->compare('>=', 'customer.postal', ''); |
|
| 183 | + $expr[] = $search->compare('>=', 'customer.city', ''); |
|
| 184 | + $expr[] = $search->compare('>=', 'customer.state', ''); |
|
| 185 | + $expr[] = $search->compare('!=', 'customer.languageid', null); |
|
| 186 | + $expr[] = $search->compare('>=', 'customer.countryid', ''); |
|
| 187 | + $expr[] = $search->compare('>=', 'customer.telephone', ''); |
|
| 188 | + $expr[] = $search->compare('>=', 'customer.email', ''); |
|
| 189 | + $expr[] = $search->compare('>=', 'customer.telefax', ''); |
|
| 190 | + $expr[] = $search->compare('>=', 'customer.website', ''); |
|
| 191 | + $expr[] = $search->compare('>=', 'customer.longitude', '10.0'); |
|
| 192 | + $expr[] = $search->compare('>=', 'customer.latitude', '50.0'); |
|
| 193 | + |
|
| 194 | + $expr[] = $search->compare('==', 'customer.birthday', '1970-01-01'); |
|
| 195 | + $expr[] = $search->compare('>=', 'customer.password', ''); |
|
| 196 | + $expr[] = $search->compare('==', 'customer.status', 0); |
|
| 197 | + $expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00'); |
|
| 198 | + $expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00'); |
|
| 199 | + $expr[] = $search->compare('==', 'customer.editor', $this->editor); |
|
| 200 | + |
|
| 201 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
| 202 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
| 203 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
| 204 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
| 205 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
| 206 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
| 207 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
| 208 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
| 209 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
| 210 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
| 211 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
| 212 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
| 213 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
| 214 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
| 215 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
| 216 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
| 217 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
| 218 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
| 219 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
| 220 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
| 221 | + $expr[] = $search->compare('>=', 'customer.address.longitude', '10.0'); |
|
| 222 | + $expr[] = $search->compare('>=', 'customer.address.latitude', '50.0'); |
|
| 223 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
| 224 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
| 225 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
| 226 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
| 227 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
| 228 | + |
|
| 229 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 230 | + $result = $this->object->searchItems($search, [], $total); |
|
| 231 | + $this->assertEquals(1, count($result)); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -237,60 +237,60 @@ discard block |
||
| 237 | 237 | $total = 0; |
| 238 | 238 | |
| 239 | 239 | $search = $this->object->createSearch(); |
| 240 | - $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
| 241 | - $search->setSlice( 0, 2 ); |
|
| 240 | + $search->setConditions($search->compare('==', 'customer.address.editor', $this->editor)); |
|
| 241 | + $search->setSlice(0, 2); |
|
| 242 | 242 | |
| 243 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 244 | - $this->assertEquals( 2, count( $results ) ); |
|
| 245 | - $this->assertEquals( 3, $total ); |
|
| 243 | + $results = $this->object->searchItems($search, [], $total); |
|
| 244 | + $this->assertEquals(2, count($results)); |
|
| 245 | + $this->assertEquals(3, $total); |
|
| 246 | 246 | |
| 247 | - foreach($results as $itemId => $item) { |
|
| 248 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 247 | + foreach ($results as $itemId => $item) { |
|
| 248 | + $this->assertEquals($itemId, $item->getId()); |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | public function testSearchItemsCriteria() |
| 254 | 254 | { |
| 255 | - $search = $this->object->createSearch( true ); |
|
| 255 | + $search = $this->object->createSearch(true); |
|
| 256 | 256 | $conditions = array( |
| 257 | - $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
| 257 | + $search->compare('==', 'customer.address.editor', $this->editor), |
|
| 258 | 258 | $search->getConditions() |
| 259 | 259 | ); |
| 260 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 261 | - $this->assertEquals( 2, count( $this->object->searchItems( $search, [], $total ) ) ); |
|
| 260 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 261 | + $this->assertEquals(2, count($this->object->searchItems($search, [], $total))); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | public function testSearchItemsRef() |
| 266 | 266 | { |
| 267 | 267 | $search = $this->object->createSearch(); |
| 268 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC001' ) ); |
|
| 268 | + $search->setConditions($search->compare('==', 'customer.code', 'UTC001')); |
|
| 269 | 269 | |
| 270 | - $results = $this->object->searchItems( $search, ['customer/address', 'text'] ); |
|
| 270 | + $results = $this->object->searchItems($search, ['customer/address', 'text']); |
|
| 271 | 271 | |
| 272 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 273 | - throw new \Exception( 'No customer item for "UTC001" available' ); |
|
| 272 | + if (($item = reset($results)) === false) { |
|
| 273 | + throw new \Exception('No customer item for "UTC001" available'); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $this->assertEquals( 1, count( $item->getRefItems( 'text' ) ) ); |
|
| 277 | - $this->assertEquals( 1, count( $item->getAddressItems() ) ); |
|
| 276 | + $this->assertEquals(1, count($item->getRefItems('text'))); |
|
| 277 | + $this->assertEquals(1, count($item->getAddressItems())); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
| 281 | 281 | public function testGetSubManager() |
| 282 | 282 | { |
| 283 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
| 284 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
| 283 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address')); |
|
| 284 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard')); |
|
| 285 | 285 | |
| 286 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 287 | - $this->object->getSubManager( 'unknown' ); |
|
| 286 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 287 | + $this->object->getSubManager('unknown'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | public function testGetSubManagerInvalidName() |
| 292 | 292 | { |
| 293 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 294 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
| 293 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 294 | + $this->object->getSubManager('address', 'unknown'); |
|
| 295 | 295 | } |
| 296 | 296 | } |