Completed
Push — master ( 4400c4...d185a2 )
by Aimeos
02:55
created
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/jobs/src/Controller/Jobs/Subscription/Process/Base.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,39 +27,39 @@
 block discarded – undo
27 27
 	 * @param array $pnames List of processor names
28 28
 	 * @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object
29 29
 	 */
30
-	protected function getProcessors( array $pnames )
30
+	protected function getProcessors(array $pnames)
31 31
 	{
32 32
 		$list = [];
33 33
 		$context = $this->getContext();
34 34
 		$config = $context->getConfig();
35 35
 		$iface = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface';
36 36
 
37
-		foreach( $pnames as $pname )
37
+		foreach ($pnames as $pname)
38 38
 		{
39
-			if( ctype_alnum( $pname ) === false )
39
+			if (ctype_alnum($pname) === false)
40 40
 			{
41 41
 				$classname = is_string($pname) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>';
42
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
42
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
43 43
 			}
44 44
 
45
-			$name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' );
45
+			$name = $config->get('controller/common/subscription/process/processor/' . $pname . '/name', 'Standard');
46 46
 
47
-			if( ctype_alnum( $name ) === false )
47
+			if (ctype_alnum($name) === false)
48 48
 			{
49 49
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>';
50
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
50
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
51 51
 			}
52 52
 
53
-			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name;
53
+			$classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst($pname) . '\\' . $name;
54 54
 
55
-			if( class_exists( $classname ) === false ) {
56
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
55
+			if (class_exists($classname) === false) {
56
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
57 57
 			}
58 58
 
59
-			$object = new $classname( $context );
59
+			$object = new $classname($context);
60 60
 
61
-			if( !( $object instanceof $iface ) ) {
62
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) );
61
+			if (!($object instanceof $iface)) {
62
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface));
63 63
 			}
64 64
 
65 65
 			$list[$pname] = $object;
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@
 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() ) );
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 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 start' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start');
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', 'Process subscriptions initially' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially');
43 43
 	}
44 44
 
45 45
 
@@ -65,50 +65,50 @@  discard block
 block discarded – undo
65 65
 		 * @since 2018.04
66 66
 		 * @category Developer
67 67
 		 */
68
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
68
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
69 69
 
70
-		$processors = $this->getProcessors( $names );
71
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
70
+		$processors = $this->getProcessors($names);
71
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
72 72
 
73
-		$search = $manager->createSearch( true );
73
+		$search = $manager->createSearch(true);
74 74
 		$expr = [
75
-			$search->compare( '==', 'subscription.datenext', null ),
75
+			$search->compare('==', 'subscription.datenext', null),
76 76
 			$search->getConditions(),
77 77
 		];
78
-		$search->setConditions( $search->combine( '&&', $expr ) );
79
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
78
+		$search->setConditions($search->combine('&&', $expr));
79
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
80 80
 
81 81
 		$start = 0;
82 82
 
83 83
 		do
84 84
 		{
85
-			$search->setSlice( $start, 100 );
86
-			$items = $manager->searchItems( $search );
85
+			$search->setSlice($start, 100);
86
+			$items = $manager->searchItems($search);
87 87
 
88
-			foreach( $items as $item )
88
+			foreach ($items as $item)
89 89
 			{
90 90
 				try
91 91
 				{
92
-					foreach( $processors as $processor ) {
93
-						$processor->begin( $item );
92
+					foreach ($processors as $processor) {
93
+						$processor->begin($item);
94 94
 					}
95 95
 
96
-					$interval = new \DateInterval( $item->getInterval() );
97
-					$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
96
+					$interval = new \DateInterval($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
 }
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.
controller/jobs/src/Controller/Jobs/Subscription/Process/End/Standard.php 2 patches
Spacing   +21 added lines, -21 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 end' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process end');
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', 'Terminates expired subscriptions' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Terminates expired subscriptions');
43 43
 	}
44 44
 
45 45
 
@@ -65,48 +65,48 @@  discard block
 block discarded – undo
65 65
 		 * @since 2018.04
66 66
 		 * @category Developer
67 67
 		 */
68
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
68
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
69 69
 
70
-		$processors = $this->getProcessors( $names );
71
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
70
+		$processors = $this->getProcessors($names);
71
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
72 72
 
73
-		$search = $manager->createSearch( true );
73
+		$search = $manager->createSearch(true);
74 74
 		$expr = [
75
-			$search->compare( '<', 'subscription.dateend', date( 'Y-m-d' ) ),
75
+			$search->compare('<', 'subscription.dateend', date('Y-m-d')),
76 76
 			$search->getConditions(),
77 77
 		];
78
-		$search->setConditions( $search->combine( '&&', $expr ) );
79
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
78
+		$search->setConditions($search->combine('&&', $expr));
79
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
80 80
 
81 81
 		$start = 0;
82 82
 
83 83
 		do
84 84
 		{
85
-			$search->setSlice( $start, 100 );
86
-			$items = $manager->searchItems( $search );
85
+			$search->setSlice($start, 100);
86
+			$items = $manager->searchItems($search);
87 87
 
88
-			foreach( $items as $item )
88
+			foreach ($items as $item)
89 89
 			{
90 90
 				try
91 91
 				{
92
-					foreach( $processors as $processor ) {
93
-						$processor->end( $item );
92
+					foreach ($processors as $processor) {
93
+						$processor->end($item);
94 94
 					}
95 95
 
96
-					$item->setStatus( 0 );
97
-					$manager->saveItem( $item );
96
+					$item->setStatus(0);
97
+					$manager->saveItem($item);
98 98
 				}
99
-				catch( \Exception $e )
99
+				catch (\Exception $e)
100 100
 				{
101 101
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
102
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
103
-					$logger->log( $e->getTraceAsString() );
102
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
103
+					$logger->log($e->getTraceAsString());
104 104
 				}
105 105
 			}
106 106
 
107
-			$count = count( $items );
107
+			$count = count($items);
108 108
 			$start += $count;
109 109
 		}
110
-		while( $count === $search->getSliceSize() );
110
+		while ($count === $search->getSliceSize());
111 111
 	}
112 112
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,8 +95,7 @@
 block discarded – undo
95 95
 
96 96
 					$item->setStatus( 0 );
97 97
 					$manager->saveItem( $item );
98
-				}
99
-				catch( \Exception $e )
98
+				} catch( \Exception $e )
100 99
 				{
101 100
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
102 101
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
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.
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.