@@ -20,109 +20,109 @@ |
||
| 20 | 20 | $this->context = \TestHelperJobs::getContext(); |
| 21 | 21 | $aimeos = \TestHelperJobs::getAimeos(); |
| 22 | 22 | |
| 23 | - $this->object = new \Aimeos\Controller\Jobs\Order\Export\Csv\Standard( $this->context, $aimeos ); |
|
| 23 | + $this->object = new \Aimeos\Controller\Jobs\Order\Export\Csv\Standard($this->context, $aimeos); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | protected function tearDown() |
| 28 | 28 | { |
| 29 | - unset( $this->object, $this->context ); |
|
| 29 | + unset($this->object, $this->context); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | public function testGetName() |
| 34 | 34 | { |
| 35 | - $this->assertEquals( 'Order export CSV', $this->object->getName() ); |
|
| 35 | + $this->assertEquals('Order export CSV', $this->object->getName()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testGetDescription() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Exports orders to CSV file', $this->object->getDescription() ); |
|
| 41 | + $this->assertEquals('Exports orders to CSV file', $this->object->getDescription()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testRun() |
| 46 | 46 | { |
| 47 | - $mqmStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Manager\\Standard' ) |
|
| 48 | - ->setConstructorArgs( [$this->context->getConfig()] ) |
|
| 49 | - ->setMethods( ['get'] ) |
|
| 47 | + $mqmStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Manager\\Standard') |
|
| 48 | + ->setConstructorArgs([$this->context->getConfig()]) |
|
| 49 | + ->setMethods(['get']) |
|
| 50 | 50 | ->getMock(); |
| 51 | 51 | |
| 52 | - $mqStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Standard' ) |
|
| 52 | + $mqStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Standard') |
|
| 53 | 53 | ->disableOriginalConstructor() |
| 54 | - ->setMethods( ['getQueue'] ) |
|
| 54 | + ->setMethods(['getQueue']) |
|
| 55 | 55 | ->getMock(); |
| 56 | 56 | |
| 57 | - $queueStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Queue\\Standard' ) |
|
| 57 | + $queueStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Queue\\Standard') |
|
| 58 | 58 | ->disableOriginalConstructor() |
| 59 | - ->setMethods( ['del', 'get'] ) |
|
| 59 | + ->setMethods(['del', 'get']) |
|
| 60 | 60 | ->getMock(); |
| 61 | 61 | |
| 62 | - $msgStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Message\\Standard' ) |
|
| 62 | + $msgStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Message\\Standard') |
|
| 63 | 63 | ->disableOriginalConstructor() |
| 64 | - ->setMethods( ['getBody'] ) |
|
| 64 | + ->setMethods(['getBody']) |
|
| 65 | 65 | ->getMock(); |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - $this->context->setMessageQueueManager( $mqmStub ); |
|
| 68 | + $this->context->setMessageQueueManager($mqmStub); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $mqmStub->expects( $this->once() )->method( 'get' ) |
|
| 72 | - ->will( $this->returnValue( $mqStub ) ); |
|
| 71 | + $mqmStub->expects($this->once())->method('get') |
|
| 72 | + ->will($this->returnValue($mqStub)); |
|
| 73 | 73 | |
| 74 | - $mqStub->expects( $this->once() )->method( 'getQueue' ) |
|
| 75 | - ->will( $this->returnValue( $queueStub ) ); |
|
| 74 | + $mqStub->expects($this->once())->method('getQueue') |
|
| 75 | + ->will($this->returnValue($queueStub)); |
|
| 76 | 76 | |
| 77 | - $queueStub->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
| 78 | - ->will( $this->onConsecutiveCalls( $msgStub, null ) ); |
|
| 77 | + $queueStub->expects($this->exactly(2))->method('get') |
|
| 78 | + ->will($this->onConsecutiveCalls($msgStub, null)); |
|
| 79 | 79 | |
| 80 | - $queueStub->expects( $this->once() )->method( 'del' ); |
|
| 80 | + $queueStub->expects($this->once())->method('del'); |
|
| 81 | 81 | |
| 82 | - $msgStub->expects( $this->once() )->method( 'getBody' ) |
|
| 83 | - ->will( $this->returnValue( '{"sitecode":"unittest"}' ) ); |
|
| 82 | + $msgStub->expects($this->once())->method('getBody') |
|
| 83 | + ->will($this->returnValue('{"sitecode":"unittest"}')); |
|
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | $this->object->run(); |
| 87 | 87 | |
| 88 | 88 | |
| 89 | - $jobManager = \Aimeos\MAdmin\Factory::createManager( $this->context, 'job' ); |
|
| 89 | + $jobManager = \Aimeos\MAdmin\Factory::createManager($this->context, 'job'); |
|
| 90 | 90 | $jobSearch = $jobManager->createSearch(); |
| 91 | - $jobSearch->setConditions( $jobSearch->compare( '=~', 'job.label', 'order-export_' ) ); |
|
| 92 | - $jobItems = $jobManager->searchItems( $jobSearch ); |
|
| 93 | - $jobManager->deleteItems( array_keys( $jobItems ) ); |
|
| 91 | + $jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'order-export_')); |
|
| 92 | + $jobItems = $jobManager->searchItems($jobSearch); |
|
| 93 | + $jobManager->deleteItems(array_keys($jobItems)); |
|
| 94 | 94 | |
| 95 | - $this->assertEquals( 1, count( $jobItems ) ); |
|
| 95 | + $this->assertEquals(1, count($jobItems)); |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | - $filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel(); |
|
| 99 | - $fp = fopen( $filename, 'r' ); |
|
| 98 | + $filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel(); |
|
| 99 | + $fp = fopen($filename, 'r'); |
|
| 100 | 100 | |
| 101 | - $invoice = fgetcsv( $fp ); |
|
| 102 | - $address1 = fgetcsv( $fp ); |
|
| 103 | - $address2 = fgetcsv( $fp ); |
|
| 104 | - $service1 = fgetcsv( $fp ); |
|
| 105 | - $service2 = fgetcsv( $fp ); |
|
| 101 | + $invoice = fgetcsv($fp); |
|
| 102 | + $address1 = fgetcsv($fp); |
|
| 103 | + $address2 = fgetcsv($fp); |
|
| 104 | + $service1 = fgetcsv($fp); |
|
| 105 | + $service2 = fgetcsv($fp); |
|
| 106 | 106 | $coupon1 = fgetcsv($fp); |
| 107 | 107 | $coupon2 = fgetcsv($fp); |
| 108 | - $product1 = fgetcsv( $fp ); |
|
| 109 | - $product2 = fgetcsv( $fp ); |
|
| 110 | - $product3 = fgetcsv( $fp ); |
|
| 111 | - $product4 = fgetcsv( $fp ); |
|
| 112 | - |
|
| 113 | - fclose( $fp ); |
|
| 114 | - unlink( $filename ); |
|
| 115 | - |
|
| 116 | - $this->assertEquals( 'invoice', $invoice[0] ); |
|
| 117 | - $this->assertEquals( 'address', $address1[0] ); |
|
| 118 | - $this->assertEquals( 'address', $address2[0] ); |
|
| 119 | - $this->assertEquals( 'service', $service1[0] ); |
|
| 120 | - $this->assertEquals( 'service', $service2[0] ); |
|
| 121 | - $this->assertEquals( 'coupon', $coupon1[0]); |
|
| 122 | - $this->assertEquals( 'coupon', $coupon2[0]); |
|
| 123 | - $this->assertEquals( 'product', $product1[0] ); |
|
| 124 | - $this->assertEquals( 'product', $product2[0] ); |
|
| 125 | - $this->assertEquals( 'product', $product3[0] ); |
|
| 126 | - $this->assertEquals( 'product', $product4[0] ); |
|
| 108 | + $product1 = fgetcsv($fp); |
|
| 109 | + $product2 = fgetcsv($fp); |
|
| 110 | + $product3 = fgetcsv($fp); |
|
| 111 | + $product4 = fgetcsv($fp); |
|
| 112 | + |
|
| 113 | + fclose($fp); |
|
| 114 | + unlink($filename); |
|
| 115 | + |
|
| 116 | + $this->assertEquals('invoice', $invoice[0]); |
|
| 117 | + $this->assertEquals('address', $address1[0]); |
|
| 118 | + $this->assertEquals('address', $address2[0]); |
|
| 119 | + $this->assertEquals('service', $service1[0]); |
|
| 120 | + $this->assertEquals('service', $service2[0]); |
|
| 121 | + $this->assertEquals('coupon', $coupon1[0]); |
|
| 122 | + $this->assertEquals('coupon', $coupon2[0]); |
|
| 123 | + $this->assertEquals('product', $product1[0]); |
|
| 124 | + $this->assertEquals('product', $product2[0]); |
|
| 125 | + $this->assertEquals('product', $product3[0]); |
|
| 126 | + $this->assertEquals('product', $product4[0]); |
|
| 127 | 127 | } |
| 128 | 128 | } |
@@ -21,62 +21,62 @@ discard block |
||
| 21 | 21 | $this->aimeos = \TestHelperJobs::getAimeos(); |
| 22 | 22 | $this->context = \TestHelperJobs::getContext(); |
| 23 | 23 | |
| 24 | - $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard( $this->context, $this->aimeos ); |
|
| 24 | + $this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard($this->context, $this->aimeos); |
|
| 25 | 25 | |
| 26 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 26 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 32 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 33 | 33 | \Aimeos\MShop\Factory::clear(); |
| 34 | 34 | |
| 35 | - unset( $this->object, $this->context, $this->aimeos ); |
|
| 35 | + unset($this->object, $this->context, $this->aimeos); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testGetName() |
| 40 | 40 | { |
| 41 | - $this->assertEquals( 'Subscription process renew', $this->object->getName() ); |
|
| 41 | + $this->assertEquals('Subscription process renew', $this->object->getName()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testGetDescription() |
| 46 | 46 | { |
| 47 | - $this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() ); |
|
| 47 | + $this->assertEquals('Renews subscriptions at next date', $this->object->getDescription()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testRun() |
| 52 | 52 | { |
| 53 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 53 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 54 | 54 | $item = $this->getSubscription(); |
| 55 | 55 | |
| 56 | - $object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' ) |
|
| 57 | - ->setConstructorArgs( [$this->context, $this->aimeos] ) |
|
| 58 | - ->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] ) |
|
| 56 | + $object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard') |
|
| 57 | + ->setConstructorArgs([$this->context, $this->aimeos]) |
|
| 58 | + ->setMethods(['createOrderBase', 'createOrderInvoice', 'createPayment']) |
|
| 59 | 59 | ->getMock(); |
| 60 | 60 | |
| 61 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 62 | - ->setConstructorArgs( [$this->context] ) |
|
| 63 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 61 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 62 | + ->setConstructorArgs([$this->context]) |
|
| 63 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 64 | 64 | ->getMock(); |
| 65 | 65 | |
| 66 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
| 66 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
| 67 | 67 | |
| 68 | - $object->expects( $this->once() )->method( 'createOrderBase' ) |
|
| 69 | - ->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) ); |
|
| 68 | + $object->expects($this->once())->method('createOrderBase') |
|
| 69 | + ->will($this->returnValue($this->getOrderBaseItem($item->getOrderBaseId()))); |
|
| 70 | 70 | |
| 71 | - $object->expects( $this->once() )->method( 'createOrderInvoice' ) |
|
| 72 | - ->will( $this->returnValue( $this->getOrderItem() ) ); |
|
| 71 | + $object->expects($this->once())->method('createOrderInvoice') |
|
| 72 | + ->will($this->returnValue($this->getOrderItem())); |
|
| 73 | 73 | |
| 74 | - $object->expects( $this->once() )->method( 'createPayment' ); |
|
| 74 | + $object->expects($this->once())->method('createPayment'); |
|
| 75 | 75 | |
| 76 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 77 | - ->will( $this->returnValue( [$item] ) ); |
|
| 76 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 77 | + ->will($this->returnValue([$item])); |
|
| 78 | 78 | |
| 79 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 79 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 80 | 80 | |
| 81 | 81 | $object->run(); |
| 82 | 82 | } |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function testRunException() |
| 86 | 86 | { |
| 87 | - $this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] ); |
|
| 87 | + $this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']); |
|
| 88 | 88 | |
| 89 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
| 90 | - ->setConstructorArgs( [$this->context] ) |
|
| 91 | - ->setMethods( ['searchItems', 'saveItem'] ) |
|
| 89 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
| 90 | + ->setConstructorArgs([$this->context]) |
|
| 91 | + ->setMethods(['searchItems', 'saveItem']) |
|
| 92 | 92 | ->getMock(); |
| 93 | 93 | |
| 94 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub ); |
|
| 94 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub); |
|
| 95 | 95 | |
| 96 | - $managerStub->expects( $this->once() )->method( 'searchItems' ) |
|
| 97 | - ->will( $this->returnValue( [$managerStub->createItem()] ) ); |
|
| 96 | + $managerStub->expects($this->once())->method('searchItems') |
|
| 97 | + ->will($this->returnValue([$managerStub->createItem()])); |
|
| 98 | 98 | |
| 99 | - $managerStub->expects( $this->never() )->method( 'saveItem' ); |
|
| 99 | + $managerStub->expects($this->never())->method('saveItem'); |
|
| 100 | 100 | |
| 101 | 101 | $this->object->run(); |
| 102 | 102 | } |
@@ -106,34 +106,34 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $item = $this->getSubscription(); |
| 108 | 108 | |
| 109 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
| 110 | - ->setConstructorArgs( [$this->context] ) |
|
| 111 | - ->setMethods( ['store'] ) |
|
| 109 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
| 110 | + ->setConstructorArgs([$this->context]) |
|
| 111 | + ->setMethods(['store']) |
|
| 112 | 112 | ->getMock(); |
| 113 | 113 | |
| 114 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $managerStub ); |
|
| 114 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $managerStub); |
|
| 115 | 115 | |
| 116 | - $managerStub->expects( $this->once() )->method( 'store' ); |
|
| 116 | + $managerStub->expects($this->once())->method('store'); |
|
| 117 | 117 | |
| 118 | - $this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] ); |
|
| 118 | + $this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testCreateOrderInvoice() |
| 123 | 123 | { |
| 124 | 124 | $item = $this->getSubscription(); |
| 125 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
| 125 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
| 126 | 126 | |
| 127 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 128 | - ->setConstructorArgs( [$this->context] ) |
|
| 129 | - ->setMethods( ['saveItem'] ) |
|
| 127 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 128 | + ->setConstructorArgs([$this->context]) |
|
| 129 | + ->setMethods(['saveItem']) |
|
| 130 | 130 | ->getMock(); |
| 131 | 131 | |
| 132 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); |
|
| 132 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub); |
|
| 133 | 133 | |
| 134 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 134 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 135 | 135 | |
| 136 | - $this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] ); |
|
| 136 | + $this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
@@ -141,55 +141,55 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $item = $this->getSubscription(); |
| 143 | 143 | $invoice = $this->getOrderItem(); |
| 144 | - $baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() ); |
|
| 144 | + $baseItem = $this->getOrderBaseItem($item->getOrderBaseId()); |
|
| 145 | 145 | |
| 146 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 147 | - ->setConstructorArgs( [$this->context] ) |
|
| 148 | - ->setMethods( ['saveItem'] ) |
|
| 146 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 147 | + ->setConstructorArgs([$this->context]) |
|
| 148 | + ->setMethods(['saveItem']) |
|
| 149 | 149 | ->getMock(); |
| 150 | 150 | |
| 151 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub ); |
|
| 151 | + \Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub); |
|
| 152 | 152 | |
| 153 | - $managerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 153 | + $managerStub->expects($this->once())->method('saveItem'); |
|
| 154 | 154 | |
| 155 | - $this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] ); |
|
| 155 | + $this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | protected function getOrderItem() |
| 160 | 160 | { |
| 161 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 161 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | - protected function getOrderBaseItem( $baseId ) |
|
| 165 | + protected function getOrderBaseItem($baseId) |
|
| 166 | 166 | { |
| 167 | - return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] ); |
|
| 167 | + return \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->getItem($baseId, ['order/base/service']); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | protected function getSubscription() |
| 172 | 172 | { |
| 173 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
| 173 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
| 174 | 174 | |
| 175 | 175 | $search = $manager->createSearch(); |
| 176 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 176 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 177 | 177 | |
| 178 | - $items = $manager->searchItems( $search ); |
|
| 178 | + $items = $manager->searchItems($search); |
|
| 179 | 179 | |
| 180 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 180 | + if (($item = reset($items)) !== false) { |
|
| 181 | 181 | return $item; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - throw new \Exception( 'No subscription item found' ); |
|
| 184 | + throw new \Exception('No subscription item found'); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
| 188 | - protected function access( $name ) |
|
| 188 | + protected function access($name) |
|
| 189 | 189 | { |
| 190 | - $class = new \ReflectionClass( '\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard' ); |
|
| 191 | - $method = $class->getMethod( $name ); |
|
| 192 | - $method->setAccessible( true ); |
|
| 190 | + $class = new \ReflectionClass('\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard'); |
|
| 191 | + $method = $class->getMethod($name); |
|
| 192 | + $method->setAccessible(true); |
|
| 193 | 193 | |
| 194 | 194 | return $method; |
| 195 | 195 | } |
@@ -35,51 +35,51 @@ |
||
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Product\Standard( $context, $mapping ); |
|
| 39 | - |
|
| 40 | - $invoice = $this->getInvoice( $context ); |
|
| 41 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $invoice->getBaseId() ); |
|
| 42 | - |
|
| 43 | - $data = $object->process( $invoice, $order ); |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - $this->assertEquals( 4, count( $data ) ); |
|
| 47 | - |
|
| 48 | - $this->assertEquals( 18, count( $data[0] ) ); |
|
| 49 | - $this->assertEquals( 'default', $data[0][0] ); |
|
| 50 | - $this->assertEquals( 'unit_type1', $data[0][1] ); |
|
| 51 | - $this->assertEquals( 'unitsupplier', $data[0][2] ); |
|
| 52 | - $this->assertEquals( 'CNE', $data[0][3] ); |
|
| 53 | - $this->assertGreaterThan( 0, $data[0][4] ); |
|
| 54 | - $this->assertEquals( '9', $data[0][5] ); |
|
| 55 | - $this->assertEquals( 'Cafe Noire Expresso', $data[0][6] ); |
|
| 56 | - $this->assertEquals( 'somewhere/thump1.jpg', $data[0][7] ); |
|
| 57 | - $this->assertEquals( '4.50', $data[0][8] ); |
|
| 58 | - $this->assertEquals( '0.00', $data[0][9] ); |
|
| 59 | - $this->assertEquals( '0.00', $data[0][10] ); |
|
| 60 | - $this->assertEquals( '0.0000', $data[0][11] ); |
|
| 61 | - $this->assertEquals( '1', $data[0][12] ); |
|
| 62 | - $this->assertEquals( '1', $data[0][13] ); |
|
| 63 | - $this->assertEquals( "default\ndefault\nconfig", $data[0][14] ); |
|
| 64 | - $this->assertEquals( "width\nlength\ninterval", $data[0][15] ); |
|
| 65 | - $this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][16] ); |
|
| 66 | - $this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][17] ); |
|
| 38 | + $object = new \Aimeos\Controller\Common\Order\Export\Csv\Processor\Product\Standard($context, $mapping); |
|
| 39 | + |
|
| 40 | + $invoice = $this->getInvoice($context); |
|
| 41 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($invoice->getBaseId()); |
|
| 42 | + |
|
| 43 | + $data = $object->process($invoice, $order); |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + $this->assertEquals(4, count($data)); |
|
| 47 | + |
|
| 48 | + $this->assertEquals(18, count($data[0])); |
|
| 49 | + $this->assertEquals('default', $data[0][0]); |
|
| 50 | + $this->assertEquals('unit_type1', $data[0][1]); |
|
| 51 | + $this->assertEquals('unitsupplier', $data[0][2]); |
|
| 52 | + $this->assertEquals('CNE', $data[0][3]); |
|
| 53 | + $this->assertGreaterThan(0, $data[0][4]); |
|
| 54 | + $this->assertEquals('9', $data[0][5]); |
|
| 55 | + $this->assertEquals('Cafe Noire Expresso', $data[0][6]); |
|
| 56 | + $this->assertEquals('somewhere/thump1.jpg', $data[0][7]); |
|
| 57 | + $this->assertEquals('4.50', $data[0][8]); |
|
| 58 | + $this->assertEquals('0.00', $data[0][9]); |
|
| 59 | + $this->assertEquals('0.00', $data[0][10]); |
|
| 60 | + $this->assertEquals('0.0000', $data[0][11]); |
|
| 61 | + $this->assertEquals('1', $data[0][12]); |
|
| 62 | + $this->assertEquals('1', $data[0][13]); |
|
| 63 | + $this->assertEquals("default\ndefault\nconfig", $data[0][14]); |
|
| 64 | + $this->assertEquals("width\nlength\ninterval", $data[0][15]); |
|
| 65 | + $this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][16]); |
|
| 66 | + $this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][17]); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - protected function getInvoice( $context ) |
|
| 70 | + protected function getInvoice($context) |
|
| 71 | 71 | { |
| 72 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 72 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 73 | 73 | |
| 74 | 74 | $search = $manager->createSearch(); |
| 75 | - $search->setConditions( $search->compare( '==', 'order.datepayment', '2008-02-15 12:34:56' ) ); |
|
| 75 | + $search->setConditions($search->compare('==', 'order.datepayment', '2008-02-15 12:34:56')); |
|
| 76 | 76 | |
| 77 | - $items = $manager->searchItems( $search ); |
|
| 77 | + $items = $manager->searchItems($search); |
|
| 78 | 78 | |
| 79 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 79 | + if (($item = reset($items)) !== false) { |
|
| 80 | 80 | return $item; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - throw new \Exception( 'No order item found' ); |
|
| 83 | + throw new \Exception('No order item found'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -35,51 +35,51 @@ |
||
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - $object = new \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product\Standard( $context, $mapping ); |
|
| 39 | - |
|
| 40 | - $subscription = $this->getSubscription( $context ); |
|
| 41 | - $order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->load( $subscription->getOrderBaseId() ); |
|
| 42 | - |
|
| 43 | - $data = $object->process( $subscription, $order ); |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - $this->assertEquals( 1, count( $data ) ); |
|
| 47 | - |
|
| 48 | - $this->assertEquals( 18, count( $data[0] ) ); |
|
| 49 | - $this->assertEquals( 'default', $data[0][0] ); |
|
| 50 | - $this->assertEquals( 'unit_type1', $data[0][1] ); |
|
| 51 | - $this->assertEquals( 'unitsupplier', $data[0][2] ); |
|
| 52 | - $this->assertEquals( 'CNE', $data[0][3] ); |
|
| 53 | - $this->assertGreaterThan( 0, $data[0][4] ); |
|
| 54 | - $this->assertEquals( '9', $data[0][5] ); |
|
| 55 | - $this->assertEquals( 'Cafe Noire Expresso', $data[0][6] ); |
|
| 56 | - $this->assertEquals( 'somewhere/thump1.jpg', $data[0][7] ); |
|
| 57 | - $this->assertEquals( '4.50', $data[0][8] ); |
|
| 58 | - $this->assertEquals( '0.00', $data[0][9] ); |
|
| 59 | - $this->assertEquals( '0.00', $data[0][10] ); |
|
| 60 | - $this->assertEquals( '0.0000', $data[0][11] ); |
|
| 61 | - $this->assertEquals( '1', $data[0][12] ); |
|
| 62 | - $this->assertEquals( '1', $data[0][13] ); |
|
| 63 | - $this->assertEquals( "default\ndefault\nconfig", $data[0][14] ); |
|
| 64 | - $this->assertEquals( "width\nlength\ninterval", $data[0][15] ); |
|
| 65 | - $this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][16] ); |
|
| 66 | - $this->assertEquals( "33\n36\nP0Y1M0W0D", $data[0][17] ); |
|
| 38 | + $object = new \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Product\Standard($context, $mapping); |
|
| 39 | + |
|
| 40 | + $subscription = $this->getSubscription($context); |
|
| 41 | + $order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->load($subscription->getOrderBaseId()); |
|
| 42 | + |
|
| 43 | + $data = $object->process($subscription, $order); |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + $this->assertEquals(1, count($data)); |
|
| 47 | + |
|
| 48 | + $this->assertEquals(18, count($data[0])); |
|
| 49 | + $this->assertEquals('default', $data[0][0]); |
|
| 50 | + $this->assertEquals('unit_type1', $data[0][1]); |
|
| 51 | + $this->assertEquals('unitsupplier', $data[0][2]); |
|
| 52 | + $this->assertEquals('CNE', $data[0][3]); |
|
| 53 | + $this->assertGreaterThan(0, $data[0][4]); |
|
| 54 | + $this->assertEquals('9', $data[0][5]); |
|
| 55 | + $this->assertEquals('Cafe Noire Expresso', $data[0][6]); |
|
| 56 | + $this->assertEquals('somewhere/thump1.jpg', $data[0][7]); |
|
| 57 | + $this->assertEquals('4.50', $data[0][8]); |
|
| 58 | + $this->assertEquals('0.00', $data[0][9]); |
|
| 59 | + $this->assertEquals('0.00', $data[0][10]); |
|
| 60 | + $this->assertEquals('0.0000', $data[0][11]); |
|
| 61 | + $this->assertEquals('1', $data[0][12]); |
|
| 62 | + $this->assertEquals('1', $data[0][13]); |
|
| 63 | + $this->assertEquals("default\ndefault\nconfig", $data[0][14]); |
|
| 64 | + $this->assertEquals("width\nlength\ninterval", $data[0][15]); |
|
| 65 | + $this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][16]); |
|
| 66 | + $this->assertEquals("33\n36\nP0Y1M0W0D", $data[0][17]); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - protected function getSubscription( $context ) |
|
| 70 | + protected function getSubscription($context) |
|
| 71 | 71 | { |
| 72 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
| 72 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
| 73 | 73 | |
| 74 | 74 | $search = $manager->createSearch(); |
| 75 | - $search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) ); |
|
| 75 | + $search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01')); |
|
| 76 | 76 | |
| 77 | - $items = $manager->searchItems( $search ); |
|
| 77 | + $items = $manager->searchItems($search); |
|
| 78 | 78 | |
| 79 | - if( ( $item = reset( $items ) ) !== false ) { |
|
| 79 | + if (($item = reset($items)) !== false) { |
|
| 80 | 80 | return $item; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - throw new \Exception( 'No subscription item found' ); |
|
| 83 | + throw new \Exception('No subscription item found'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function getName() |
| 30 | 30 | { |
| 31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescale product images' ); |
|
| 31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescale product images'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function getDescription() |
| 41 | 41 | { |
| 42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescales product images to the new sizes' ); |
|
| 42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescales product images to the new sizes'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -51,41 +51,41 @@ discard block |
||
| 51 | 51 | public function run() |
| 52 | 52 | { |
| 53 | 53 | $context = $this->getContext(); |
| 54 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
| 55 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
| 54 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
| 55 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
| 56 | 56 | |
| 57 | 57 | $search = $manager->createSearch(); |
| 58 | 58 | $expr = array( |
| 59 | - $search->compare( '==', 'media.domain', 'product' ), |
|
| 60 | - $search->compare( '=~', 'media.mimetype', 'image/' ), |
|
| 59 | + $search->compare('==', 'media.domain', 'product'), |
|
| 60 | + $search->compare('=~', 'media.mimetype', 'image/'), |
|
| 61 | 61 | ); |
| 62 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 63 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
| 62 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 63 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
| 64 | 64 | |
| 65 | 65 | $start = 0; |
| 66 | 66 | |
| 67 | 67 | do |
| 68 | 68 | { |
| 69 | - $search->setSlice( $start ); |
|
| 70 | - $items = $manager->searchItems( $search ); |
|
| 69 | + $search->setSlice($start); |
|
| 70 | + $items = $manager->searchItems($search); |
|
| 71 | 71 | |
| 72 | - foreach( $items as $item ) |
|
| 72 | + foreach ($items as $item) |
|
| 73 | 73 | { |
| 74 | 74 | try |
| 75 | 75 | { |
| 76 | - $cntl->scale( $item, 'fs-media' ); |
|
| 77 | - $manager->saveItem( $item ); |
|
| 76 | + $cntl->scale($item, 'fs-media'); |
|
| 77 | + $manager->saveItem($item); |
|
| 78 | 78 | } |
| 79 | - catch( \Exception $e ) |
|
| 79 | + catch (\Exception $e) |
|
| 80 | 80 | { |
| 81 | - $msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() ); |
|
| 82 | - $context->getLogger()->log( $msg ); |
|
| 81 | + $msg = sprintf('Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage()); |
|
| 82 | + $context->getLogger()->log($msg); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $count = count( $items ); |
|
| 86 | + $count = count($items); |
|
| 87 | 87 | $start += $count; |
| 88 | 88 | } |
| 89 | - while( $count === $search->getSliceSize() ); |
|
| 89 | + while ($count === $search->getSliceSize()); |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -75,8 +75,7 @@ |
||
| 75 | 75 | { |
| 76 | 76 | $cntl->scale( $item, 'fs-media' ); |
| 77 | 77 | $manager->saveItem( $item ); |
| 78 | - } |
|
| 79 | - catch( \Exception $e ) |
|
| 78 | + } catch( \Exception $e ) |
|
| 80 | 79 | { |
| 81 | 80 | $msg = sprintf( 'Scaling media item "%1$s" failed: %2$s', $item->getId(), $e->getMessage() ); |
| 82 | 81 | $context->getLogger()->log( $msg ); |
@@ -40,21 +40,21 @@ |
||
| 40 | 40 | * @param array $data List of CSV fields with position as key and data as value |
| 41 | 41 | * @return array List of data which hasn't been imported |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data ) |
|
| 43 | + public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data) |
|
| 44 | 44 | { |
| 45 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
| 46 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
| 45 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
| 46 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
| 47 | 47 | |
| 48 | - foreach( $map as $list ) |
|
| 48 | + foreach ($map as $list) |
|
| 49 | 49 | { |
| 50 | - if( trim( $list['coupon.code.code'] ) == '' ) { |
|
| 50 | + if (trim($list['coupon.code.code']) == '') { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $item->fromArray( $list ); |
|
| 55 | - $manager->saveItem( $item ); |
|
| 54 | + $item->fromArray($list); |
|
| 55 | + $manager->saveItem($item); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - return $this->getObject()->process( $item, $data ); |
|
| 58 | + return $this->getObject()->process($item, $data); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | public static function bootstrap() |
| 16 | 16 | { |
| 17 | 17 | self::getAimeos(); |
| 18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 18 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - public static function getContext( $site = 'unittest' ) |
|
| 22 | + public static function getContext($site = 'unittest') |
|
| 23 | 23 | { |
| 24 | - if( !isset( self::$context[$site] ) ) { |
|
| 25 | - self::$context[$site] = self::createContext( $site ); |
|
| 24 | + if (!isset(self::$context[$site])) { |
|
| 25 | + self::$context[$site] = self::createContext($site); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public static function getAimeos() |
| 33 | 33 | { |
| 34 | - if( !isset( self::$aimeos ) ) |
|
| 34 | + if (!isset(self::$aimeos)) |
|
| 35 | 35 | { |
| 36 | 36 | require_once 'Bootstrap.php'; |
| 37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 38 | 38 | |
| 39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
| 40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
| 39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
| 40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return self::$aimeos; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @param string $site |
| 49 | 49 | */ |
| 50 | - private static function createContext( $site ) |
|
| 50 | + private static function createContext($site) |
|
| 51 | 51 | { |
| 52 | 52 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 53 | 53 | $aimeos = self::getAimeos(); |
@@ -57,30 +57,30 @@ discard block |
||
| 57 | 57 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 58 | 58 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 59 | 59 | |
| 60 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
| 61 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 62 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 63 | - $ctx->setConfig( $conf ); |
|
| 60 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
| 61 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 62 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 63 | + $ctx->setConfig($conf); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 67 | - $ctx->setDatabaseManager( $dbm ); |
|
| 66 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 67 | + $ctx->setDatabaseManager($dbm); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 71 | - $ctx->setLogger( $logger ); |
|
| 70 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 71 | + $ctx->setLogger($logger); |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | $session = new \Aimeos\MW\Session\None(); |
| 75 | - $ctx->setSession( $session ); |
|
| 75 | + $ctx->setSession($session); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 79 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 80 | - $ctx->setLocale( $locale ); |
|
| 78 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 79 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 80 | + $ctx->setLocale($locale); |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - $ctx->setEditor( 'core:controller/common' ); |
|
| 83 | + $ctx->setEditor('core:controller/common'); |
|
| 84 | 84 | |
| 85 | 85 | return $ctx; |
| 86 | 86 | } |
@@ -115,6 +115,10 @@ discard block |
||
| 115 | 115 | return \TestHelperCntl::getContext(); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $type |
|
| 120 | + * @param string $name |
|
| 121 | + */ |
|
| 118 | 122 | public function getCachePublic( $type, $name = null ) |
| 119 | 123 | { |
| 120 | 124 | return $this->getCache( $type, $name ); |
@@ -127,6 +131,11 @@ discard block |
||
| 127 | 131 | } |
| 128 | 132 | |
| 129 | 133 | |
| 134 | + /** |
|
| 135 | + * @param string $path |
|
| 136 | + * @param string $domain |
|
| 137 | + * @param string $code |
|
| 138 | + */ |
|
| 130 | 139 | public function getTypeIdPublic( $path, $domain, $code ) |
| 131 | 140 | { |
| 132 | 141 | return $this->getTypeId( $path, $domain, $code ); |
@@ -16,92 +16,92 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 19 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 20 | 20 | |
| 21 | 21 | $context = \TestHelperCntl::getContext(); |
| 22 | 22 | $aimeos = \TestHelperCntl::getAimeos(); |
| 23 | 23 | |
| 24 | - $this->object = new TestAbstract( $context, $aimeos ); |
|
| 24 | + $this->object = new TestAbstract($context, $aimeos); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 30 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 31 | 31 | \Aimeos\MShop\Factory::clear(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | public function testGetCache() |
| 36 | 36 | { |
| 37 | - $cache = $this->object->getCachePublic( 'attribute' ); |
|
| 37 | + $cache = $this->object->getCachePublic('attribute'); |
|
| 38 | 38 | |
| 39 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache ); |
|
| 39 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testGetCacheInvalidType() |
| 44 | 44 | { |
| 45 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 46 | - $this->object->getCachePublic( '$' ); |
|
| 45 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 46 | + $this->object->getCachePublic('$'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetCacheInvalidClass() |
| 51 | 51 | { |
| 52 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 53 | - $this->object->getCachePublic( 'unknown' ); |
|
| 52 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 53 | + $this->object->getCachePublic('unknown'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testGetCacheInvalidInterface() |
| 58 | 58 | { |
| 59 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 60 | - $this->object->getCachePublic( 'attribute', 'unknown' ); |
|
| 59 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 60 | + $this->object->getCachePublic('attribute', 'unknown'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function testGetProcessors() |
| 65 | 65 | { |
| 66 | - $processor = $this->object->getProcessorsPublic( array( 'attribute' => [] ) ); |
|
| 66 | + $processor = $this->object->getProcessorsPublic(array('attribute' => [])); |
|
| 67 | 67 | |
| 68 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor ); |
|
| 68 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | public function testGetProcessorsInvalidType() |
| 73 | 73 | { |
| 74 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 75 | - $this->object->getProcessorsPublic( array( '$' => [] ) ); |
|
| 74 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 75 | + $this->object->getProcessorsPublic(array('$' => [])); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | public function testGetProcessorsInvalidClass() |
| 80 | 80 | { |
| 81 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 82 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
| 81 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 82 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | public function testGetProcessorsInvalidInterface() |
| 87 | 87 | { |
| 88 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 89 | - $this->object->getProcessorsPublic( array( 'unknown' => [] ) ); |
|
| 88 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 89 | + $this->object->getProcessorsPublic(array('unknown' => [])); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testGetTypeId() |
| 94 | 94 | { |
| 95 | - $typeid = $this->object->getTypeIdPublic( 'attribute/type', 'product', 'color' ); |
|
| 95 | + $typeid = $this->object->getTypeIdPublic('attribute/type', 'product', 'color'); |
|
| 96 | 96 | |
| 97 | - $this->assertNotEquals( null, $typeid ); |
|
| 97 | + $this->assertNotEquals(null, $typeid); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | public function testGetTypeIdUnknown() |
| 102 | 102 | { |
| 103 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 104 | - $this->object->getTypeIdPublic( 'attribute/type', 'product', 'unknown' ); |
|
| 103 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 104 | + $this->object->getTypeIdPublic('attribute/type', 'product', 'unknown'); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -115,21 +115,21 @@ discard block |
||
| 115 | 115 | return \TestHelperCntl::getContext(); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function getCachePublic( $type, $name = null ) |
|
| 118 | + public function getCachePublic($type, $name = null) |
|
| 119 | 119 | { |
| 120 | - return $this->getCache( $type, $name ); |
|
| 120 | + return $this->getCache($type, $name); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - public function getProcessorsPublic( array $mappings ) |
|
| 124 | + public function getProcessorsPublic(array $mappings) |
|
| 125 | 125 | { |
| 126 | - return $this->getProcessors( $mappings ); |
|
| 126 | + return $this->getProcessors($mappings); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - public function getTypeIdPublic( $path, $domain, $code ) |
|
| 130 | + public function getTypeIdPublic($path, $domain, $code) |
|
| 131 | 131 | { |
| 132 | - return $this->getTypeId( $path, $domain, $code ); |
|
| 132 | + return $this->getTypeId($path, $domain, $code); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -104,37 +104,37 @@ |
||
| 104 | 104 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values |
| 105 | 105 | * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object |
| 106 | 106 | */ |
| 107 | - protected function getProcessors( array $mappings ) |
|
| 107 | + protected function getProcessors(array $mappings) |
|
| 108 | 108 | { |
| 109 | 109 | $list = []; |
| 110 | 110 | $context = $this->getContext(); |
| 111 | 111 | $config = $context->getConfig(); |
| 112 | 112 | |
| 113 | - foreach( $mappings as $type => $mapping ) |
|
| 113 | + foreach ($mappings as $type => $mapping) |
|
| 114 | 114 | { |
| 115 | - if( ctype_alnum( $type ) === false ) |
|
| 115 | + if (ctype_alnum($type) === false) |
|
| 116 | 116 | { |
| 117 | 117 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type : '<not a string>'; |
| 118 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 118 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $name = $config->get( 'controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard' ); |
|
| 121 | + $name = $config->get('controller/common/subscription/export/csv/processor/' . $type . '/name', 'Standard'); |
|
| 122 | 122 | |
| 123 | - if( ctype_alnum( $name ) === false ) |
|
| 123 | + if (ctype_alnum($name) === false) |
|
| 124 | 124 | { |
| 125 | 125 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
| 126 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 126 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
| 129 | + $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
| 130 | 130 | |
| 131 | - if( class_exists( $classname ) === false ) { |
|
| 132 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 131 | + if (class_exists($classname) === false) { |
|
| 132 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $object = new $classname( $context, $mapping ); |
|
| 135 | + $object = new $classname($context, $mapping); |
|
| 136 | 136 | |
| 137 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object ); |
|
| 137 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Subscription\\Export\\Csv\\Processor\\Iface', $object); |
|
| 138 | 138 | |
| 139 | 139 | $list[$type] = $object; |
| 140 | 140 | } |