@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | public function testGetItem() |
| 43 | 43 | { |
| 44 | 44 | $search = $this->object->createSearch(); |
| 45 | - $search->setSlice(0, 1); |
|
| 46 | - $results = $this->object->searchItems($search); |
|
| 45 | + $search->setSlice( 0, 1 ); |
|
| 46 | + $results = $this->object->searchItems( $search ); |
|
| 47 | 47 | |
| 48 | - if( ( $expected = reset($results) ) === false ) { |
|
| 48 | + if( ( $expected = reset( $results ) ) === false ) { |
|
| 49 | 49 | throw new \RuntimeException( 'No list type item found' ); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | public function testSaveUpdateDeleteItem() |
| 57 | 57 | { |
| 58 | 58 | $search = $this->object->createSearch(); |
| 59 | - $search->setSlice(0, 1); |
|
| 60 | - $results = $this->object->searchItems($search); |
|
| 59 | + $search->setSlice( 0, 1 ); |
|
| 60 | + $results = $this->object->searchItems( $search ); |
|
| 61 | 61 | |
| 62 | - if( ( $item = reset($results) ) === false ) { |
|
| 62 | + if( ( $item = reset( $results ) ) === false ) { |
|
| 63 | 63 | throw new \RuntimeException( 'No type item found' ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $item->setId(null); |
|
| 66 | + $item->setId( null ); |
|
| 67 | 67 | $item->setCode( 'unitTestInit' ); |
| 68 | 68 | $resultSaved = $this->object->saveItem( $item ); |
| 69 | 69 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
| 103 | 103 | $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
| 104 | 104 | |
| 105 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 105 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 106 | 106 | $this->object->getItem( $itemSaved->getId() ); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
| 126 | 126 | |
| 127 | 127 | $search->setConditions( $search->combine( '&&', $expr ) ); |
| 128 | - $search->setSlice(0, 1); |
|
| 128 | + $search->setSlice( 0, 1 ); |
|
| 129 | 129 | |
| 130 | 130 | $results = $this->object->searchItems( $search, [], $total ); |
| 131 | 131 | $this->assertEquals( 1, count( $results ) ); |
| 132 | 132 | $this->assertEquals( 1, $total ); |
| 133 | 133 | |
| 134 | - foreach($results as $itemId => $item) { |
|
| 134 | + foreach( $results as $itemId => $item ) { |
|
| 135 | 135 | $this->assertEquals( $itemId, $item->getId() ); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | public function testGetItem() |
| 54 | 54 | { |
| 55 | 55 | $search = $this->object->createSearch(); |
| 56 | - $search->setSlice(0, 1); |
|
| 56 | + $search->setSlice( 0, 1 ); |
|
| 57 | 57 | $results = $this->object->searchItems( $search ); |
| 58 | 58 | |
| 59 | 59 | if( ( $item = reset( $results ) ) === false ) { |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | public function testSaveUpdateDeleteItem() |
| 68 | 68 | { |
| 69 | 69 | $search = $this->object->createSearch(); |
| 70 | - $search->setSlice(0, 1); |
|
| 70 | + $search->setSlice( 0, 1 ); |
|
| 71 | 71 | $items = $this->object->searchItems( $search ); |
| 72 | 72 | |
| 73 | 73 | if( ( $item = reset( $items ) ) === false ) { |
| 74 | 74 | throw new \RuntimeException( 'No item found' ); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $item->setId(null); |
|
| 77 | + $item->setId( null ); |
|
| 78 | 78 | $item->setDomain( 'unittest' ); |
| 79 | 79 | $resultSaved = $this->object->saveItem( $item ); |
| 80 | 80 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
| 99 | 99 | $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
| 100 | 100 | $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
| 101 | - $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
|
| 102 | - $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
|
| 101 | + $this->assertStringStartsWith( date( 'Y-m-d', time() ), $itemSaved->getTimeCreated() ); |
|
| 102 | + $this->assertStringStartsWith( date( 'Y-m-d', time() ), $itemSaved->getTimeModified() ); |
|
| 103 | 103 | |
| 104 | 104 | $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
| 105 | 105 | $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
| 106 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 106 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 107 | 107 | |
| 108 | 108 | $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
| 109 | 109 | $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
| 123 | 123 | $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
| 124 | 124 | |
| 125 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 125 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 126 | 126 | $this->object->getItem( $itemSaved->getId() ); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -239,12 +239,12 @@ discard block |
||
| 239 | 239 | $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
| 240 | 240 | |
| 241 | 241 | $search->setConditions( $search->combine( '&&', $expr ) ); |
| 242 | - $search->setSlice(0, 1); |
|
| 242 | + $search->setSlice( 0, 1 ); |
|
| 243 | 243 | $results = $this->object->searchItems( $search, [], $total ); |
| 244 | 244 | $this->assertEquals( 1, count( $results ) ); |
| 245 | 245 | $this->assertEquals( 2, $total ); |
| 246 | 246 | |
| 247 | - foreach($results as $itemId => $item) { |
|
| 247 | + foreach( $results as $itemId => $item ) { |
|
| 248 | 248 | $this->assertEquals( $itemId, $item->getId() ); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -254,29 +254,29 @@ discard block |
||
| 254 | 254 | { |
| 255 | 255 | $search = $this->object->createSearch(); |
| 256 | 256 | $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
| 257 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 257 | + $this->assertEquals( 4, count( $this->object->searchItems( $search ) ) ); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | public function testSearchItemsBaseCriteria() |
| 262 | 262 | { |
| 263 | - $search = $this->object->createSearch(true); |
|
| 263 | + $search = $this->object->createSearch( true ); |
|
| 264 | 264 | $conditions = array( |
| 265 | 265 | $search->compare( '==', 'customer.lists.editor', $this->editor ), |
| 266 | 266 | $search->getConditions() |
| 267 | 267 | ); |
| 268 | 268 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
| 269 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 269 | + $this->assertEquals( 4, count( $this->object->searchItems( $search ) ) ); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | public function testGetSubManager() |
| 274 | 274 | { |
| 275 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 276 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Typo3') ); |
|
| 275 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) ); |
|
| 276 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Typo3' ) ); |
|
| 277 | 277 | |
| 278 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 279 | - $this->object->getSubManager('unknown'); |
|
| 278 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 279 | + $this->object->getSubManager( 'unknown' ); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset($this->object); |
|
| 30 | + unset( $this->object ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $results = $this->object->searchItems( $search ); |
| 72 | 72 | |
| 73 | - if( ($expected = reset($results) ) === false ) |
|
| 73 | + if( ( $expected = reset( $results ) ) === false ) |
|
| 74 | 74 | { |
| 75 | 75 | throw new \RuntimeException( 'No property type item found.' ); |
| 76 | 76 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $search = $this->object->createSearch(); |
| 94 | 94 | $search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) ); |
| 95 | - $results = $this->object->searchItems($search); |
|
| 95 | + $results = $this->object->searchItems( $search ); |
|
| 96 | 96 | |
| 97 | - if( ( $item = reset($results) ) === false ) { |
|
| 97 | + if( ( $item = reset( $results ) ) === false ) { |
|
| 98 | 98 | throw new \RuntimeException( 'No type item found' ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $item->setId(null); |
|
| 101 | + $item->setId( null ); |
|
| 102 | 102 | $item->setCode( 'unitTestSave' ); |
| 103 | 103 | $resultSaved = $this->object->saveItem( $item ); |
| 104 | 104 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -159,24 +159,24 @@ discard block |
||
| 159 | 159 | $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
| 160 | 160 | $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
| 161 | 161 | |
| 162 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 162 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 163 | 163 | $results = $this->object->searchItems( $search, [], $total ); |
| 164 | 164 | $this->assertEquals( 1, count( $results ) ); |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | $search = $this->object->createSearch(); |
| 168 | 168 | $conditions = array( |
| 169 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter'), |
|
| 169 | + $search->compare( '=~', 'customer.property.type.code', 'newsletter' ), |
|
| 170 | 170 | $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
| 171 | 171 | ); |
| 172 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
| 173 | - $search->setSlice(0, 1); |
|
| 174 | - $items = $this->object->searchItems( $search, [], $total); |
|
| 172 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 173 | + $search->setSlice( 0, 1 ); |
|
| 174 | + $items = $this->object->searchItems( $search, [], $total ); |
|
| 175 | 175 | |
| 176 | 176 | $this->assertEquals( 1, count( $items ) ); |
| 177 | 177 | $this->assertEquals( 1, $total ); |
| 178 | 178 | |
| 179 | - foreach($items as $itemId => $item) { |
|
| 179 | + foreach( $items as $itemId => $item ) { |
|
| 180 | 180 | $this->assertEquals( $itemId, $item->getId() ); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | public function testGetSubManager() |
| 186 | 186 | { |
| 187 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 188 | - $this->object->getSubManager('unknown'); |
|
| 187 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 188 | + $this->object->getSubManager( 'unknown' ); |
|
| 189 | 189 | } |
| 190 | 190 | } |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | $search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) ); |
| 58 | 58 | $results = $this->object->searchItems( $search ); |
| 59 | 59 | |
| 60 | - if( ( $item = reset($results) ) === false ) { |
|
| 60 | + if( ( $item = reset( $results ) ) === false ) { |
|
| 61 | 61 | throw new \RuntimeException( 'No property item found' ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $item->setId(null); |
|
| 64 | + $item->setId( null ); |
|
| 65 | 65 | $item->setLanguageId( 'en' ); |
| 66 | 66 | $resultSaved = $this->object->saveItem( $item ); |
| 67 | 67 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $search = $this->object->createSearch(); |
| 112 | 112 | $conditions = array( |
| 113 | - $search->compare( '~=', 'customer.property.value', '1'), |
|
| 113 | + $search->compare( '~=', 'customer.property.value', '1' ), |
|
| 114 | 114 | $search->compare( '==', 'customer.property.editor', $this->editor ) |
| 115 | 115 | ); |
| 116 | 116 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
| 117 | 117 | $results = $this->object->searchItems( $search ); |
| 118 | 118 | |
| 119 | - if( ($expected = reset($results)) === false ) { |
|
| 119 | + if( ( $expected = reset( $results ) ) === false ) { |
|
| 120 | 120 | throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) ); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $expr[] = $search->compare( '==', 'customer.property.value', '1' ); |
| 156 | 156 | $expr[] = $search->compare( '==', 'customer.property.editor', $this->editor ); |
| 157 | 157 | |
| 158 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 158 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 159 | 159 | $results = $this->object->searchItems( $search, [], $total ); |
| 160 | 160 | $this->assertEquals( 1, count( $results ) ); |
| 161 | 161 | } |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | public function testGetSubManager() |
| 165 | 165 | { |
| 166 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 167 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 166 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) ); |
|
| 167 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Standard' ) ); |
|
| 168 | 168 | |
| 169 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 170 | - $this->object->getSubManager('unknown'); |
|
| 169 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 170 | + $this->object->getSubManager( 'unknown' ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | public function testGetSubManagerInvalidName() |
| 175 | 175 | { |
| 176 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 177 | - $this->object->getSubManager('type', 'unknown'); |
|
| 176 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 177 | + $this->object->getSubManager( 'type', 'unknown' ); |
|
| 178 | 178 | } |
| 179 | 179 | } |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | $server = ServerRequestFactory::normalizeServer( $server ); |
| 96 | 96 | $headers = ServerRequestFactory::marshalHeaders( $server ); |
| 97 | 97 | $uri = ServerRequestFactory::marshalUriFromServer( $server, $headers ); |
| 98 | - $method = ServerRequestFactory::get('REQUEST_METHOD', $server, 'GET'); |
|
| 98 | + $method = ServerRequestFactory::get( 'REQUEST_METHOD', $server, 'GET' ); |
|
| 99 | 99 | |
| 100 | 100 | return new ServerRequest( $server, $files, $uri, $method, 'php://input', $headers, $cookies, $query, $post ); |
| 101 | 101 | } |
@@ -559,14 +559,14 @@ |
||
| 559 | 559 | |
| 560 | 560 | $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level, $this->plugins ); |
| 561 | 561 | while( ( $row = $results->fetch() ) !== false ) { |
| 562 | - $map[ $row['customer.id'] ] = $row; |
|
| 562 | + $map[$row['customer.id']] = $row; |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | $dbm->release( $conn, $dbname ); |
| 566 | 566 | } |
| 567 | 567 | catch( \Exception $e ) |
| 568 | 568 | { |
| 569 | - $dbm->release( $conn, $dbname ); |
|
| 569 | + $dbm->release( $conn, $dbname ); |
|
| 570 | 570 | throw $e; |
| 571 | 571 | } |
| 572 | 572 | |
@@ -403,8 +403,7 @@ |
||
| 403 | 403 | * @see mshop/customer/manager/typo3/count |
| 404 | 404 | */ |
| 405 | 405 | $path = 'mshop/customer/manager/typo3/insert'; |
| 406 | - } |
|
| 407 | - else |
|
| 406 | + } else |
|
| 408 | 407 | { |
| 409 | 408 | /** mshop/customer/manager/typo3/update |
| 410 | 409 | * Updates an existing customer record in the database |
@@ -40,13 +40,13 @@ |
||
| 40 | 40 | $ds = DIRECTORY_SEPARATOR; |
| 41 | 41 | $path = __DIR__ . $ds . 'data' . $ds . 'customer-list.php'; |
| 42 | 42 | |
| 43 | - if( ( $testdata = include( $path ) ) == false ){ |
|
| 43 | + if( ( $testdata = include( $path ) ) == false ) { |
|
| 44 | 44 | throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer list domain', $path ) ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $refKeys = []; |
| 48 | 48 | foreach( $testdata['customer/lists'] as $dataset ) { |
| 49 | - $refKeys[ $dataset['domain'] ][] = $dataset['refid']; |
|
| 49 | + $refKeys[$dataset['domain']][] = $dataset['refid']; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $refIds = []; |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function migrate() |
| 44 | 44 | { |
| 45 | - $this->msg('Setting up Aimeos TYPO3 test tables', 0); |
|
| 46 | - $this->status(''); |
|
| 45 | + $this->msg( 'Setting up Aimeos TYPO3 test tables', 0 ); |
|
| 46 | + $this->status( '' ); |
|
| 47 | 47 | |
| 48 | 48 | $filename = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'mysql.sql'; |
| 49 | 49 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $ds = DIRECTORY_SEPARATOR; |
| 41 | 41 | $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
| 42 | 42 | |
| 43 | - if( ( $testdata = include( $path ) ) == false ){ |
|
| 43 | + if( ( $testdata = include( $path ) ) == false ) { |
|
| 44 | 44 | throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $customerAddressManager = $customerManager->getSubManager( 'address', 'Typo3' ); |
| 50 | 50 | |
| 51 | 51 | foreach( $customerManager->searchItems( $customerManager->createSearch() ) as $id => $item ) { |
| 52 | - $parentIds[ 'customer/' . $item->getCode() ] = $id; |
|
| 52 | + $parentIds['customer/' . $item->getCode()] = $id; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $this->conn->begin(); |