@@ -18,121 +18,121 @@ discard block |
||
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
| 21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
| 21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | protected function tearDown() |
| 26 | 26 | { |
| 27 | - unset( $this->context, $this->object ); |
|
| 27 | + unset($this->context, $this->object); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testAddEditSaveDeleteItem() |
| 32 | 32 | { |
| 33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
| 33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 34 | + $id = $manager->findItem('UTC001')->getId(); |
|
| 35 | 35 | |
| 36 | - $this->context->setUserId( $id ); |
|
| 37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
| 38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 36 | + $this->context->setUserId($id); |
|
| 37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
| 38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 39 | 39 | |
| 40 | - $this->context->setUserId( $item->getId() ); |
|
| 41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
| 42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 40 | + $this->context->setUserId($item->getId()); |
|
| 41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
| 42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 43 | 43 | |
| 44 | - $item->setStatus( 0 ); |
|
| 45 | - $item = $this->object->saveItem( $item ); |
|
| 46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
| 44 | + $item->setStatus(0); |
|
| 45 | + $item = $this->object->saveItem($item); |
|
| 46 | + $this->assertEquals(0, $item->getStatus()); |
|
| 47 | 47 | |
| 48 | - $this->object->deleteItem( $item->getId() ); |
|
| 48 | + $this->object->deleteItem($item->getId()); |
|
| 49 | 49 | |
| 50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 51 | - $manager->findItem( 'unittest-ctnl' ); |
|
| 50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 51 | + $manager->findItem('unittest-ctnl'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testAddExistingItem() |
| 56 | 56 | { |
| 57 | - $item = $this->object->addItem( ['customer.code' => 'UTC001'] ); |
|
| 58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 57 | + $item = $this->object->addItem(['customer.code' => 'UTC001']); |
|
| 58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testCreateItem() |
| 63 | 63 | { |
| 64 | 64 | $result = $this->object->createItem(); |
| 65 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 65 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testGetItem() |
| 70 | 70 | { |
| 71 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
| 72 | - $this->context->setUserId( $id ); |
|
| 71 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
| 72 | + $this->context->setUserId($id); |
|
| 73 | 73 | |
| 74 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
| 74 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
| 75 | 75 | |
| 76 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 77 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
| 78 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
| 76 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 77 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
| 78 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | public function testFindItem() |
| 83 | 83 | { |
| 84 | - $result = $this->object->findItem( 'UTC001' ); |
|
| 85 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 84 | + $result = $this->object->findItem('UTC001'); |
|
| 85 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testAddEditSaveDeleteAddressItem() |
| 90 | 90 | { |
| 91 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
| 92 | - $this->context->setUserId( $customer->getId() ); |
|
| 91 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
| 92 | + $this->context->setUserId($customer->getId()); |
|
| 93 | 93 | |
| 94 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
| 95 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 94 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
| 95 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 96 | 96 | |
| 97 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
| 98 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 97 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
| 98 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 99 | 99 | |
| 100 | - $item->setLastName( 'test' ); |
|
| 101 | - $this->object->saveAddressItem( $item ); |
|
| 102 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
| 100 | + $item->setLastName('test'); |
|
| 101 | + $this->object->saveAddressItem($item); |
|
| 102 | + $this->assertEquals('test', $item->getLastName()); |
|
| 103 | 103 | |
| 104 | - $this->object->deleteAddressItem( $item->getId() ); |
|
| 104 | + $this->object->deleteAddressItem($item->getId()); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testCreateAddressItem() |
| 109 | 109 | { |
| 110 | 110 | $result = $this->object->createAddressItem(); |
| 111 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 111 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | public function testGetAddressItem() |
| 116 | 116 | { |
| 117 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
| 117 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
| 118 | 118 | $search = $manager->createSearch(); |
| 119 | - $search->setSlice( 0, 1 ); |
|
| 120 | - $result = $manager->searchItems( $search ); |
|
| 119 | + $search->setSlice(0, 1); |
|
| 120 | + $result = $manager->searchItems($search); |
|
| 121 | 121 | |
| 122 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 123 | - throw new \RuntimeException( 'No customer address available' ); |
|
| 122 | + if (($item = reset($result)) === false) { |
|
| 123 | + throw new \RuntimeException('No customer address available'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $this->context->setUserId( $item->getParentId() ); |
|
| 127 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
| 128 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 126 | + $this->context->setUserId($item->getParentId()); |
|
| 127 | + $result = $this->object->getAddressItem($item->getId()); |
|
| 128 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | public function testAddEditDeleteListItem() |
| 133 | 133 | { |
| 134 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
| 135 | - $this->context->setUserId( $customer->getId() ); |
|
| 134 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
| 135 | + $this->context->setUserId($customer->getId()); |
|
| 136 | 136 | |
| 137 | 137 | $values = [ |
| 138 | 138 | 'customer.lists.type' => 'favorite', |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | 'customer.lists.refid' => '-1' |
| 141 | 141 | ]; |
| 142 | 142 | |
| 143 | - $item = $this->object->addListItem( $values ); |
|
| 144 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 143 | + $item = $this->object->addListItem($values); |
|
| 144 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 145 | 145 | |
| 146 | 146 | $values = [ |
| 147 | 147 | 'customer.lists.type' => 'favorite', |
@@ -149,46 +149,46 @@ discard block |
||
| 149 | 149 | 'customer.lists.refid' => '-2' |
| 150 | 150 | ]; |
| 151 | 151 | |
| 152 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
| 153 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 152 | + $item = $this->object->editListItem($item->getId(), $values); |
|
| 153 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 154 | 154 | |
| 155 | - $this->object->deleteListItem( $item->getId() ); |
|
| 155 | + $this->object->deleteListItem($item->getId()); |
|
| 156 | 156 | |
| 157 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 158 | - $this->object->getListItem( $item->getId() ); |
|
| 157 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 158 | + $this->object->getListItem($item->getId()); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | public function testGetListItem() |
| 163 | 163 | { |
| 164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
| 164 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
| 165 | 165 | $search = $manager->createSearch(); |
| 166 | - $search->setSlice( 0, 1 ); |
|
| 167 | - $result = $manager->searchItems( $search ); |
|
| 166 | + $search->setSlice(0, 1); |
|
| 167 | + $result = $manager->searchItems($search); |
|
| 168 | 168 | |
| 169 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 170 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
| 169 | + if (($item = reset($result)) === false) { |
|
| 170 | + throw new \RuntimeException('No customer lists item available'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $this->context->setUserId( $item->getParentId() ); |
|
| 174 | - $result = $this->object->getListItem( $item->getId() ); |
|
| 175 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
| 173 | + $this->context->setUserId($item->getParentId()); |
|
| 174 | + $result = $this->object->getListItem($item->getId()); |
|
| 175 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
| 179 | 179 | public function testSearchListItem() |
| 180 | 180 | { |
| 181 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 182 | - $customer = $manager->findItem( 'UTC001' ); |
|
| 183 | - $this->context->setUserId( $customer->getId() ); |
|
| 181 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 182 | + $customer = $manager->findItem('UTC001'); |
|
| 183 | + $this->context->setUserId($customer->getId()); |
|
| 184 | 184 | |
| 185 | 185 | $filter = $this->object->createListsFilter(); |
| 186 | - $result = $this->object->searchListItems( $filter ); |
|
| 186 | + $result = $this->object->searchListItems($filter); |
|
| 187 | 187 | |
| 188 | - foreach( $result as $item ) |
|
| 188 | + foreach ($result as $item) |
|
| 189 | 189 | { |
| 190 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
| 191 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 190 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
| 191 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |