Completed
Push — master ( 7a3ba1...08fedb )
by Aimeos
02:02
created
jobs/tests/Controller/Jobs/Subscription/Export/Csv/StandardTest.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -20,95 +20,95 @@
 block discarded – undo
20 20
 		$this->context = \TestHelperJobs::getContext();
21 21
 		$aimeos = \TestHelperJobs::getAimeos();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard( $this->context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Export\Csv\Standard($this->context, $aimeos);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		unset( $this->object, $this->context );
29
+		unset($this->object, $this->context);
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testGetName()
34 34
 	{
35
-		$this->assertEquals( 'Subscription export CSV', $this->object->getName() );
35
+		$this->assertEquals('Subscription export CSV', $this->object->getName());
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetDescription()
40 40
 	{
41
-		$this->assertEquals( 'Exports subscriptions to CSV file', $this->object->getDescription() );
41
+		$this->assertEquals('Exports subscriptions to CSV file', $this->object->getDescription());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testRun()
46 46
 	{
47
-		$mqmStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Manager\\Standard' )
48
-			->setConstructorArgs( [$this->context->getConfig()] )
49
-			->setMethods( ['get'] )
47
+		$mqmStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Manager\\Standard')
48
+			->setConstructorArgs([$this->context->getConfig()])
49
+			->setMethods(['get'])
50 50
 			->getMock();
51 51
 
52
-		$mqStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Standard' )
52
+		$mqStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Standard')
53 53
 			->disableOriginalConstructor()
54
-			->setMethods( ['getQueue'] )
54
+			->setMethods(['getQueue'])
55 55
 			->getMock();
56 56
 
57
-		$queueStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Queue\\Standard' )
57
+		$queueStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Queue\\Standard')
58 58
 			->disableOriginalConstructor()
59
-			->setMethods( ['del', 'get'] )
59
+			->setMethods(['del', 'get'])
60 60
 			->getMock();
61 61
 
62
-		$msgStub = $this->getMockBuilder( '\\Aimeos\\MW\\MQueue\\Message\\Standard' )
62
+		$msgStub = $this->getMockBuilder('\\Aimeos\\MW\\MQueue\\Message\\Standard')
63 63
 			->disableOriginalConstructor()
64
-			->setMethods( ['getBody'] )
64
+			->setMethods(['getBody'])
65 65
 			->getMock();
66 66
 
67 67
 
68
-		$this->context->setMessageQueueManager( $mqmStub );
68
+		$this->context->setMessageQueueManager($mqmStub);
69 69
 
70 70
 
71
-		$mqmStub->expects( $this->once() )->method( 'get' )
72
-			->will( $this->returnValue( $mqStub ) );
71
+		$mqmStub->expects($this->once())->method('get')
72
+			->will($this->returnValue($mqStub));
73 73
 
74
-		$mqStub->expects( $this->once() )->method( 'getQueue' )
75
-			->will( $this->returnValue( $queueStub ) );
74
+		$mqStub->expects($this->once())->method('getQueue')
75
+			->will($this->returnValue($queueStub));
76 76
 
77
-		$queueStub->expects( $this->exactly( 2 ) )->method( 'get' )
78
-			->will( $this->onConsecutiveCalls( $msgStub, null ) );
77
+		$queueStub->expects($this->exactly(2))->method('get')
78
+			->will($this->onConsecutiveCalls($msgStub, null));
79 79
 
80
-		$queueStub->expects( $this->once() )->method( 'del' );
80
+		$queueStub->expects($this->once())->method('del');
81 81
 
82
-		$msgStub->expects( $this->once() )->method( 'getBody' )
83
-			->will( $this->returnValue( '{"sitecode":"unittest"}' ) );
82
+		$msgStub->expects($this->once())->method('getBody')
83
+			->will($this->returnValue('{"sitecode":"unittest"}'));
84 84
 
85 85
 
86 86
 		$this->object->run();
87 87
 
88 88
 
89
-		$jobManager = \Aimeos\MAdmin\Factory::createManager( $this->context, 'job' );
89
+		$jobManager = \Aimeos\MAdmin\Factory::createManager($this->context, 'job');
90 90
 		$jobSearch = $jobManager->createSearch();
91
-		$jobSearch->setConditions( $jobSearch->compare( '=~', 'job.label', 'subscription-export_' ) );
92
-		$jobItems = $jobManager->searchItems( $jobSearch );
93
-		$jobManager->deleteItems( array_keys( $jobItems ) );
91
+		$jobSearch->setConditions($jobSearch->compare('=~', 'job.label', 'subscription-export_'));
92
+		$jobItems = $jobManager->searchItems($jobSearch);
93
+		$jobManager->deleteItems(array_keys($jobItems));
94 94
 
95
-		$this->assertEquals( 1, count( $jobItems ) );
95
+		$this->assertEquals(1, count($jobItems));
96 96
 
97 97
 
98
-		$filename = dirname( dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) ) . '/tmp/' . reset( $jobItems )->getLabel();
99
-		$fp = fopen( $filename, 'r' );
98
+		$filename = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/tmp/' . reset($jobItems)->getLabel();
99
+		$fp = fopen($filename, 'r');
100 100
 
101
-		$subscription = fgetcsv( $fp );
102
-		$address1 = fgetcsv( $fp );
103
-		$address2 = fgetcsv( $fp );
104
-		$product1 = fgetcsv( $fp );
101
+		$subscription = fgetcsv($fp);
102
+		$address1 = fgetcsv($fp);
103
+		$address2 = fgetcsv($fp);
104
+		$product1 = fgetcsv($fp);
105 105
 
106
-		fclose( $fp );
107
-		unlink( $filename );
106
+		fclose($fp);
107
+		unlink($filename);
108 108
 
109
-		$this->assertEquals( 'subscription', $subscription[0] );
110
-		$this->assertEquals( 'address', $address1[0] );
111
-		$this->assertEquals( 'address', $address2[0] );
112
-		$this->assertEquals( 'product', $product1[0] );
109
+		$this->assertEquals('subscription', $subscription[0]);
110
+		$this->assertEquals('address', $address1[0]);
111
+		$this->assertEquals('address', $address2[0]);
112
+		$this->assertEquals('product', $product1[0]);
113 113
 	}
114 114
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Export/Csv/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\Export\Csv\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Subscription\Export\Csv\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\Export\Csv\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Subscription\Export\Csv\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\Export\Csv\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Subscription\Export\Csv\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\Export\Csv\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Subscription\Export\Csv\Factory::createController($context, $aimeos, 'Factory');
51 51
 	}
52 52
 
53 53
 }
Please login to merge, or discard this patch.
src/Controller/Common/Subscription/Process/Processor/Cgroup/Standard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
42 42
 	 */
43
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
43
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
44 44
 	{
45
-		parent::__construct( $context );
45
+		parent::__construct($context);
46 46
 
47 47
 		$config = $context->getConfig();
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @since 2018.04
58 58
 		 * @category Developer
59 59
 		 */
60
-		$this->groupIds = (array) $config->get( 'controller/common/subscription/process/processor/cgroup/groupids', [] );
60
+		$this->groupIds = (array) $config->get('controller/common/subscription/process/processor/cgroup/groupids', []);
61 61
 	}
62 62
 
63 63
 
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
68 68
 	 */
69
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription )
69
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription)
70 70
 	{
71
-		if( empty( $this->groupIds ) ) {
71
+		if (empty($this->groupIds)) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		$context = $this->getContext();
76 76
 
77
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
78
-		$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
77
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
78
+		$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
79 79
 
80
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
81
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
80
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
81
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
82 82
 
83
-		$item->setGroups( array_unique( array_merge( $item->getGroups(), $this->groupIds ) ) );
84
-		$manager->saveItem( $item );
83
+		$item->setGroups(array_unique(array_merge($item->getGroups(), $this->groupIds)));
84
+		$manager->saveItem($item);
85 85
 	}
86 86
 
87 87
 
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
92 92
 	 */
93
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
93
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription)
94 94
 	{
95
-		if( empty( $this->groupIds ) ) {
95
+		if (empty($this->groupIds)) {
96 96
 			return;
97 97
 		}
98 98
 
99 99
 		$context = $this->getContext();
100 100
 
101
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
102
-		$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
101
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
102
+		$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
103 103
 
104
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
105
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
104
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
105
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
106 106
 
107
-		$item->setGroups( array_diff( $item->getGroups(), $this->groupIds ) );
108
-		$manager->saveItem( $item );
107
+		$item->setGroups(array_diff($item->getGroups(), $this->groupIds));
108
+		$manager->saveItem($item);
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/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\Begin\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Subscription\Process\Begin\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\Begin\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\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\Begin\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\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\Begin\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Subscription\Process\Begin\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/Begin/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/begin/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/begin/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\\Begin\\' . $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\\Begin\\' . $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/begin/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/begin/decorators/excludes
155 155
 		 * @see controller/jobs/subscription/process/begin/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'subscription/process/begin' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'subscription/process/begin');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
Controller/Common/Subscription/Process/Processor/Cgroup/StandardTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 {
13 13
 	protected function setUp()
14 14
 	{
15
-		\Aimeos\MShop\Factory::setCache( true );
15
+		\Aimeos\MShop\Factory::setCache(true);
16 16
 	}
17 17
 
18 18
 
19 19
 	protected function tearDown()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( false );
21
+		\Aimeos\MShop\Factory::setCache(false);
22 22
 	}
23 23
 
24 24
 
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 		$context = \TestHelperCntl::getContext();
28 28
 
29
-		$context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1', '2'] );
29
+		$context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1', '2']);
30 30
 
31
-		$fcn = function( $subject ){
31
+		$fcn = function($subject) {
32 32
 			return $subject->getGroups() === ['1', '2'];
33 33
 		};
34 34
 
35
-		$customerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Customer\\Manager\\Standard' )
36
-			->setConstructorArgs( [$context] )
37
-			->setMethods( ['getItem', 'saveItem'] )
35
+		$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')
36
+			->setConstructorArgs([$context])
37
+			->setMethods(['getItem', 'saveItem'])
38 38
 			->getMock();
39 39
 
40
-		\Aimeos\MShop\Factory::injectManager( $context, 'customer', $customerStub );
40
+		\Aimeos\MShop\Factory::injectManager($context, 'customer', $customerStub);
41 41
 
42 42
 		$customerItem = $customerStub->createItem();
43 43
 
44
-		$customerStub->expects( $this->once() )->method( 'getItem' )
45
-			->will( $this->returnValue( $customerItem ) );
44
+		$customerStub->expects($this->once())->method('getItem')
45
+			->will($this->returnValue($customerItem));
46 46
 
47
-		$customerStub->expects( $this->once() )->method( 'saveItem' )
48
-			->with( $this->callback( $fcn ) );
47
+		$customerStub->expects($this->once())->method('saveItem')
48
+			->with($this->callback($fcn));
49 49
 
50
-		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard( $context );
51
-		$object->begin( $this->getSubscription( $context ) );
50
+		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard($context);
51
+		$object->begin($this->getSubscription($context));
52 52
 	}
53 53
 
54 54
 
@@ -56,45 +56,45 @@  discard block
 block discarded – undo
56 56
 	{
57 57
 		$context = \TestHelperCntl::getContext();
58 58
 
59
-		$context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1', '2'] );
59
+		$context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1', '2']);
60 60
 
61
-		$fcn = function( $subject ){
61
+		$fcn = function($subject) {
62 62
 			return $subject->getGroups() === [];
63 63
 		};
64 64
 
65
-		$customerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Customer\\Manager\\Standard' )
66
-			->setConstructorArgs( [$context] )
67
-			->setMethods( ['getItem', 'saveItem'] )
65
+		$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')
66
+			->setConstructorArgs([$context])
67
+			->setMethods(['getItem', 'saveItem'])
68 68
 			->getMock();
69 69
 
70
-		\Aimeos\MShop\Factory::injectManager( $context, 'customer', $customerStub );
70
+		\Aimeos\MShop\Factory::injectManager($context, 'customer', $customerStub);
71 71
 
72
-		$customerItem = $customerStub->createItem()->setGroups( ['1', '2'] );
72
+		$customerItem = $customerStub->createItem()->setGroups(['1', '2']);
73 73
 
74
-		$customerStub->expects( $this->once() )->method( 'getItem' )
75
-			->will( $this->returnValue( $customerItem ) );
74
+		$customerStub->expects($this->once())->method('getItem')
75
+			->will($this->returnValue($customerItem));
76 76
 
77
-		$customerStub->expects( $this->once() )->method( 'saveItem' )
78
-			->with( $this->callback( $fcn ) );
77
+		$customerStub->expects($this->once())->method('saveItem')
78
+			->with($this->callback($fcn));
79 79
 
80
-		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard( $context );
81
-		$object->end( $this->getSubscription( $context ) );
80
+		$object = new \Aimeos\Controller\Common\Subscription\Process\Processor\Cgroup\Standard($context);
81
+		$object->end($this->getSubscription($context));
82 82
 	}
83 83
 
84 84
 
85
-	protected function getSubscription( $context )
85
+	protected function getSubscription($context)
86 86
 	{
87
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
87
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
88 88
 
89 89
 		$search = $manager->createSearch();
90
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
90
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
91 91
 
92
-		$items = $manager->searchItems( $search );
92
+		$items = $manager->searchItems($search);
93 93
 
94
-		if( ( $item = reset( $items ) ) !== false ) {
94
+		if (($item = reset($items)) !== false) {
95 95
 			return $item;
96 96
 		}
97 97
 
98
-		throw new \Exception( 'No subscription item found' );
98
+		throw new \Exception('No subscription item found');
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/End/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/end/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/end/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\\End\\' . $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\\End\\' . $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/end/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/end/decorators/excludes
155 155
 		 * @see controller/jobs/subscription/process/end/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'subscription/process/end' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'subscription/process/end');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/End/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\End\Factory::createController( $context, $aimeos );
20
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj );
19
+		$obj = \Aimeos\Controller\Jobs\Subscription\Process\End\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\End\Factory::createController( $context, $aimeos, 'Wrong$$$Name' );
29
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
30
+		\Aimeos\Controller\Jobs\Subscription\Process\End\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\End\Factory::createController( $context, $aimeos, 'WrongClass' );
39
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
40
+		\Aimeos\Controller\Jobs\Subscription\Process\End\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\End\Factory::createController( $context, $aimeos, 'Factory' );
49
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
50
+		\Aimeos\Controller\Jobs\Subscription\Process\End\Factory::createController($context, $aimeos, 'Factory');
51 51
 	}
52 52
 
53 53
 }
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,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.