Completed
Push — master ( b6a23a...c3c77b )
by Aimeos
03:07
created
controller/jobs/tests/Controller/Jobs/Index/Rebuild/FactoryTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 		$context = \TestHelperJobs::getContext();
18 18
 		$aimeos = \TestHelperJobs::getAimeos();
19 19
 
20
-		$obj = \Aimeos\Controller\Jobs\Index\Rebuild\Factory::create( $context, $aimeos );
21
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
20
+		$obj = \Aimeos\Controller\Jobs\Index\Rebuild\Factory::create($context, $aimeos);
21
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj);
22 22
 	}
23 23
 
24 24
 
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 		$context = \TestHelperJobs::getContext();
28 28
 		$aimeos = \TestHelperJobs::getAimeos();
29 29
 
30
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
31
-		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create( $context, $aimeos, 'Wrong$$$Name' );
30
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
31
+		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create($context, $aimeos, 'Wrong$$$Name');
32 32
 	}
33 33
 
34 34
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 		$context = \TestHelperJobs::getContext();
38 38
 		$aimeos = \TestHelperJobs::getAimeos();
39 39
 
40
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
41
-		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create( $context, $aimeos, 'WrongClass' );
40
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
41
+		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create($context, $aimeos, 'WrongClass');
42 42
 	}
43 43
 
44 44
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 		$context = \TestHelperJobs::getContext();
48 48
 		$aimeos = \TestHelperJobs::getAimeos();
49 49
 
50
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
51
-		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create( $context, $aimeos, 'Factory' );
50
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
51
+		\Aimeos\Controller\Jobs\Index\Rebuild\Factory::create($context, $aimeos, 'Factory');
52 52
 	}
53 53
 
54 54
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Coupon/Import/Csv/Code/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -18,93 +18,93 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 		$config = $this->context->getConfig();
26 26
 
27
-		$config->set( 'controller/jobs/product/import/csv/skip-lines', 1 );
27
+		$config->set('controller/jobs/product/import/csv/skip-lines', 1);
28 28
 
29
-		$this->object = new \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Standard( $this->context, $this->aimeos );
29
+		$this->object = new \Aimeos\Controller\Jobs\Coupon\Import\Csv\Code\Standard($this->context, $this->aimeos);
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		\Aimeos\MShop::cache( false );
36
-		unset( $this->object );
35
+		\Aimeos\MShop::cache(false);
36
+		unset($this->object);
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testGetName()
41 41
 	{
42
-		$this->assertEquals( 'Coupon code import CSV', $this->object->getName() );
42
+		$this->assertEquals('Coupon code import CSV', $this->object->getName());
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testGetDescription()
47 47
 	{
48 48
 		$text = 'Imports new and updates existing coupon code from CSV files';
49
-		$this->assertEquals( $text, $this->object->getDescription() );
49
+		$this->assertEquals($text, $this->object->getDescription());
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testRun()
54 54
 	{
55
-		$manager = \Aimeos\MShop::create( $this->context, 'coupon' );
56
-		$coupon = $manager->saveItem( $manager->createItem()->setProvider( 'Example' ) );
55
+		$manager = \Aimeos\MShop::create($this->context, 'coupon');
56
+		$coupon = $manager->saveItem($manager->createItem()->setProvider('Example'));
57 57
 
58 58
 		$dir = 'tmp/import/couponcode/unittest';
59 59
 		$filepath = $dir . '/' . $coupon->getId() . '.csv';
60 60
 
61
-		if( !is_dir( $dir ) && mkdir( 'tmp/import/couponcode/unittest', 0775, true ) === false ) {
62
-			throw new \Exception( sprintf( 'Unable to create directory "%1$s"', $dir ) );
61
+		if (!is_dir($dir) && mkdir('tmp/import/couponcode/unittest', 0775, true) === false) {
62
+			throw new \Exception(sprintf('Unable to create directory "%1$s"', $dir));
63 63
 		}
64 64
 
65 65
 		$content = 'code,count,start,end
66 66
 jobccimport1,3,2000-01-01 00:00:00,
67 67
 jobccimport2,5,,';
68 68
 
69
-		if( file_put_contents( $filepath, $content ) === false ) {
70
-			throw new \Exception( sprintf( 'Unable to create file "%1$s"', $file ) );
69
+		if (file_put_contents($filepath, $content) === false) {
70
+			throw new \Exception(sprintf('Unable to create file "%1$s"', $file));
71 71
 		}
72 72
 
73 73
 		$this->object->run();
74 74
 
75 75
 
76
-		$codeManager = \Aimeos\MShop::create( $this->context, 'coupon/code' );
77
-		$code1 = $codeManager->findItem( 'jobccimport1' );
78
-		$code2 = $codeManager->findItem( 'jobccimport2' );
76
+		$codeManager = \Aimeos\MShop::create($this->context, 'coupon/code');
77
+		$code1 = $codeManager->findItem('jobccimport1');
78
+		$code2 = $codeManager->findItem('jobccimport2');
79 79
 
80
-		$manager->deleteItem( $coupon->getId() );
80
+		$manager->deleteItem($coupon->getId());
81 81
 
82
-		$this->assertEquals( 3, $code1->getCount() );
83
-		$this->assertEquals( '2000-01-01 00:00:00', $code1->getDateStart() );
84
-		$this->assertEquals( null, $code1->getDateEnd() );
82
+		$this->assertEquals(3, $code1->getCount());
83
+		$this->assertEquals('2000-01-01 00:00:00', $code1->getDateStart());
84
+		$this->assertEquals(null, $code1->getDateEnd());
85 85
 
86
-		$this->assertEquals( 5, $code2->getCount() );
87
-		$this->assertEquals( null, $code2->getDateStart() );
88
-		$this->assertEquals( null, $code2->getDateEnd() );
86
+		$this->assertEquals(5, $code2->getCount());
87
+		$this->assertEquals(null, $code2->getDateStart());
88
+		$this->assertEquals(null, $code2->getDateEnd());
89 89
 	}
90 90
 
91 91
 
92 92
 	public function testRunException()
93 93
 	{
94
-		$manager = \Aimeos\MShop::create( $this->context, 'coupon' );
94
+		$manager = \Aimeos\MShop::create($this->context, 'coupon');
95 95
 
96 96
 		$dir = 'tmp/import/couponcode/unittest';
97 97
 		$filepath = $dir . '/0.csv';
98 98
 
99
-		if( !is_dir( $dir ) && mkdir( 'tmp/import/couponcode/unittest', 0775, true ) === false ) {
100
-			throw new \Exception( sprintf( 'Unable to create directory "%1$s"', $dir ) );
99
+		if (!is_dir($dir) && mkdir('tmp/import/couponcode/unittest', 0775, true) === false) {
100
+			throw new \Exception(sprintf('Unable to create directory "%1$s"', $dir));
101 101
 		}
102 102
 
103 103
 		$content = 'code,count,start,end
104 104
 jobccimport1,,,';
105 105
 
106
-		if( file_put_contents( $filepath, $content ) === false ) {
107
-			throw new \Exception( sprintf( 'Unable to create file "%1$s"', $file ) );
106
+		if (file_put_contents($filepath, $content) === false) {
107
+			throw new \Exception(sprintf('Unable to create file "%1$s"', $file));
108 108
 		}
109 109
 
110 110
 		$this->object->run();
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Renew/StandardTest.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -21,60 +21,60 @@  discard block
 block discarded – undo
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::cache( true );
26
+		\Aimeos\MShop::cache(true);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop::cache( false );
33
-		unset( $this->object, $this->context, $this->aimeos );
32
+		\Aimeos\MShop::cache(false);
33
+		unset($this->object, $this->context, $this->aimeos);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testGetName()
38 38
 	{
39
-		$this->assertEquals( 'Subscription process renew', $this->object->getName() );
39
+		$this->assertEquals('Subscription process renew', $this->object->getName());
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetDescription()
44 44
 	{
45
-		$this->assertEquals( 'Renews subscriptions at next date', $this->object->getDescription() );
45
+		$this->assertEquals('Renews subscriptions at next date', $this->object->getDescription());
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testRun()
50 50
 	{
51
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
51
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
52 52
 		$item = $this->getSubscription();
53 53
 
54
-		$object = $this->getMockBuilder( '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard' )
55
-			->setConstructorArgs( [$this->context, $this->aimeos] )
56
-			->setMethods( ['createOrderBase', 'createOrderInvoice', 'createPayment'] )
54
+		$object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard')
55
+			->setConstructorArgs([$this->context, $this->aimeos])
56
+			->setMethods(['createOrderBase', 'createOrderInvoice', 'createPayment'])
57 57
 			->getMock();
58 58
 
59
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
60
-			->setConstructorArgs( [$this->context] )
61
-			->setMethods( ['searchItems', 'saveItem'] )
59
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
60
+			->setConstructorArgs([$this->context])
61
+			->setMethods(['searchItems', 'saveItem'])
62 62
 			->getMock();
63 63
 
64
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
64
+		\Aimeos\MShop::inject('subscription', $managerStub);
65 65
 
66
-		$object->expects( $this->once() )->method( 'createOrderBase' )
67
-			->will( $this->returnValue( $this->getOrderBaseItem( $item->getOrderBaseId() ) ) );
66
+		$object->expects($this->once())->method('createOrderBase')
67
+			->will($this->returnValue($this->getOrderBaseItem($item->getOrderBaseId())));
68 68
 
69
-		$object->expects( $this->once() )->method( 'createOrderInvoice' )
70
-			->will( $this->returnValue( $this->getOrderItem() ) );
69
+		$object->expects($this->once())->method('createOrderInvoice')
70
+			->will($this->returnValue($this->getOrderItem()));
71 71
 
72
-		$object->expects( $this->once() )->method( 'createPayment' );
72
+		$object->expects($this->once())->method('createPayment');
73 73
 
74
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
75
-			->will( $this->returnValue( [$item] ) );
74
+		$managerStub->expects($this->once())->method('searchItems')
75
+			->will($this->returnValue([$item]));
76 76
 
77
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
77
+		$managerStub->expects($this->once())->method('saveItem');
78 78
 
79 79
 		$object->run();
80 80
 	}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 
83 83
 	public function testRunException()
84 84
 	{
85
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
85
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
86 86
 
87
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
88
-			->setConstructorArgs( [$this->context] )
89
-			->setMethods( ['searchItems', 'saveItem'] )
87
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
88
+			->setConstructorArgs([$this->context])
89
+			->setMethods(['searchItems', 'saveItem'])
90 90
 			->getMock();
91 91
 
92
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
92
+		\Aimeos\MShop::inject('subscription', $managerStub);
93 93
 
94
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
95
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
94
+		$managerStub->expects($this->once())->method('searchItems')
95
+			->will($this->returnValue([$managerStub->createItem()]));
96 96
 
97
-		$managerStub->expects( $this->never() )->method( 'saveItem' );
97
+		$managerStub->expects($this->never())->method('saveItem');
98 98
 
99 99
 		$this->object->run();
100 100
 	}
@@ -102,79 +102,79 @@  discard block
 block discarded – undo
102 102
 
103 103
 	public function testAddBasketAddresses()
104 104
 	{
105
-		$basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem();
106
-		$address = \Aimeos\MShop::create( $this->context, 'order/base/address' )->createItem();
105
+		$basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem();
106
+		$address = \Aimeos\MShop::create($this->context, 'order/base/address')->createItem();
107 107
 
108 108
 		$addresses = ['payment' => $address];
109
-		$basket = $this->access( 'addBasketAddresses' )->invokeArgs( $this->object, [$this->context, $basket, $addresses] );
109
+		$basket = $this->access('addBasketAddresses')->invokeArgs($this->object, [$this->context, $basket, $addresses]);
110 110
 
111
-		$this->assertEquals( 1, count( $basket->getAddresses() ) );
112
-		$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress( 'payment' ) );
111
+		$this->assertEquals(1, count($basket->getAddresses()));
112
+		$this->assertInstanceOf(\Aimeos\MShop\Order\Item\Base\Address\Iface::class, $basket->getAddress('payment'));
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testAddBasketCoupons()
117 117
 	{
118
-		$this->context->getConfig()->set( 'controller/jobs/subcription/process/renew/standard/use-coupons', true );
118
+		$this->context->getConfig()->set('controller/jobs/subcription/process/renew/standard/use-coupons', true);
119 119
 
120
-		$basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem();
121
-		$product = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC', ['price'] );
122
-		$orderProduct = \Aimeos\MShop::create( $this->context, 'order/base/product' )->createItem();
120
+		$basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem();
121
+		$product = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC', ['price']);
122
+		$orderProduct = \Aimeos\MShop::create($this->context, 'order/base/product')->createItem();
123 123
 
124
-		$price = $product->getRefItems( 'price', 'default', 'default' );
125
-		$basket->addProduct( $orderProduct->copyFrom( $product )->setPrice( reset( $price ) ) );
124
+		$price = $product->getRefItems('price', 'default', 'default');
125
+		$basket->addProduct($orderProduct->copyFrom($product)->setPrice(reset($price)));
126 126
 
127
-		$this->assertEquals( '600.00', $basket->getPrice()->getValue() );
128
-		$this->assertEquals( '30.00', $basket->getPrice()->getCosts() );
129
-		$this->assertEquals( '0.00', $basket->getPrice()->getRebate() );
127
+		$this->assertEquals('600.00', $basket->getPrice()->getValue());
128
+		$this->assertEquals('30.00', $basket->getPrice()->getCosts());
129
+		$this->assertEquals('0.00', $basket->getPrice()->getRebate());
130 130
 
131
-		$basket = $this->access( 'addBasketCoupons' )->invokeArgs( $this->object, [$this->context, $basket, ['90AB']] );
131
+		$basket = $this->access('addBasketCoupons')->invokeArgs($this->object, [$this->context, $basket, ['90AB']]);
132 132
 
133
-		$this->assertEquals( 1, count( $basket->getCoupons() ) );
134
-		$this->assertEquals( 2, count( $basket->getProducts() ) );
135
-		$this->assertEquals( '537.00', $basket->getPrice()->getValue() );
136
-		$this->assertEquals( '30.00', $basket->getPrice()->getCosts() );
137
-		$this->assertEquals( '63.00', $basket->getPrice()->getRebate() );
133
+		$this->assertEquals(1, count($basket->getCoupons()));
134
+		$this->assertEquals(2, count($basket->getProducts()));
135
+		$this->assertEquals('537.00', $basket->getPrice()->getValue());
136
+		$this->assertEquals('30.00', $basket->getPrice()->getCosts());
137
+		$this->assertEquals('63.00', $basket->getPrice()->getRebate());
138 138
 	}
139 139
 
140 140
 
141 141
 	public function testAddBasketProducts()
142 142
 	{
143
-		$basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem();
144
-		$product = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' );
145
-		$manager = \Aimeos\MShop::create( $this->context, 'order/base/product' );
143
+		$basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem();
144
+		$product = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC');
145
+		$manager = \Aimeos\MShop::create($this->context, 'order/base/product');
146 146
 
147 147
 		$orderProducts = [
148
-			$manager->createItem()->copyFrom( $product )->setId( 1 ),
149
-			$manager->createItem()->copyFrom( $product )->setId( 2 ),
148
+			$manager->createItem()->copyFrom($product)->setId(1),
149
+			$manager->createItem()->copyFrom($product)->setId(2),
150 150
 		];
151 151
 
152
-		$basket = $this->access( 'addBasketProducts' )->invokeArgs( $this->object, [$this->context, $basket, $orderProducts, 1] );
152
+		$basket = $this->access('addBasketProducts')->invokeArgs($this->object, [$this->context, $basket, $orderProducts, 1]);
153 153
 
154
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
155
-		$this->assertNull( $basket->getProduct( 0 )->getId() );
154
+		$this->assertEquals(1, count($basket->getProducts()));
155
+		$this->assertNull($basket->getProduct(0)->getId());
156 156
 	}
157 157
 
158 158
 
159 159
 	public function testAddBasketServices()
160 160
 	{
161
-		$basket = \Aimeos\MShop::create( $this->context, 'order/base' )->createItem();
162
-		$manager = \Aimeos\MShop::create( $this->context, 'order/base/service' );
161
+		$basket = \Aimeos\MShop::create($this->context, 'order/base')->createItem();
162
+		$manager = \Aimeos\MShop::create($this->context, 'order/base/service');
163 163
 
164 164
 		$orderServices = [
165
-			'delivery' => [$manager->createItem()->setCode( 'shiptest' )],
166
-			'payment' => [$manager->createItem()->setCode( 'paytest' )],
165
+			'delivery' => [$manager->createItem()->setCode('shiptest')],
166
+			'payment' => [$manager->createItem()->setCode('paytest')],
167 167
 		];
168 168
 
169
-		$basket = $this->access( 'addBasketServices' )->invokeArgs( $this->object, [$this->context, $basket, $orderServices] );
169
+		$basket = $this->access('addBasketServices')->invokeArgs($this->object, [$this->context, $basket, $orderServices]);
170 170
 
171 171
 		$class = \Aimeos\MShop\Order\Item\Base\Service\Iface::class;
172 172
 
173
-		$this->assertEquals( 2, count( $basket->getServices() ) );
174
-		$this->assertEquals( 1, count( $basket->getService( 'delivery' ) ) );
175
-		$this->assertInstanceOf( $class, $basket->getService( 'delivery', 'unitcode' ) );
176
-		$this->assertEquals( 1, count( $basket->getService( 'payment' ) ) );
177
-		$this->assertInstanceOf( $class, $basket->getService( 'payment', 'paytest' ) );
173
+		$this->assertEquals(2, count($basket->getServices()));
174
+		$this->assertEquals(1, count($basket->getService('delivery')));
175
+		$this->assertInstanceOf($class, $basket->getService('delivery', 'unitcode'));
176
+		$this->assertEquals(1, count($basket->getService('payment')));
177
+		$this->assertInstanceOf($class, $basket->getService('payment', 'paytest'));
178 178
 	}
179 179
 
180 180
 
@@ -182,34 +182,34 @@  discard block
 block discarded – undo
182 182
 	{
183 183
 		$item = $this->getSubscription();
184 184
 
185
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' )
186
-			->setConstructorArgs( [$this->context] )
187
-			->setMethods( ['store'] )
185
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')
186
+			->setConstructorArgs([$this->context])
187
+			->setMethods(['store'])
188 188
 			->getMock();
189 189
 
190
-		\Aimeos\MShop::inject( 'order/base', $managerStub );
190
+		\Aimeos\MShop::inject('order/base', $managerStub);
191 191
 
192
-		$managerStub->expects( $this->once() )->method( 'store' );
192
+		$managerStub->expects($this->once())->method('store');
193 193
 
194
-		$this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] );
194
+		$this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]);
195 195
 	}
196 196
 
197 197
 
198 198
 	public function testCreateOrderInvoice()
199 199
 	{
200 200
 		$item = $this->getSubscription();
201
-		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() );
201
+		$baseItem = $this->getOrderBaseItem($item->getOrderBaseId());
202 202
 
203
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
204
-			->setConstructorArgs( [$this->context] )
205
-			->setMethods( ['saveItem'] )
203
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
204
+			->setConstructorArgs([$this->context])
205
+			->setMethods(['saveItem'])
206 206
 			->getMock();
207 207
 
208
-		\Aimeos\MShop::inject( 'order', $managerStub );
208
+		\Aimeos\MShop::inject('order', $managerStub);
209 209
 
210
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
210
+		$managerStub->expects($this->once())->method('saveItem');
211 211
 
212
-		$this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] );
212
+		$this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]);
213 213
 	}
214 214
 
215 215
 
@@ -217,55 +217,55 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		$item = $this->getSubscription();
219 219
 		$invoice = $this->getOrderItem();
220
-		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() );
220
+		$baseItem = $this->getOrderBaseItem($item->getOrderBaseId());
221 221
 
222
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
223
-			->setConstructorArgs( [$this->context] )
224
-			->setMethods( ['saveItem'] )
222
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
223
+			->setConstructorArgs([$this->context])
224
+			->setMethods(['saveItem'])
225 225
 			->getMock();
226 226
 
227
-		\Aimeos\MShop::inject( 'order', $managerStub );
227
+		\Aimeos\MShop::inject('order', $managerStub);
228 228
 
229
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
229
+		$managerStub->expects($this->once())->method('saveItem');
230 230
 
231
-		$this->access( 'createPayment' )->invokeArgs( $this->object, [$this->context, $baseItem, $invoice] );
231
+		$this->access('createPayment')->invokeArgs($this->object, [$this->context, $baseItem, $invoice]);
232 232
 	}
233 233
 
234 234
 
235 235
 	protected function getOrderItem()
236 236
 	{
237
-		return \Aimeos\MShop::create( $this->context, 'order' )->createItem();
237
+		return \Aimeos\MShop::create($this->context, 'order')->createItem();
238 238
 	}
239 239
 
240 240
 
241
-	protected function getOrderBaseItem( $baseId )
241
+	protected function getOrderBaseItem($baseId)
242 242
 	{
243
-		return \Aimeos\MShop::create( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] );
243
+		return \Aimeos\MShop::create($this->context, 'order/base')->getItem($baseId, ['order/base/service']);
244 244
 	}
245 245
 
246 246
 
247 247
 	protected function getSubscription()
248 248
 	{
249
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
249
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
250 250
 
251 251
 		$search = $manager->createSearch();
252
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
252
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
253 253
 
254
-		$items = $manager->searchItems( $search );
254
+		$items = $manager->searchItems($search);
255 255
 
256
-		if( ( $item = reset( $items ) ) !== false ) {
256
+		if (($item = reset($items)) !== false) {
257 257
 			return $item;
258 258
 		}
259 259
 
260
-		throw new \Exception( 'No subscription item found' );
260
+		throw new \Exception('No subscription item found');
261 261
 	}
262 262
 
263 263
 
264
-	protected function access( $name )
264
+	protected function access($name)
265 265
 	{
266
-		$class = new \ReflectionClass( \Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class );
267
-		$method = $class->getMethod( $name );
268
-		$method->setAccessible( true );
266
+		$class = new \ReflectionClass(\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard::class);
267
+		$method = $class->getMethod($name);
268
+		$method->setAccessible(true);
269 269
 
270 270
 		return $method;
271 271
 	}
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/StanardTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,47 +20,47 @@  discard block
 block discarded – undo
20 20
 		$aimeos = \TestHelperJobs::getAimeos();
21 21
 		$this->context = \TestHelperJobs::getContext();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos);
24 24
 
25
-		\Aimeos\MShop::cache( true );
25
+		\Aimeos\MShop::cache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop::cache( false );
32
-		unset( $this->object, $this->context );
31
+		\Aimeos\MShop::cache(false);
32
+		unset($this->object, $this->context);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testGetName()
37 37
 	{
38
-		$this->assertEquals( 'Subscription process start', $this->object->getName() );
38
+		$this->assertEquals('Subscription process start', $this->object->getName());
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testGetDescription()
43 43
 	{
44
-		$this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() );
44
+		$this->assertEquals('Process subscriptions initially', $this->object->getDescription());
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testRun()
49 49
 	{
50
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
50
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
51 51
 		$item = $this->getSubscription();
52 52
 
53
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
54
-			->setConstructorArgs( [$this->context] )
55
-			->setMethods( ['searchItems', 'saveItem'] )
53
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
54
+			->setConstructorArgs([$this->context])
55
+			->setMethods(['searchItems', 'saveItem'])
56 56
 			->getMock();
57 57
 
58
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
58
+		\Aimeos\MShop::inject('subscription', $managerStub);
59 59
 
60
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
61
-			->will( $this->returnValue( [$item] ) );
60
+		$managerStub->expects($this->once())->method('searchItems')
61
+			->will($this->returnValue([$item]));
62 62
 
63
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
63
+		$managerStub->expects($this->once())->method('saveItem');
64 64
 
65 65
 		$this->object->run();
66 66
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 
69 69
 	public function testRunException()
70 70
 	{
71
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
72
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] );
71
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
72
+		$this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']);
73 73
 
74
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
75
-			->setConstructorArgs( [$this->context] )
76
-			->setMethods( ['searchItems', 'saveItem'] )
74
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
75
+			->setConstructorArgs([$this->context])
76
+			->setMethods(['searchItems', 'saveItem'])
77 77
 			->getMock();
78 78
 
79
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
79
+		\Aimeos\MShop::inject('subscription', $managerStub);
80 80
 
81
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
82
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
81
+		$managerStub->expects($this->once())->method('searchItems')
82
+			->will($this->returnValue([$managerStub->createItem()]));
83 83
 
84
-		$managerStub->expects( $this->once() )->method( 'saveItem' )
85
-			->will( $this->throwException( new \Exception() ) );
84
+		$managerStub->expects($this->once())->method('saveItem')
85
+			->will($this->throwException(new \Exception()));
86 86
 
87 87
 		$this->object->run();
88 88
 	}
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
 	protected function getSubscription()
92 92
 	{
93
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
93
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
94 94
 
95 95
 		$search = $manager->createSearch();
96
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
96
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
97 97
 
98
-		$items = $manager->searchItems( $search );
98
+		$items = $manager->searchItems($search);
99 99
 
100
-		if( ( $item = reset( $items ) ) !== false ) {
100
+		if (($item = reset($items)) !== false) {
101 101
 			return $item;
102 102
 		}
103 103
 
104
-		throw new \Exception( 'No subscription item found' );
104
+		throw new \Exception('No subscription item found');
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/End/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,47 +20,47 @@  discard block
 block discarded – undo
20 20
 		$aimeos = \TestHelperJobs::getAimeos();
21 21
 		$this->context = \TestHelperJobs::getContext();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard( $this->context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\End\Standard($this->context, $aimeos);
24 24
 
25
-		\Aimeos\MShop::cache( true );
25
+		\Aimeos\MShop::cache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop::cache( false );
32
-		unset( $this->object, $this->context );
31
+		\Aimeos\MShop::cache(false);
32
+		unset($this->object, $this->context);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testGetName()
37 37
 	{
38
-		$this->assertEquals( 'Subscription process end', $this->object->getName() );
38
+		$this->assertEquals('Subscription process end', $this->object->getName());
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testGetDescription()
43 43
 	{
44
-		$this->assertEquals( 'Terminates expired subscriptions', $this->object->getDescription() );
44
+		$this->assertEquals('Terminates expired subscriptions', $this->object->getDescription());
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testRun()
49 49
 	{
50
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
50
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
51 51
 		$item = $this->getSubscription();
52 52
 
53
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
54
-			->setConstructorArgs( [$this->context] )
55
-			->setMethods( ['searchItems', 'saveItem'] )
53
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
54
+			->setConstructorArgs([$this->context])
55
+			->setMethods(['searchItems', 'saveItem'])
56 56
 			->getMock();
57 57
 
58
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
58
+		\Aimeos\MShop::inject('subscription', $managerStub);
59 59
 
60
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
61
-			->will( $this->returnValue( [$item] ) );
60
+		$managerStub->expects($this->once())->method('searchItems')
61
+			->will($this->returnValue([$item]));
62 62
 
63
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
63
+		$managerStub->expects($this->once())->method('saveItem');
64 64
 
65 65
 		$this->object->run();
66 66
 	}
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
 
69 69
 	public function testRunException()
70 70
 	{
71
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
72
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] );
71
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
72
+		$this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']);
73 73
 
74
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
75
-			->setConstructorArgs( [$this->context] )
76
-			->setMethods( ['searchItems', 'saveItem'] )
74
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
75
+			->setConstructorArgs([$this->context])
76
+			->setMethods(['searchItems', 'saveItem'])
77 77
 			->getMock();
78 78
 
79
-		\Aimeos\MShop::inject( 'subscription', $managerStub );
79
+		\Aimeos\MShop::inject('subscription', $managerStub);
80 80
 
81
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
82
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
81
+		$managerStub->expects($this->once())->method('searchItems')
82
+			->will($this->returnValue([$managerStub->createItem()]));
83 83
 
84
-		$managerStub->expects( $this->never() )->method( 'saveItem' );
84
+		$managerStub->expects($this->never())->method('saveItem');
85 85
 
86 86
 		$this->object->run();
87 87
 	}
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 
90 90
 	protected function getSubscription()
91 91
 	{
92
-		$manager = \Aimeos\MShop::create( $this->context, 'subscription' );
92
+		$manager = \Aimeos\MShop::create($this->context, 'subscription');
93 93
 
94 94
 		$search = $manager->createSearch();
95
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
95
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
96 96
 
97
-		$items = $manager->searchItems( $search );
97
+		$items = $manager->searchItems($search);
98 98
 
99
-		if( ( $item = reset( $items ) ) !== false ) {
99
+		if (($item = reset($items)) !== false) {
100 100
 			return $item;
101 101
 		}
102 102
 
103
-		throw new \Exception( 'No subscription item found' );
103
+		throw new \Exception('No subscription item found');
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Product/Export/Sitemap/StandardTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,58 +18,58 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop::cache( false );
32
+		\Aimeos\MShop::cache(false);
33 33
 		$this->object = null;
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testGetName()
38 38
 	{
39
-		$this->assertEquals( 'Product site map', $this->object->getName() );
39
+		$this->assertEquals('Product site map', $this->object->getName());
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetDescription()
44 44
 	{
45 45
 		$text = 'Creates a product site map for search engines';
46
-		$this->assertEquals( $text, $this->object->getDescription() );
46
+		$this->assertEquals($text, $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testRun()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 );
52
+		$this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5);
53 53
 
54 54
 		$this->object->run();
55 55
 
56 56
 		$ds = DIRECTORY_SEPARATOR;
57
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
58
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
59
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
57
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
58
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
59
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
60 60
 
61
-		$file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 );
62
-		$file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 );
63
-		$index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 );
61
+		$file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000);
62
+		$file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000);
63
+		$index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000);
64 64
 
65
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
66
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
67
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
65
+		unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
66
+		unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
67
+		unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
68 68
 
69
-		$this->assertContains( 'Cafe_Noire_Expresso', $file2 );
70
-		$this->assertContains( 'Unittest%3A_Bundle', $file2 );
69
+		$this->assertContains('Cafe_Noire_Expresso', $file2);
70
+		$this->assertContains('Unittest%3A_Bundle', $file2);
71 71
 
72
-		$this->assertContains( 'aimeos-sitemap-1.xml.gz', $index );
73
-		$this->assertContains( 'aimeos-sitemap-2.xml.gz', $index );
72
+		$this->assertContains('aimeos-sitemap-1.xml.gz', $index);
73
+		$this->assertContains('aimeos-sitemap-2.xml.gz', $index);
74 74
 	}
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Export/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,52 +18,52 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop::cache( false );
32
+		\Aimeos\MShop::cache(false);
33 33
 		$this->object = null;
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testGetName()
38 38
 	{
39
-		$this->assertEquals( 'Product export', $this->object->getName() );
39
+		$this->assertEquals('Product export', $this->object->getName());
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetDescription()
44 44
 	{
45 45
 		$text = 'Exports all available products';
46
-		$this->assertEquals( $text, $this->object->getDescription() );
46
+		$this->assertEquals($text, $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testRun()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml' );
52
+		$this->context->getConfig()->set('controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml');
53 53
 
54 54
 		$this->object->run();
55 55
 
56 56
 		$ds = DIRECTORY_SEPARATOR;
57
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-1.xml' );
58
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-2.xml' );
57
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-1.xml');
58
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-2.xml');
59 59
 
60
-		$file1 = file_get_contents( 'tmp' . $ds . 'aimeos-products-1.xml' );
61
-		$file2 = file_get_contents( 'tmp' . $ds . 'aimeos-products-2.xml' );
60
+		$file1 = file_get_contents('tmp' . $ds . 'aimeos-products-1.xml');
61
+		$file2 = file_get_contents('tmp' . $ds . 'aimeos-products-2.xml');
62 62
 
63
-		unlink( 'tmp' . $ds . 'aimeos-products-1.xml' );
64
-		unlink( 'tmp' . $ds . 'aimeos-products-2.xml' );
63
+		unlink('tmp' . $ds . 'aimeos-products-1.xml');
64
+		unlink('tmp' . $ds . 'aimeos-products-2.xml');
65 65
 
66
-		$this->assertContains( 'CNE', $file2 );
67
-		$this->assertContains( 'U:BUNDLE', $file2 );
66
+		$this->assertContains('CNE', $file2);
67
+		$this->assertContains('U:BUNDLE', $file2);
68 68
 	}
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Import/Csv/StandardTest.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -18,117 +18,117 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 		$config = $this->context->getConfig();
26 26
 
27
-		$config->set( 'controller/jobs/product/import/csv/skip-lines', 1 );
28
-		$config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid' );
27
+		$config->set('controller/jobs/product/import/csv/skip-lines', 1);
28
+		$config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid');
29 29
 
30
-		$this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos );
30
+		$this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos);
31 31
 	}
32 32
 
33 33
 
34 34
 	protected function tearDown()
35 35
 	{
36
-		\Aimeos\MShop::cache( false );
36
+		\Aimeos\MShop::cache(false);
37 37
 		$this->object = null;
38 38
 
39
-		if( file_exists( 'tmp/import.zip' ) ) {
40
-			unlink( 'tmp/import.zip' );
39
+		if (file_exists('tmp/import.zip')) {
40
+			unlink('tmp/import.zip');
41 41
 		}
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetName()
46 46
 	{
47
-		$this->assertEquals( 'Product import CSV', $this->object->getName() );
47
+		$this->assertEquals('Product import CSV', $this->object->getName());
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testGetDescription()
52 52
 	{
53 53
 		$text = 'Imports new and updates existing products from CSV files';
54
-		$this->assertEquals( $text, $this->object->getDescription() );
54
+		$this->assertEquals($text, $this->object->getDescription());
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testRun()
59 59
 	{
60
-		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
61
-		$nondelete = array( 'attribute', 'product' );
62
-		$delete = array( 'media', 'price', 'text' );
60
+		$prodcodes = array('job_csv_test', 'job_csv_test2');
61
+		$nondelete = array('attribute', 'product');
62
+		$delete = array('media', 'price', 'text');
63 63
 
64 64
 		$convert = array(
65 65
 			1 => 'Text/LatinUTF8',
66 66
 		);
67 67
 
68
-		$this->context->getConfig()->set( 'controller/jobs/product/import/csv/converter', $convert );
68
+		$this->context->getConfig()->set('controller/jobs/product/import/csv/converter', $convert);
69 69
 
70 70
 		$this->object->run();
71 71
 
72
-		$result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) );
73
-		$properties = $this->getProperties( array_keys( $result ) );
74
-		$this->delete( $prodcodes, $delete, $nondelete );
72
+		$result = $this->get($prodcodes, array_merge($delete, $nondelete));
73
+		$properties = $this->getProperties(array_keys($result));
74
+		$this->delete($prodcodes, $delete, $nondelete);
75 75
 
76
-		$this->assertEquals( 2, count( $result ) );
77
-		$this->assertEquals( 2, count( $properties ) );
76
+		$this->assertEquals(2, count($result));
77
+		$this->assertEquals(2, count($properties));
78 78
 
79
-		foreach( $result as $product ) {
80
-			$this->assertEquals( 5, count( $product->getListItems() ) );
79
+		foreach ($result as $product) {
80
+			$this->assertEquals(5, count($product->getListItems()));
81 81
 		}
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testRunUpdate()
86 86
 	{
87
-		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
88
-		$nondelete = array( 'attribute', 'product' );
89
-		$delete = array( 'media', 'price', 'text' );
87
+		$prodcodes = array('job_csv_test', 'job_csv_test2');
88
+		$nondelete = array('attribute', 'product');
89
+		$delete = array('media', 'price', 'text');
90 90
 
91 91
 		$this->object->run();
92 92
 		$this->object->run();
93 93
 
94
-		$result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) );
95
-		$properties = $this->getProperties( array_keys( $result ) );
96
-		$this->delete( $prodcodes, $delete, $nondelete );
94
+		$result = $this->get($prodcodes, array_merge($delete, $nondelete));
95
+		$properties = $this->getProperties(array_keys($result));
96
+		$this->delete($prodcodes, $delete, $nondelete);
97 97
 
98
-		$this->assertEquals( 2, count( $result ) );
99
-		$this->assertEquals( 2, count( $properties ) );
98
+		$this->assertEquals(2, count($result));
99
+		$this->assertEquals(2, count($properties));
100 100
 
101
-		foreach( $result as $product ) {
102
-			$this->assertEquals( 5, count( $product->getListItems() ) );
101
+		foreach ($result as $product) {
102
+			$this->assertEquals(5, count($product->getListItems()));
103 103
 		}
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testRunPosition()
108 108
 	{
109
-		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
110
-		$nondelete = array( 'attribute', 'product' );
111
-		$delete = array( 'media', 'price', 'text' );
109
+		$prodcodes = array('job_csv_test', 'job_csv_test2');
110
+		$nondelete = array('attribute', 'product');
111
+		$delete = array('media', 'price', 'text');
112 112
 
113 113
 		$config = $this->context->getConfig();
114
-		$mapping = $config->set( 'controller/jobs/product/import/csv/mapping', [] );
115
-		$mapping['item'] = array( 0 => 'product.label', 1 => 'product.code' );
114
+		$mapping = $config->set('controller/jobs/product/import/csv/mapping', []);
115
+		$mapping['item'] = array(0 => 'product.label', 1 => 'product.code');
116 116
 
117
-		$config->set( 'controller/jobs/product/import/csv/mapping', $mapping );
118
-		$config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position' );
117
+		$config->set('controller/jobs/product/import/csv/mapping', $mapping);
118
+		$config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position');
119 119
 
120 120
 		$this->object->run();
121 121
 
122
-		$result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) );
123
-		$this->delete( $prodcodes, $delete, $nondelete );
122
+		$result = $this->get($prodcodes, array_merge($delete, $nondelete));
123
+		$this->delete($prodcodes, $delete, $nondelete);
124 124
 
125
-		$this->assertEquals( 2, count( $result ) );
125
+		$this->assertEquals(2, count($result));
126 126
 	}
127 127
 
128 128
 
129 129
 	public function testRunProcessorInvalidPosition()
130 130
 	{
131
-		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
131
+		$prodcodes = array('job_csv_test', 'job_csv_test2');
132 132
 
133 133
 		$mapping = array(
134 134
 			'item' => array(
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 			),
149 149
 		);
150 150
 
151
-		$this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping );
151
+		$this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping);
152 152
 
153 153
 		$this->object->run();
154 154
 
155
-		$this->delete( $prodcodes, array( 'text', 'media' ), [] );
155
+		$this->delete($prodcodes, array('text', 'media'), []);
156 156
 	}
157 157
 
158 158
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			),
165 165
 		);
166 166
 
167
-		$this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping );
167
+		$this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping);
168 168
 
169
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
169
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
170 170
 		$this->object->run();
171 171
 	}
172 172
 
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 			),
207 207
 		);
208 208
 
209
-		$this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping );
209
+		$this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping);
210 210
 
211 211
 		$config = $this->context->getConfig();
212
-		$config->set( 'controller/jobs/product/import/csv/skip-lines', 0 );
213
-		$config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid' );
212
+		$config->set('controller/jobs/product/import/csv/skip-lines', 0);
213
+		$config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid');
214 214
 
215
-		$this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos );
215
+		$this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos);
216 216
 
217
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
217
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
218 218
 		$this->object->run();
219 219
 	}
220 220
 
@@ -222,104 +222,104 @@  discard block
 block discarded – undo
222 222
 	public function testRunBackup()
223 223
 	{
224 224
 		$config = $this->context->getConfig();
225
-		$config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' );
226
-		$config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' );
227
-		$config->set( 'controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' );
225
+		$config->set('controller/jobs/product/import/csv/container/type', 'Zip');
226
+		$config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip');
227
+		$config->set('controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip');
228 228
 
229
-		if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) {
230
-			throw new \RuntimeException( 'Unable to copy test file' );
229
+		if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) {
230
+			throw new \RuntimeException('Unable to copy test file');
231 231
 		}
232 232
 
233 233
 		$this->object->run();
234 234
 
235
-		$filename = strftime( 'tmp/test-%Y-%m-%d.zip' );
236
-		$this->assertTrue( file_exists( $filename ) );
235
+		$filename = strftime('tmp/test-%Y-%m-%d.zip');
236
+		$this->assertTrue(file_exists($filename));
237 237
 
238
-		unlink( $filename );
238
+		unlink($filename);
239 239
 	}
240 240
 
241 241
 
242 242
 	public function testRunBackupInvalid()
243 243
 	{
244 244
 		$config = $this->context->getConfig();
245
-		$config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' );
246
-		$config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' );
247
-		$config->set( 'controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip' );
245
+		$config->set('controller/jobs/product/import/csv/container/type', 'Zip');
246
+		$config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip');
247
+		$config->set('controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip');
248 248
 
249
-		if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) {
250
-			throw new \RuntimeException( 'Unable to copy test file' );
249
+		if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) {
250
+			throw new \RuntimeException('Unable to copy test file');
251 251
 		}
252 252
 
253
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
253
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
254 254
 		$this->object->run();
255 255
 	}
256 256
 
257 257
 
258
-	protected function delete( array $prodcodes, array $delete, array $nondelete )
258
+	protected function delete(array $prodcodes, array $delete, array $nondelete)
259 259
 	{
260
-		$catListManager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context )->getSubmanager( 'lists' );
261
-		$productManager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context );
262
-		$listManager = $productManager->getSubManager( 'lists' );
260
+		$catListManager = \Aimeos\MShop\Catalog\Manager\Factory::create($this->context)->getSubmanager('lists');
261
+		$productManager = \Aimeos\MShop\Product\Manager\Factory::create($this->context);
262
+		$listManager = $productManager->getSubManager('lists');
263 263
 
264
-		foreach( $this->get( $prodcodes, $delete + $nondelete ) as $id => $product )
264
+		foreach ($this->get($prodcodes, $delete + $nondelete) as $id => $product)
265 265
 		{
266
-			foreach( $delete as $domain )
266
+			foreach ($delete as $domain)
267 267
 			{
268
-				$manager = \Aimeos\MShop::create( $this->context, $domain );
268
+				$manager = \Aimeos\MShop::create($this->context, $domain);
269 269
 
270
-				foreach( $product->getListItems( $domain ) as $listItem )
270
+				foreach ($product->getListItems($domain) as $listItem)
271 271
 				{
272
-					$manager->deleteItem( $listItem->getRefItem()->getId() );
273
-					$listManager->deleteItem( $listItem->getId() );
272
+					$manager->deleteItem($listItem->getRefItem()->getId());
273
+					$listManager->deleteItem($listItem->getId());
274 274
 				}
275 275
 			}
276 276
 
277
-			foreach( $nondelete as $domain )
277
+			foreach ($nondelete as $domain)
278 278
 			{
279
-				$ids = array_keys( $product->getListItems( $domain ) );
280
-				$listManager->deleteItems( $ids );
279
+				$ids = array_keys($product->getListItems($domain));
280
+				$listManager->deleteItems($ids);
281 281
 			}
282 282
 
283
-			$productManager->deleteItem( $product->getId() );
283
+			$productManager->deleteItem($product->getId());
284 284
 
285 285
 			$search = $catListManager->createSearch();
286
-			$search->setConditions( $search->compare( '==', 'catalog.lists.refid', $id ) );
287
-			$result = $catListManager->searchItems( $search );
286
+			$search->setConditions($search->compare('==', 'catalog.lists.refid', $id));
287
+			$result = $catListManager->searchItems($search);
288 288
 
289
-			$catListManager->deleteItems( array_keys( $result ) );
289
+			$catListManager->deleteItems(array_keys($result));
290 290
 		}
291 291
 
292 292
 
293
-		$attrManager = \Aimeos\MShop\Attribute\Manager\Factory::create( $this->context );
293
+		$attrManager = \Aimeos\MShop\Attribute\Manager\Factory::create($this->context);
294 294
 
295 295
 		$search = $attrManager->createSearch();
296
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'import-test' ) );
296
+		$search->setConditions($search->compare('==', 'attribute.code', 'import-test'));
297 297
 
298
-		$result = $attrManager->searchItems( $search );
298
+		$result = $attrManager->searchItems($search);
299 299
 
300
-		$attrManager->deleteItems( array_keys( $result ) );
300
+		$attrManager->deleteItems(array_keys($result));
301 301
 	}
302 302
 
303 303
 
304
-	protected function get( array $prodcodes, array $domains )
304
+	protected function get(array $prodcodes, array $domains)
305 305
 	{
306
-		$productManager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context );
306
+		$productManager = \Aimeos\MShop\Product\Manager\Factory::create($this->context);
307 307
 
308 308
 		$search = $productManager->createSearch();
309
-		$search->setConditions( $search->compare( '==', 'product.code', $prodcodes ) );
309
+		$search->setConditions($search->compare('==', 'product.code', $prodcodes));
310 310
 
311
-		return $productManager->searchItems( $search, $domains );
311
+		return $productManager->searchItems($search, $domains);
312 312
 	}
313 313
 
314 314
 
315
-	protected function getProperties( array $prodids )
315
+	protected function getProperties(array $prodids)
316 316
 	{
317
-		$manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context )->getSubManager( 'property' );
317
+		$manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context)->getSubManager('property');
318 318
 
319 319
 		$search = $manager->createSearch();
320
-		$search->setConditions( $search->compare( '==', 'product.property.parentid', $prodids ) );
321
-		$search->setSortations( array( $search->sort( '+', 'product.property.type' ) ) );
320
+		$search->setConditions($search->compare('==', 'product.property.parentid', $prodids));
321
+		$search->setSortations(array($search->sort('+', 'product.property.type')));
322 322
 
323
-		return $manager->searchItems( $search );
323
+		return $manager->searchItems($search);
324 324
 	}
325 325
 }
326 326
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Bought/StandardTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,46 +19,46 @@
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		\Aimeos\MShop::cache( true );
22
+		\Aimeos\MShop::cache(true);
23 23
 
24 24
 		$this->context = \TestHelperJobs::getContext();
25 25
 		$this->aimeos = \TestHelperJobs::getAimeos();
26 26
 
27
-		$this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard( $this->context, $this->aimeos );
27
+		$this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard($this->context, $this->aimeos);
28 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		\Aimeos\MShop::cache( false );
33
+		\Aimeos\MShop::cache(false);
34 34
 		$this->object = null;
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetName()
39 39
 	{
40
-		$this->assertEquals( 'Products bought together', $this->object->getName() );
40
+		$this->assertEquals('Products bought together', $this->object->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetDescription()
45 45
 	{
46 46
 		$text = 'Creates bought together product suggestions';
47
-		$this->assertEquals( $text, $this->object->getDescription() );
47
+		$this->assertEquals($text, $this->object->getDescription());
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testRun()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
54
-			->setConstructorArgs( array( $this->context ) )
55
-			->setMethods( array( 'deleteItems', 'saveItem' ) )
53
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
54
+			->setConstructorArgs(array($this->context))
55
+			->setMethods(array('deleteItems', 'saveItem'))
56 56
 			->getMock();
57 57
 
58
-		\Aimeos\MShop::inject( 'product/lists', $stub );
58
+		\Aimeos\MShop::inject('product/lists', $stub);
59 59
 
60
-		$stub->expects( $this->atLeastOnce() )->method( 'deleteItems' );
61
-		$stub->expects( $this->atLeastOnce() )->method( 'saveItem' );
60
+		$stub->expects($this->atLeastOnce())->method('deleteItems');
61
+		$stub->expects($this->atLeastOnce())->method('saveItem');
62 62
 
63 63
 		$this->object->run();
64 64
 	}
Please login to merge, or discard this patch.