Completed
Push — master ( a0f3ba...4d0a57 )
by Aimeos
03:07
created
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,49 +20,49 @@  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\Factory::setCache( true );
25
+		\Aimeos\MShop\Factory::setCache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop\Factory::setCache( false );
31
+		\Aimeos\MShop\Factory::setCache(false);
32 32
 		\Aimeos\MShop\Factory::clear();
33 33
 
34
-		unset( $this->object, $this->context );
34
+		unset($this->object, $this->context);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetName()
39 39
 	{
40
-		$this->assertEquals( 'Subscription process end', $this->object->getName() );
40
+		$this->assertEquals('Subscription process end', $this->object->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetDescription()
45 45
 	{
46
-		$this->assertEquals( 'Terminates expired subscriptions', $this->object->getDescription() );
46
+		$this->assertEquals('Terminates expired subscriptions', $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testRun()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
52
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
53 53
 		$item = $this->getSubscription();
54 54
 
55
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
56
-			->setConstructorArgs( [$this->context] )
57
-			->setMethods( ['searchItems', 'saveItem'] )
55
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
56
+			->setConstructorArgs([$this->context])
57
+			->setMethods(['searchItems', 'saveItem'])
58 58
 			->getMock();
59 59
 
60
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
60
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
61 61
 
62
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
63
-			->will( $this->returnValue( [$item] ) );
62
+		$managerStub->expects($this->once())->method('searchItems')
63
+			->will($this->returnValue([$item]));
64 64
 
65
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
65
+		$managerStub->expects($this->once())->method('saveItem');
66 66
 
67 67
 		$this->object->run();
68 68
 	}
@@ -70,20 +70,20 @@  discard block
 block discarded – undo
70 70
 
71 71
 	public function testRunException()
72 72
 	{
73
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
74
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] );
73
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
74
+		$this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']);
75 75
 
76
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
77
-			->setConstructorArgs( [$this->context] )
78
-			->setMethods( ['searchItems', 'saveItem'] )
76
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
77
+			->setConstructorArgs([$this->context])
78
+			->setMethods(['searchItems', 'saveItem'])
79 79
 			->getMock();
80 80
 
81
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
81
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
82 82
 
83
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
84
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
83
+		$managerStub->expects($this->once())->method('searchItems')
84
+			->will($this->returnValue([$managerStub->createItem()]));
85 85
 
86
-		$managerStub->expects( $this->never() )->method( 'saveItem' );
86
+		$managerStub->expects($this->never())->method('saveItem');
87 87
 
88 88
 		$this->object->run();
89 89
 	}
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 
92 92
 	protected function getSubscription()
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
94
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
95 95
 
96 96
 		$search = $manager->createSearch();
97
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
97
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
98 98
 
99
-		$items = $manager->searchItems( $search );
99
+		$items = $manager->searchItems($search);
100 100
 
101
-		if( ( $item = reset( $items ) ) !== false ) {
101
+		if (($item = reset($items)) !== false) {
102 102
 			return $item;
103 103
 		}
104 104
 
105
-		throw new \Exception( 'No subscription item found' );
105
+		throw new \Exception('No subscription item found');
106 106
 	}
107 107
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/StanardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,49 +20,49 @@  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\Factory::setCache( true );
25
+		\Aimeos\MShop\Factory::setCache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop\Factory::setCache( false );
31
+		\Aimeos\MShop\Factory::setCache(false);
32 32
 		\Aimeos\MShop\Factory::clear();
33 33
 
34
-		unset( $this->object, $this->context );
34
+		unset($this->object, $this->context);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetName()
39 39
 	{
40
-		$this->assertEquals( 'Subscription process start', $this->object->getName() );
40
+		$this->assertEquals('Subscription process start', $this->object->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetDescription()
45 45
 	{
46
-		$this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() );
46
+		$this->assertEquals('Process subscriptions initially', $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testRun()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
52
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
53 53
 		$item = $this->getSubscription();
54 54
 
55
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
56
-			->setConstructorArgs( [$this->context] )
57
-			->setMethods( ['searchItems', 'saveItem'] )
55
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
56
+			->setConstructorArgs([$this->context])
57
+			->setMethods(['searchItems', 'saveItem'])
58 58
 			->getMock();
59 59
 
60
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
60
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
61 61
 
62
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
63
-			->will( $this->returnValue( [$item] ) );
62
+		$managerStub->expects($this->once())->method('searchItems')
63
+			->will($this->returnValue([$item]));
64 64
 
65
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
65
+		$managerStub->expects($this->once())->method('saveItem');
66 66
 
67 67
 		$this->object->run();
68 68
 	}
@@ -70,20 +70,20 @@  discard block
 block discarded – undo
70 70
 
71 71
 	public function testRunException()
72 72
 	{
73
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
74
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] );
73
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
74
+		$this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']);
75 75
 
76
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
77
-			->setConstructorArgs( [$this->context] )
78
-			->setMethods( ['searchItems', 'saveItem'] )
76
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
77
+			->setConstructorArgs([$this->context])
78
+			->setMethods(['searchItems', 'saveItem'])
79 79
 			->getMock();
80 80
 
81
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
81
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
82 82
 
83
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
84
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
83
+		$managerStub->expects($this->once())->method('searchItems')
84
+			->will($this->returnValue([$managerStub->createItem()]));
85 85
 
86
-		$managerStub->expects( $this->never() )->method( 'saveItem' );
86
+		$managerStub->expects($this->never())->method('saveItem');
87 87
 
88 88
 		$this->object->run();
89 89
 	}
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 
92 92
 	protected function getSubscription()
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
94
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
95 95
 
96 96
 		$search = $manager->createSearch();
97
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
97
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
98 98
 
99
-		$items = $manager->searchItems( $search );
99
+		$items = $manager->searchItems($search);
100 100
 
101
-		if( ( $item = reset( $items ) ) !== false ) {
101
+		if (($item = reset($items)) !== false) {
102 102
 			return $item;
103 103
 		}
104 104
 
105
-		throw new \Exception( 'No subscription item found' );
105
+		throw new \Exception('No subscription item found');
106 106
 	}
107 107
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Renew/StandardTest.php 1 patch
Spacing   +54 added lines, -54 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\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'] )
56
+		$object = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\Standard')
57
+			->setConstructorArgs([$this->context, $this->aimeos])
58
+			->setMethods(['createOrderBase', 'createOrderInvoice'])
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
-		$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\Factory::injectManager( $this->context, 'subscription', $managerStub );
92
+		\Aimeos\MShop\Factory::injectManager($this->context, '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
 	}
@@ -104,71 +104,71 @@  discard block
 block discarded – undo
104 104
 	{
105 105
 		$item = $this->getSubscription();
106 106
 
107
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' )
108
-			->setConstructorArgs( [$this->context] )
109
-			->setMethods( ['store'] )
107
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')
108
+			->setConstructorArgs([$this->context])
109
+			->setMethods(['store'])
110 110
 			->getMock();
111 111
 
112
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $managerStub );
112
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $managerStub);
113 113
 
114
-		$managerStub->expects( $this->once() )->method( 'store' );
114
+		$managerStub->expects($this->once())->method('store');
115 115
 
116
-		$this->access( 'createOrderBase' )->invokeArgs( $this->object, [$this->context, $item] );
116
+		$this->access('createOrderBase')->invokeArgs($this->object, [$this->context, $item]);
117 117
 	}
118 118
 
119 119
 
120 120
 	public function testCreateOrderInvoice()
121 121
 	{
122 122
 		$item = $this->getSubscription();
123
-		$baseItem = $this->getOrderBaseItem( $item->getOrderBaseId() );
123
+		$baseItem = $this->getOrderBaseItem($item->getOrderBaseId());
124 124
 
125
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
126
-			->setConstructorArgs( [$this->context] )
127
-			->setMethods( ['saveItem'] )
125
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
126
+			->setConstructorArgs([$this->context])
127
+			->setMethods(['saveItem'])
128 128
 			->getMock();
129 129
 
130
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $managerStub );
130
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $managerStub);
131 131
 
132
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
132
+		$managerStub->expects($this->once())->method('saveItem');
133 133
 
134
-		$this->access( 'createOrderInvoice' )->invokeArgs( $this->object, [$this->context, $baseItem] );
134
+		$this->access('createOrderInvoice')->invokeArgs($this->object, [$this->context, $baseItem]);
135 135
 	}
136 136
 
137 137
 
138 138
 	protected function getOrderItem()
139 139
 	{
140
-		return \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
140
+		return \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
141 141
 	}
142 142
 
143 143
 
144
-	protected function getOrderBaseItem( $baseId )
144
+	protected function getOrderBaseItem($baseId)
145 145
 	{
146
-		return \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->getItem( $baseId, ['order/base/service'] );
146
+		return \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->getItem($baseId, ['order/base/service']);
147 147
 	}
148 148
 
149 149
 
150 150
 	protected function getSubscription()
151 151
 	{
152
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
152
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
153 153
 
154 154
 		$search = $manager->createSearch();
155
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
155
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
156 156
 
157
-		$items = $manager->searchItems( $search );
157
+		$items = $manager->searchItems($search);
158 158
 
159
-		if( ( $item = reset( $items ) ) !== false ) {
159
+		if (($item = reset($items)) !== false) {
160 160
 			return $item;
161 161
 		}
162 162
 
163
-		throw new \Exception( 'No subscription item found' );
163
+		throw new \Exception('No subscription item found');
164 164
 	}
165 165
 
166 166
 
167
-	protected function access( $name )
167
+	protected function access($name)
168 168
 	{
169
-		$class = new \ReflectionClass( '\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard' );
170
-		$method = $class->getMethod( $name );
171
-		$method->setAccessible( true );
169
+		$class = new \ReflectionClass('\Aimeos\Controller\Jobs\Subscription\Process\Renew\Standard');
170
+		$method = $class->getMethod($name);
171
+		$method->setAccessible(true);
172 172
 
173 173
 		return $method;
174 174
 	}
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Renew/FactoryTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJobs::getContext();
17 17
 		$aimeos = \TestHelperJobs::getAimeos();
18 18
 
19
-		$obj = \Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController($context, $aimeos);
20
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJobs::getContext();
27 27
 		$aimeos = \TestHelperJobs::getAimeos();
28 28
 
29
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
30
-		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController($context, $aimeos, 'Wrong$$$Name');
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJobs::getContext();
37 37
 		$aimeos = \TestHelperJobs::getAimeos();
38 38
 
39
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
40
-		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController($context, $aimeos, 'WrongClass');
41 41
 	}
42 42
 
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJobs::getContext();
47 47
 		$aimeos = \TestHelperJobs::getAimeos();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
50
-		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Subscription\Process\Renew\Factory::createController($context, $aimeos, 'Factory');
51 51
 	}
52 52
 
53 53
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php 2 patches
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process renew' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process renew');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Renews subscriptions at next date' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Renews subscriptions at next date');
43 43
 	}
44 44
 
45 45
 
@@ -54,62 +54,62 @@  discard block
 block discarded – undo
54 54
 		$config = $context->getConfig();
55 55
 		$logger = $context->getLogger();
56 56
 
57
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
57
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
58 58
 
59
-		$date = date( 'Y-m-d' );
60
-		$processors = $this->getProcessors( $names );
61
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
59
+		$date = date('Y-m-d');
60
+		$processors = $this->getProcessors($names);
61
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
62 62
 
63
-		$search = $manager->createSearch( true );
63
+		$search = $manager->createSearch(true);
64 64
 		$expr = [
65
-			$search->compare( '<', 'subscription.datenext', $date ),
66
-			$search->combine( '||', [
67
-				$search->compare( '==', 'subscription.dateend', null ),
68
-				$search->compare( '>', 'subscription.dateend', $date ),
69
-			] ),
65
+			$search->compare('<', 'subscription.datenext', $date),
66
+			$search->combine('||', [
67
+				$search->compare('==', 'subscription.dateend', null),
68
+				$search->compare('>', 'subscription.dateend', $date),
69
+			]),
70 70
 			$search->getConditions(),
71 71
 		];
72
-		$search->setConditions( $search->combine( '&&', $expr ) );
73
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
72
+		$search->setConditions($search->combine('&&', $expr));
73
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
74 74
 
75 75
 		$start = 0;
76 76
 
77 77
 		do
78 78
 		{
79
-			$search->setSlice( $start, 100 );
80
-			$items = $manager->searchItems( $search );
79
+			$search->setSlice($start, 100);
80
+			$items = $manager->searchItems($search);
81 81
 
82
-			foreach( $items as $item )
82
+			foreach ($items as $item)
83 83
 			{
84 84
 				try
85 85
 				{
86
-					$context = $this->createContext( $item->getOrderBaseId() );
87
-					$newOrder = $this->createOrderBase( $context, $item );
88
-					$newInvoice = $this->createOrderInvoice( $context, $newOrder );
86
+					$context = $this->createContext($item->getOrderBaseId());
87
+					$newOrder = $this->createOrderBase($context, $item);
88
+					$newInvoice = $this->createOrderInvoice($context, $newOrder);
89 89
 
90
-					$this->createPayment( $context, $newOrder, $newInvoice );
90
+					$this->createPayment($context, $newOrder, $newInvoice);
91 91
 
92
-					foreach( $processors as $processor ) {
93
-						$processor->renew( $item, $newInvoice );
92
+					foreach ($processors as $processor) {
93
+						$processor->renew($item, $newInvoice);
94 94
 					}
95 95
 
96
-					$interval = \DateInterval::createFromDateString( $item->getInterval() );
97
-					$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
96
+					$interval = \DateInterval::createFromDateString($item->getInterval());
97
+					$item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d'));
98 98
 
99
-					$manager->saveItem( $item );
99
+					$manager->saveItem($item);
100 100
 				}
101
-				catch( \Exception $e )
101
+				catch (\Exception $e)
102 102
 				{
103 103
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
104
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
105
-					$logger->log( $e->getTraceAsString() );
104
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
105
+					$logger->log($e->getTraceAsString());
106 106
 				}
107 107
 			}
108 108
 
109
-			$count = count( $items );
109
+			$count = count($items);
110 110
 			$start += $count;
111 111
 		}
112
-		while( $count === $search->getSliceSize() );
112
+		while ($count === $search->getSliceSize());
113 113
 	}
114 114
 
115 115
 
@@ -119,30 +119,30 @@  discard block
 block discarded – undo
119 119
 	 * @param string $baseId Unique order base ID
120 120
 	 * @return \Aimeos\MShop\Context\Item\Iface New context object
121 121
 	 */
122
-	protected function createContext( $baseId )
122
+	protected function createContext($baseId)
123 123
 	{
124 124
 		$context = clone $this->getContext();
125 125
 
126
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
127
-		$baseItem = $manager->getItem( $baseId );
126
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
127
+		$baseItem = $manager->getItem($baseId);
128 128
 
129 129
 		$locale = $baseItem->getLocale();
130 130
 		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
131 131
 
132
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
133
-		$locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level );
132
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale');
133
+		$locale = $manager->bootstrap($baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level);
134 134
 
135
-		$context->setLocale( $locale );
135
+		$context->setLocale($locale);
136 136
 
137 137
 		try
138 138
 		{
139
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
140
-			$customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
139
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
140
+			$customerItem = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
141 141
 
142
-			$context->setUserId( $baseItem->getCustomerId() );
143
-			$context->setGroupIds( $customerItem->getGroups() );
142
+			$context->setUserId($baseItem->getCustomerId());
143
+			$context->setGroupIds($customerItem->getGroups());
144 144
 		}
145
-		catch( \Exception $e ) {} // Subscription without account
145
+		catch (\Exception $e) {} // Subscription without account
146 146
 
147 147
 		return $context;
148 148
 	}
@@ -155,34 +155,34 @@  discard block
 block discarded – undo
155 155
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID
156 156
 	 * @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage
157 157
 	 */
158
-	protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription )
158
+	protected function createOrderBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription)
159 159
 	{
160
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
160
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
161 161
 
162
-		$basket = $manager->load( $subscription->getOrderBaseId() );
162
+		$basket = $manager->load($subscription->getOrderBaseId());
163 163
 
164 164
 		$newBasket = $manager->createItem();
165
-		$newBasket->setCustomerId( $basket->getCustomerId() );
165
+		$newBasket->setCustomerId($basket->getCustomerId());
166 166
 
167
-		foreach( $basket->getProducts() as $orderProduct )
167
+		foreach ($basket->getProducts() as $orderProduct)
168 168
 		{
169
-			if( $orderProduct->getId() === $subscription->getOrderProductId() ) {
170
-				$newBasket->addProduct( $orderProduct );
169
+			if ($orderProduct->getId() === $subscription->getOrderProductId()) {
170
+				$newBasket->addProduct($orderProduct);
171 171
 			}
172 172
 		}
173 173
 
174
-		foreach( $basket->getAddresses() as $type => $orderAddress ) {
175
-			$newBasket->setAddress( $orderAddress, $type );
174
+		foreach ($basket->getAddresses() as $type => $orderAddress) {
175
+			$newBasket->setAddress($orderAddress, $type);
176 176
 		}
177 177
 
178
-		foreach( $basket->getServices() as $type => $orderServices )
178
+		foreach ($basket->getServices() as $type => $orderServices)
179 179
 		{
180
-			foreach( $orderServices as $orderService ) {
181
-				$newBasket->addService( $orderService, $type );
180
+			foreach ($orderServices as $orderService) {
181
+				$newBasket->addService($orderService, $type);
182 182
 			}
183 183
 		}
184 184
 
185
-		return $manager->store( $newBasket );
185
+		return $manager->store($newBasket);
186 186
 	}
187 187
 
188 188
 
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage
194 194
 	 * @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage
195 195
 	 */
196
-	protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket )
196
+	protected function createOrderInvoice(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket)
197 197
 	{
198
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
198
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
199 199
 
200 200
 		$item = $manager->createItem();
201
-		$item->setBaseId( $basket->getId() );
202
-		$item->setType( 'renewal');
201
+		$item->setBaseId($basket->getId());
202
+		$item->setType('renewal');
203 203
 
204
-		return $manager->saveItem( $item );
204
+		return $manager->saveItem($item);
205 205
 	}
206 206
 
207 207
 
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services
213 213
 	 * @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order
214 214
 	 */
215
-	protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket,
216
-		\Aimeos\MShop\Order\Item\Iface $invoice )
215
+	protected function createPayment(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket,
216
+		\Aimeos\MShop\Order\Item\Iface $invoice)
217 217
 	{
218
-		$services = $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT );
218
+		$services = $basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT);
219 219
 
220
-		if( ( $service = reset( $services ) ) === false ) {
220
+		if (($service = reset($services)) === false) {
221 221
 			return;
222 222
 		}
223 223
 
224
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
225
-		$item = $manager->getItem( $service->getServiceId() );
226
-		$provider = $manager->getProvider( $item, 'payment' );
224
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'service');
225
+		$item = $manager->getItem($service->getServiceId());
226
+		$provider = $manager->getProvider($item, 'payment');
227 227
 
228
-		$provider->repay( $invoice );
228
+		$provider->repay($invoice);
229 229
 	}
230 230
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
 					$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
98 98
 
99 99
 					$manager->saveItem( $item );
100
-				}
101
-				catch( \Exception $e )
100
+				} catch( \Exception $e )
102 101
 				{
103 102
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
104 103
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
@@ -141,8 +140,7 @@  discard block
 block discarded – undo
141 140
 
142 141
 			$context->setUserId( $baseItem->getCustomerId() );
143 142
 			$context->setGroupIds( $customerItem->getGroups() );
144
-		}
145
-		catch( \Exception $e ) {} // Subscription without account
143
+		} catch( \Exception $e ) {} // Subscription without account
146 144
 
147 145
 		return $context;
148 146
 	}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Factory.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string|null $name Name of the controller or "Standard" if null
30 30
 	 * @return \Aimeos\Controller\Jobs\Iface New controller object
31 31
 	 */
32
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
32
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
33 33
 	{
34 34
 		/** controller/jobs/subscription/process/renew/name
35 35
 		 * Class name of the used subscription suggestions scheduler controller implementation
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		 * @since 2018.04
65 65
 		 * @category Developer
66 66
 		 */
67
-		if ( $name === null ) {
67
+		if ($name === null) {
68 68
 			$name = $context->getConfig()->get('controller/jobs/subscription/process/renew/name', 'Standard');
69 69
 		}
70 70
 
71
-		if ( ctype_alnum($name) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73 73
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Controller\\Jobs\\Iface';
78 78
 		$classname = '\\Aimeos\\Controller\\Jobs\\Subscription\\Process\\Renew\\' . $name;
79 79
 
80
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
80
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
81 81
 
82 82
 		/** controller/jobs/subscription/process/renew/decorators/excludes
83 83
 		 * Excludes decorators added by the "common" option from the subscription process CSV job controller
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
 		 * @see controller/jobs/subscription/process/renew/decorators/excludes
155 155
 		 * @see controller/jobs/subscription/process/renew/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'subscription/process/renew' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'subscription/process/renew');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
common/src/Controller/Common/Subscription/Process/Processor/Iface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
26 26
 	 */
27
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context );
27
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context);
28 28
 
29 29
 
30 30
 	/**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
34 34
 	 */
35
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription );
35
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription);
36 36
 
37 37
 
38 38
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
42 42
 	 * @param \Aimeos\MShop\Order\Item\Iface $order Order invoice item
43 43
 	 */
44
-	public function renew( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order );
44
+	public function renew(\Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order);
45 45
 
46 46
 
47 47
 	/**
@@ -49,5 +49,5 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
51 51
 	 */
52
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription );
52
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription);
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
common/src/Controller/Common/Subscription/Process/Processor/Base.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
29 29
 	 */
30
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
30
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
31 31
 	{
32 32
 		$this->context = $context;
33 33
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
51 51
 	 */
52
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription )
52
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription)
53 53
 	{
54 54
 	}
55 55
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
61 61
 	 * @param \Aimeos\MShop\Order\Item\Iface $order Order invoice item
62 62
 	 */
63
-	public function renew( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order )
63
+	public function renew(\Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order)
64 64
 	{
65 65
 	}
66 66
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
72 72
 	 */
73
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
73
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription)
74 74
 	{
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.