Completed
Push — master ( afa75e...0bae75 )
by Aimeos
02:14
created
controller/frontend/src/Controller/Frontend/Subscription/Decorator/Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
 	/**
134 134
 	 * Returns the frontend controller
135 135
 	 *
136
-	 * @return \Aimeos\Controller\Frontend\Subscription\Iface Frontend controller object
136
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
137 137
 	 */
138 138
 	protected function getController()
139 139
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32 32
 	 */
33
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35 35
 		$iface = '\Aimeos\Controller\Frontend\Subscription\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 * @param string $id Unique subscription ID
66 66
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
67 67
 	 */
68
-	public function cancel( $id )
68
+	public function cancel($id)
69 69
 	{
70
-		return $this->controller->cancel( $id );
70
+		return $this->controller->cancel($id);
71 71
 	}
72 72
 
73 73
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param string $id Unique subscription ID
100 100
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
101 101
 	 */
102
-	public function getItem( $id )
102
+	public function getItem($id)
103 103
 	{
104
-		return $this->controller->getItem( $id );
104
+		return $this->controller->getItem($id);
105 105
 	}
106 106
 
107 107
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
112 112
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
113 113
 	 */
114
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item )
114
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item)
115 115
 	{
116
-		return $this->controller->saveItem( $item );
116
+		return $this->controller->saveItem($item);
117 117
 	}
118 118
 
119 119
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 	 * @param integer &$total|null Variable that will contain the total number of available items
125 125
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
128 128
 	{
129
-		return $this->controller->searchItems( $filter, $total );
129
+		return $this->controller->searchItems($filter, $total);
130 130
 	}
131 131
 
132 132
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Iface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $id Unique subscription ID
26 26
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
27 27
 	 */
28
-	public function cancel( $id );
28
+	public function cancel($id);
29 29
 
30 30
 	/**
31 31
 	 * Returns the filter for searching items
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param string $id Unique subscription ID
48 48
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
49 49
 	 */
50
-	public function getItem( $id );
50
+	public function getItem($id);
51 51
 
52 52
 	/**
53 53
 	 * Saves the modified subscription item
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
56 56
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
57 57
 	 */
58
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item );
58
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item);
59 59
 
60 60
 	/**
61 61
 	 * Returns the subscription items based on the given filter that belong to the current user
@@ -64,5 +64,5 @@  discard block
 block discarded – undo
64 64
 	 * @param integer &$total|null Variable that will contain the total number of available items
65 65
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
66 66
 	 */
67
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null );
67
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null);
68 68
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string|null $name Name of the controller implementaton (default: "Standard")
29 29
 	 * @return \Aimeos\Controller\Frontend\Subscription\Iface Controller object
30 30
 	 */
31
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
31
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
32 32
 	{
33 33
 		/** controller/frontend/subscription/name
34 34
 		 * Class name of the used subscription frontend controller implementation
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 		 * @since 2018.04
64 64
 		 * @category Developer
65 65
 		 */
66
-		if( $name === null ) {
67
-			$name = $context->getConfig()->get( 'controller/frontend/subscription/name', 'Standard' );
66
+		if ($name === null) {
67
+			$name = $context->getConfig()->get('controller/frontend/subscription/name', 'Standard');
68 68
 		}
69 69
 
70
-		if( ctype_alnum( $name ) === false ) {
71
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>';
72
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
70
+		if (ctype_alnum($name) === false) {
71
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>';
72
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
73 73
 		}
74 74
 
75 75
 		$iface = '\\Aimeos\\Controller\\Frontend\\Subscription\\Iface';
76 76
 		$classname = '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name;
77 77
 
78
-		$manager = self::createControllerBase( $context, $classname, $iface );
78
+		$manager = self::createControllerBase($context, $classname, $iface);
79 79
 
80 80
 		/** controller/frontend/subscription/decorators/excludes
81 81
 		 * Excludes decorators added by the "common" option from the subscription frontend controllers
@@ -151,6 +151,6 @@  discard block
 block discarded – undo
151 151
 		 * @see controller/frontend/subscription/decorators/excludes
152 152
 		 * @see controller/frontend/subscription/decorators/global
153 153
 		 */
154
-		return self::addControllerDecorators( $context, $manager, 'subscription' );
154
+		return self::addControllerDecorators($context, $manager, 'subscription');
155 155
 	}
156 156
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Standard.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 	 * @param string $id Unique subscription ID
28 28
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
29 29
 	 */
30
-	public function cancel( $id )
30
+	public function cancel($id)
31 31
 	{
32
-		$item = $this->getItem( $id );
32
+		$item = $this->getItem($id);
33 33
 
34
-		$interval = \DateInterval::createFromDateString( $item->getInterval() );
35
-		$item->setDateEnd( date_create( $item->getDateNext() )->add( $interval )->format( 'Y-m-d' ) );
34
+		$interval = \DateInterval::createFromDateString($item->getInterval());
35
+		$item->setDateEnd(date_create($item->getDateNext())->add($interval)->format('Y-m-d'));
36 36
 
37
-		return $this->saveItem( $item );
37
+		return $this->saveItem($item);
38 38
 	}
39 39
 
40 40
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function createFilter()
47 47
 	{
48
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch( true );
48
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch(true);
49 49
 	}
50 50
 
51 51
 
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 	 * @param string $id Unique subscription ID
56 56
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
57 57
 	 */
58
-	public function getItem( $id )
58
+	public function getItem($id)
59 59
 	{
60 60
 		$context = $this->getContext();
61
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
61
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
62 62
 
63 63
 		$filter = $manager->createSearch();
64 64
 		$expr = [
65
-			$filter->compare( '==', 'subscription.id', $id ),
66
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
65
+			$filter->compare('==', 'subscription.id', $id),
66
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
67 67
 			$filter->getConditions(),
68 68
 		];
69
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
69
+		$filter->setConditions($filter->combine('&&', $expr));
70 70
 
71
-		$items = $this->searchItems( $filter );
71
+		$items = $this->searchItems($filter);
72 72
 
73
-		if( ( $item = reset( $items ) ) === false )
73
+		if (($item = reset($items)) === false)
74 74
 		{
75 75
 			$msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"';
76
-			throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) );
76
+			throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId()));
77 77
 		}
78 78
 
79 79
 		return $item;
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 	public function getIntervals()
89 89
 	{
90 90
 		$intervals = [];
91
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
91
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
92 92
 
93
-		$search = $manager->createSearch( true );
93
+		$search = $manager->createSearch(true);
94 94
 		$expr = array(
95 95
 			$search->getConditions(),
96
-			$search->compare( '==', 'attribute.domain', 'product' ),
97
-			$search->compare( '==', 'attribute.type.code', 'interval' ),
96
+			$search->compare('==', 'attribute.domain', 'product'),
97
+			$search->compare('==', 'attribute.type.code', 'interval'),
98 98
 		);
99
-		$search->setConditions( $search->combine( '&&', $expr ) );
100
-		$search->setSlice( 0, 0x7fffffff );
99
+		$search->setConditions($search->combine('&&', $expr));
100
+		$search->setSlice(0, 0x7fffffff);
101 101
 
102
-		foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) {
102
+		foreach ($manager->searchItems($search, ['text']) as $attrItem) {
103 103
 			$intervals[$attrItem->getCode()] = $attrItem;
104 104
 		}
105 105
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
113 113
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
114 114
 	 */
115
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item )
115
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item)
116 116
 	{
117
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item );
117
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item);
118 118
 	}
119 119
 
120 120
 
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 	 * @param integer &$total|null Variable that will contain the total number of available items
126 126
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
127 127
 	 */
128
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
128
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
129 129
 	{
130 130
 		$context = $this->getContext();
131
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
131
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
132 132
 
133 133
 		$expr = [
134
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
134
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
135 135
 			$filter->getConditions(),
136 136
 		];
137
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
137
+		$filter->setConditions($filter->combine('&&', $expr));
138 138
 
139
-		return $manager->searchItems( $filter, [], $total );
139
+		return $manager->searchItems($filter, [], $total);
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Decorator/Base.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32 32
 	 */
33
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35 35
 		$iface = '\Aimeos\Controller\Frontend\Order\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param string $type Arbitrary order type (max. eight chars)
67 67
 	 * @return \Aimeos\MShop\Order\Item\Iface Created order object
68 68
 	 */
69
-	public function addItem( $baseId, $type )
69
+	public function addItem($baseId, $type)
70 70
 	{
71
-		return $this->controller->addItem( $baseId, $type );
71
+		return $this->controller->addItem($baseId, $type);
72 72
 	}
73 73
 
74 74
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param boolean $default Use default criteria to limit orders
91 91
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
92 92
 	 */
93
-	public function getItem( $id, $default = true )
93
+	public function getItem($id, $default = true)
94 94
 	{
95
-		return $this->controller->getItem( $id, $default );
95
+		return $this->controller->getItem($id, $default);
96 96
 	}
97 97
 
98 98
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @param \Aimeos\MShop\Order\Item\Iface $item Order object
103 103
 	 * @return \Aimeos\MShop\Order\Item\Iface Saved order item
104 104
 	 */
105
-	public function saveItem( \Aimeos\MShop\Order\Item\Iface $item )
105
+	public function saveItem(\Aimeos\MShop\Order\Item\Iface $item)
106 106
 	{
107
-		return $this->controller->saveItem( $item );
107
+		return $this->controller->saveItem($item);
108 108
 	}
109 109
 
110 110
 
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 	 * @param integer &$total|null Variable that will contain the total number of available items
116 116
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
117 117
 	 */
118
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
118
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
119 119
 	{
120
-		return $this->controller->searchItems( $filter, $total );
120
+		return $this->controller->searchItems($filter, $total);
121 121
 	}
122 122
 
123 123
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
141 141
 	 * @return void
142 142
 	 */
143
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
143
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
144 144
 	{
145
-		$this->getController()->block( $orderItem );
145
+		$this->getController()->block($orderItem);
146 146
 	}
147 147
 
148 148
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
166 166
 	 * @return void
167 167
 	 */
168
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
168
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
169 169
 	{
170
-		$this->getController()->unblock( $orderItem );
170
+		$this->getController()->unblock($orderItem);
171 171
 	}
172 172
 
173 173
 
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
187 187
 	 * @return void
188 188
 	 */
189
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
189
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
190 190
 	{
191
-		$this->getController()->update( $orderItem );
191
+		$this->getController()->update($orderItem);
192 192
 	}
193 193
 
194 194
 
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Subscription/Decorator/BaseTest.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,122 +20,122 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCancel()
69 69
 	{
70
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem();
70
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'cancel' )->will( $this->returnValue( $item ) );
72
+		$this->stub->expects($this->once())->method('cancel')->will($this->returnValue($item));
73 73
 
74
-		$this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->cancel( -1, '' ) );
74
+		$this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->cancel( -1, '' ));
75 75
 	}
76 76
 
77 77
 
78 78
 	public function testCreateFilter()
79 79
 	{
80
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createSearch();
80
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createSearch();
81 81
 
82
-		$this->stub->expects( $this->once() )->method( 'createFilter' )->will( $this->returnValue( $search ) );
82
+		$this->stub->expects($this->once())->method('createFilter')->will($this->returnValue($search));
83 83
 
84
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
84
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
85 85
 	}
86 86
 
87 87
 
88 88
 	public function testGetItem()
89 89
 	{
90
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem();
90
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem();
91 91
 
92
-		$this->stub->expects( $this->once() )->method( 'getItem' )->will( $this->returnValue( $item ) );
92
+		$this->stub->expects($this->once())->method('getItem')->will($this->returnValue($item));
93 93
 
94
-		$this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem( -1 ) );
94
+		$this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem( -1 ));
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testSaveItem()
99 99
 	{
100
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem();
100
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem();
101 101
 
102
-		$this->stub->expects( $this->once() )->method( 'saveItem' );
102
+		$this->stub->expects($this->once())->method('saveItem');
103 103
 
104
-		$this->object->saveItem( $item );
104
+		$this->object->saveItem($item);
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testSearchItems()
109 109
 	{
110
-		$search = $this->getMockBuilder( '\Aimeos\MW\Criteria\Iface' )->getMock();
110
+		$search = $this->getMockBuilder('\Aimeos\MW\Criteria\Iface')->getMock();
111 111
 
112
-		$this->stub->expects( $this->once() )->method( 'searchItems' )->will( $this->returnValue( [] ) );
112
+		$this->stub->expects($this->once())->method('searchItems')->will($this->returnValue([]));
113 113
 
114
-		$this->assertEquals( [], $this->object->searchItems( $search ) );
114
+		$this->assertEquals([], $this->object->searchItems($search));
115 115
 	}
116 116
 
117 117
 
118 118
 	public function testGetIntervals()
119 119
 	{
120
-		$this->stub->expects( $this->once() )->method( 'getIntervals' )->will( $this->returnValue( [] ) );
120
+		$this->stub->expects($this->once())->method('getIntervals')->will($this->returnValue([]));
121 121
 
122
-		$this->assertEquals( [], $this->object->getIntervals() );
122
+		$this->assertEquals([], $this->object->getIntervals());
123 123
 	}
124 124
 
125 125
 
126 126
 	public function testGetController()
127 127
 	{
128
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
128
+		$result = $this->access('getController')->invokeArgs($this->object, []);
129 129
 
130
-		$this->assertSame( $this->stub, $result );
130
+		$this->assertSame($this->stub, $result);
131 131
 	}
132 132
 
133 133
 
134
-	protected function access( $name )
134
+	protected function access($name)
135 135
 	{
136
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Subscription\Decorator\Base' );
137
-		$method = $class->getMethod( $name );
138
-		$method->setAccessible( true );
136
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Subscription\Decorator\Base');
137
+		$method = $class->getMethod($name);
138
+		$method->setAccessible(true);
139 139
 
140 140
 		return $method;
141 141
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Subscription/StandardTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -17,104 +17,104 @@
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperFrontend::getContext();
23
-		$this->object = new \Aimeos\Controller\Frontend\Subscription\Standard( $this->context );
23
+		$this->object = new \Aimeos\Controller\Frontend\Subscription\Standard($this->context);
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
-		\Aimeos\MShop\Factory::setCache( false );
31
+		\Aimeos\MShop\Factory::setCache(false);
32 32
 		\Aimeos\MShop\Factory::clear();
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testCancel()
37 37
 	{
38
-		$this->context->setUserId( $this->getCustomerId() );
39
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem();
38
+		$this->context->setUserId($this->getCustomerId());
39
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem();
40 40
 
41
-		$cntl = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Standard' )
42
-			->setConstructorArgs( [$this->context] )
43
-			->setMethods( ['saveItem'] )
41
+		$cntl = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard')
42
+			->setConstructorArgs([$this->context])
43
+			->setMethods(['saveItem'])
44 44
 			->getMock();
45 45
 
46
-		$cntl->expects( $this->once() )->method( 'saveItem' )
47
-			->will( $this->returnValue( $item ) );
46
+		$cntl->expects($this->once())->method('saveItem')
47
+			->will($this->returnValue($item));
48 48
 
49
-		$this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $cntl->cancel( $this->getSubscriptionId() ) );
49
+		$this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $cntl->cancel($this->getSubscriptionId()));
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testCreateFilter()
54 54
 	{
55
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
55
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
56 56
 	}
57 57
 
58 58
 
59 59
 	public function testGetIntervals()
60 60
 	{
61
-		$this->assertGreaterThan( 0, count( $this->object->getIntervals() ) );
61
+		$this->assertGreaterThan(0, count($this->object->getIntervals()));
62 62
 	}
63 63
 
64 64
 
65 65
 	public function testGetItem()
66 66
 	{
67 67
 		$id = $this->getSubscriptionId();
68
-		$this->context->setUserId( $this->getCustomerId() );
68
+		$this->context->setUserId($this->getCustomerId());
69 69
 
70
-		$this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem( $id ) );
70
+		$this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem($id));
71 71
 	}
72 72
 
73 73
 
74 74
 	public function testGetItemException()
75 75
 	{
76
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Subscription\Exception' );
76
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Subscription\Exception');
77 77
 		$this->object->getItem( -1 );
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testSaveItem()
82 82
 	{
83
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
84
-			->setConstructorArgs( [$this->context] )
85
-			->setMethods( ['saveItem'] )
83
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
84
+			->setConstructorArgs([$this->context])
85
+			->setMethods(['saveItem'])
86 86
 			->getMock();
87 87
 
88
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $manager );
88
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $manager);
89 89
 
90
-		$manager->expects( $this->once() )->method( 'saveItem' )
91
-			->will( $this->returnValue( $manager->createItem() ) );
90
+		$manager->expects($this->once())->method('saveItem')
91
+			->will($this->returnValue($manager->createItem()));
92 92
 
93
-		$this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->saveItem( $manager->createItem() ) );
93
+		$this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->saveItem($manager->createItem()));
94 94
 	}
95 95
 
96 96
 
97 97
 	public function testSearchItems()
98 98
 	{
99
-		$this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) );
99
+		$this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter()));
100 100
 	}
101 101
 
102 102
 	protected function getCustomerId()
103 103
 	{
104
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
105
-		return $manager->findItem( 'UTC001' )->getId();
104
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
105
+		return $manager->findItem('UTC001')->getId();
106 106
 	}
107 107
 
108 108
 
109 109
 	protected function getSubscriptionId()
110 110
 	{
111
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
112
-		$search = $manager->createSearch()->setSlice( 0, 1 );
113
-		$search->setConditions( $search->compare( '==', 'order.base.customerid', $this->getCustomerId() ) );
114
-		$result = $manager->searchItems( $search );
111
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
112
+		$search = $manager->createSearch()->setSlice(0, 1);
113
+		$search->setConditions($search->compare('==', 'order.base.customerid', $this->getCustomerId()));
114
+		$result = $manager->searchItems($search);
115 115
 
116
-		if( ( $item = reset( $result ) ) === false ) {
117
-			throw new \RuntimeException( 'No subscription item found' );
116
+		if (($item = reset($result)) === false) {
117
+			throw new \RuntimeException('No subscription item found');
118 118
 		}
119 119
 
120 120
 		return $item->getId();
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Subscription/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Subscription\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
-		\Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Subscription\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Subscription\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.