Completed
Push — master ( 10ff4e...12c65b )
by Aimeos
02:25
created
controller/frontend/src/Controller/Frontend/Service/Standard.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@
 block discarded – undo
121 121
 				} else {
122 122
 					unset( $items[$id] );
123 123
 				}
124
-			}
125
-			catch( \Aimeos\MShop\Service\Exception $e )
124
+			} catch( \Aimeos\MShop\Service\Exception $e )
126 125
 			{
127 126
 				$msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id );
128 127
 				$this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN );
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
33 33
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
34 34
 	 */
35
-	public function checkAttributes( $serviceId, array $attributes )
35
+	public function checkAttributes($serviceId, array $attributes)
36 36
 	{
37
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
38
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
37
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
38
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
39 39
 
40
-		return array_filter( $provider->checkConfigFE( $attributes ) );
40
+		return array_filter($provider->checkConfigFE($attributes));
41 41
 	}
42 42
 
43 43
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param string[] $ref List of domain names whose items should be fetched too
49 49
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
50 50
 	 */
51
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
51
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
52 52
 	{
53
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
54
-		return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) );
53
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
54
+		return $manager->getProvider($manager->getItem($serviceId, $ref, true));
55 55
 	}
56 56
 
57 57
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	 * @param string[] $ref List of domain names whose items should be fetched too
63 63
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
64 64
 	 */
65
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
65
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
66 66
 	{
67 67
 		$list = [];
68
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
68
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
69 69
 
70
-		$search = $manager->createSearch( true );
71
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
70
+		$search = $manager->createSearch(true);
71
+		$search->setSortations(array($search->sort('+', 'service.position')));
72 72
 
73
-		if( $type != null )
73
+		if ($type != null)
74 74
 		{
75 75
 			$expr = array(
76 76
 				$search->getConditions(),
77
-				$search->compare( '==', 'service.type.code', $type ),
78
-				$search->compare( '==', 'service.type.domain', 'service' ),
77
+				$search->compare('==', 'service.type.code', $type),
78
+				$search->compare('==', 'service.type.domain', 'service'),
79 79
 			);
80
-			$search->setConditions( $search->combine( '&&', $expr ) );
80
+			$search->setConditions($search->combine('&&', $expr));
81 81
 		}
82 82
 
83
-		foreach( $manager->searchItems( $search, $ref ) as $id => $item ) {
84
-			$list[$id] = $manager->getProvider( $item );
83
+		foreach ($manager->searchItems($search, $ref) as $id => $item) {
84
+			$list[$id] = $manager->getProvider($item);
85 85
 		}
86 86
 
87 87
 		return $list;
@@ -98,38 +98,38 @@  discard block
 block discarded – undo
98 98
 	 * @throws \Exception If an error occurs
99 99
 	 * @deprecated Use getProviders() instead
100 100
 	 */
101
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] )
101
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'])
102 102
 	{
103
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
103
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
104 104
 
105
-		$search = $serviceManager->createSearch( true );
105
+		$search = $serviceManager->createSearch(true);
106 106
 		$expr = array(
107 107
 			$search->getConditions(),
108
-			$search->compare( '==', 'service.type.domain', 'service' ),
109
-			$search->compare( '==', 'service.type.code', $type ),
108
+			$search->compare('==', 'service.type.domain', 'service'),
109
+			$search->compare('==', 'service.type.code', $type),
110 110
 		);
111
-		$search->setConditions( $search->combine( '&&', $expr ) );
112
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
111
+		$search->setConditions($search->combine('&&', $expr));
112
+		$search->setSortations(array($search->sort('+', 'service.position')));
113 113
 
114
-		$items = $serviceManager->searchItems( $search, $ref );
114
+		$items = $serviceManager->searchItems($search, $ref);
115 115
 
116 116
 
117
-		foreach( $items as $id => $service )
117
+		foreach ($items as $id => $service)
118 118
 		{
119 119
 			try
120 120
 			{
121
-				$provider = $serviceManager->getProvider( $service );
121
+				$provider = $serviceManager->getProvider($service);
122 122
 
123
-				if( $provider->isAvailable( $basket ) ) {
123
+				if ($provider->isAvailable($basket)) {
124 124
 					$this->providers[$type][$id] = $provider;
125 125
 				} else {
126
-					unset( $items[$id] );
126
+					unset($items[$id]);
127 127
 				}
128 128
 			}
129
-			catch( \Aimeos\MShop\Service\Exception $e )
129
+			catch (\Aimeos\MShop\Service\Exception $e)
130 130
 			{
131
-				$msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id );
132
-				$this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN );
131
+				$msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id);
132
+				$this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN);
133 133
 			}
134 134
 		}
135 135
 
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 	 * @throws \Exception If an error occurs
151 151
 	 * @deprecated Use getProvider() instead
152 152
 	 */
153
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
153
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
154 154
 	{
155
-		if( isset( $this->providers[$type][$serviceId] ) ) {
156
-			return $this->providers[$type][$serviceId]->getConfigFE( $basket );
155
+		if (isset($this->providers[$type][$serviceId])) {
156
+			return $this->providers[$type][$serviceId]->getConfigFE($basket);
157 157
 		}
158 158
 
159
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
160
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
159
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
160
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
161 161
 
162
-		return $serviceManager->getProvider( $item )->getConfigFE( $basket );
162
+		return $serviceManager->getProvider($item)->getConfigFE($basket);
163 163
 	}
164 164
 
165 165
 
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
 	 * @throws \Exception If an error occurs
176 176
 	 * @deprecated Use getProvider() instead
177 177
 	 */
178
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
178
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
179 179
 	{
180
-		if( isset( $this->providers[$type][$serviceId] ) ) {
181
-			return $this->providers[$type][$serviceId]->calcPrice( $basket );
180
+		if (isset($this->providers[$type][$serviceId])) {
181
+			return $this->providers[$type][$serviceId]->calcPrice($basket);
182 182
 		}
183 183
 
184
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
185
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
184
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
185
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
186 186
 
187
-		return $serviceManager->getProvider( $item )->calcPrice( $basket );
187
+		return $serviceManager->getProvider($item)->calcPrice($basket);
188 188
 	}
189 189
 
190 190
 
@@ -200,22 +200,22 @@  discard block
 block discarded – undo
200 200
 	 * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available
201 201
 	 * @deprecated Use checkAttributes() instead
202 202
 	 */
203
-	public function checkServiceAttributes( $type, $serviceId, array $attributes )
203
+	public function checkServiceAttributes($type, $serviceId, array $attributes)
204 204
 	{
205
-		if( !isset( $this->providers[$type][$serviceId] ) )
205
+		if (!isset($this->providers[$type][$serviceId]))
206 206
 		{
207
-			$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
208
-			$item = $serviceManager->getItem( $serviceId, ['price'], true );
207
+			$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
208
+			$item = $serviceManager->getItem($serviceId, ['price'], true);
209 209
 
210
-			$this->providers[$type][$serviceId] = $serviceManager->getProvider( $item );
210
+			$this->providers[$type][$serviceId] = $serviceManager->getProvider($item);
211 211
 		}
212 212
 
213
-		$errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes );
213
+		$errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes);
214 214
 
215
-		foreach( $errors as $key => $msg )
215
+		foreach ($errors as $key => $msg)
216 216
 		{
217
-			if( $msg === null ) {
218
-				unset( $errors[$key] );
217
+			if ($msg === null) {
218
+				unset($errors[$key]);
219 219
 			}
220 220
 		}
221 221
 
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Customer/StandardTest.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -18,106 +18,106 @@
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context );
21
+		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context);
22 22
 	}
23 23
 
24 24
 
25 25
 	protected function tearDown()
26 26
 	{
27
-		unset( $this->context, $this->object );
27
+		unset($this->context, $this->object);
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testAddEditSaveDeleteItem()
32 32
 	{
33
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
34
-		$id = $manager->findItem( 'UTC001' )->getId();
33
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
34
+		$id = $manager->findItem('UTC001')->getId();
35 35
 
36
-		$this->context->setUserId( $id );
37
-		$item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] );
38
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
36
+		$this->context->setUserId($id);
37
+		$item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]);
38
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
39 39
 
40
-		$this->context->setUserId( $item->getId() );
41
-		$item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] );
42
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
40
+		$this->context->setUserId($item->getId());
41
+		$item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']);
42
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
43 43
 
44
-		$item->setStatus( 0 );
45
-		$this->object->saveItem( $item );
46
-		$this->assertEquals( 0, $item->getStatus() );
44
+		$item->setStatus(0);
45
+		$this->object->saveItem($item);
46
+		$this->assertEquals(0, $item->getStatus());
47 47
 
48
-		$this->object->deleteItem( $item->getId() );
48
+		$this->object->deleteItem($item->getId());
49 49
 
50
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
51
-		$manager->findItem( 'unittest-ctnl' );
50
+		$this->setExpectedException('\Aimeos\MShop\Exception');
51
+		$manager->findItem('unittest-ctnl');
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testCreateItem()
56 56
 	{
57 57
 		$result = $this->object->createItem();
58
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
58
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testGetItem()
63 63
 	{
64
-		$id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId();
65
-		$this->context->setUserId( $id );
64
+		$id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId();
65
+		$this->context->setUserId($id);
66 66
 
67
-		$result = $this->object->getItem( $id, ['customer/address', 'text'] );
67
+		$result = $this->object->getItem($id, ['customer/address', 'text']);
68 68
 
69
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
70
-		$this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) );
71
-		$this->assertEquals( 1, count( $result->getAddressItems() ) );
69
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
70
+		$this->assertEquals(1, count($result->getRefItems('text')));
71
+		$this->assertEquals(1, count($result->getAddressItems()));
72 72
 	}
73 73
 
74 74
 
75 75
 	public function testFindItem()
76 76
 	{
77
-		$result = $this->object->findItem( 'UTC001' );
78
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
77
+		$result = $this->object->findItem('UTC001');
78
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testAddEditSaveDeleteAddressItem()
83 83
 	{
84
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
85
-		$this->context->setUserId( $customer->getId() );
84
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
85
+		$this->context->setUserId($customer->getId());
86 86
 
87
-		$item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] );
88
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
87
+		$item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']);
88
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
89 89
 
90
-		$item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] );
91
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
90
+		$item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']);
91
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
92 92
 
93
-		$item->setLastName( 'test' );
94
-		$this->object->saveAddressItem( $item );
95
-		$this->assertEquals( 'test', $item->getLastName() );
93
+		$item->setLastName('test');
94
+		$this->object->saveAddressItem($item);
95
+		$this->assertEquals('test', $item->getLastName());
96 96
 
97
-		$this->object->deleteAddressItem( $item->getId() );
97
+		$this->object->deleteAddressItem($item->getId());
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testCreateAddressItem()
102 102
 	{
103 103
 		$result = $this->object->createAddressItem();
104
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
104
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testGetAddressItem()
109 109
 	{
110
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' );
110
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address');
111 111
 		$search = $manager->createSearch();
112
-		$search->setSlice( 0, 1 );
113
-		$result = $manager->searchItems( $search );
112
+		$search->setSlice(0, 1);
113
+		$result = $manager->searchItems($search);
114 114
 
115
-		if( ( $item = reset( $result ) ) === false ) {
116
-			throw new \RuntimeException( 'No customer address available' );
115
+		if (($item = reset($result)) === false) {
116
+			throw new \RuntimeException('No customer address available');
117 117
 		}
118 118
 
119
-		$this->context->setUserId( $item->getParentId() );
120
-		$result = $this->object->getAddressItem( $item->getId() );
121
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
119
+		$this->context->setUserId($item->getParentId());
120
+		$result = $this->object->getAddressItem($item->getId());
121
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Service/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\\Service\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Service/Decorator/BaseTest.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -20,137 +20,137 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\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\Service\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Service\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\Service\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\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 testGetProvider()
69 69
 	{
70
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
71
-		$provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) );
70
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
71
+		$provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery'));
72 72
 
73
-		$this->stub->expects( $this->once() )->method( 'getProvider' )
74
-			->will( $this->returnValue( $provider ) );
73
+		$this->stub->expects($this->once())->method('getProvider')
74
+			->will($this->returnValue($provider));
75 75
 
76
-		$this->assertSame( $provider, $this->object->getProvider( -1 ) );
76
+		$this->assertSame($provider, $this->object->getProvider( -1 ));
77 77
 	}
78 78
 
79 79
 
80 80
 	public function testGetProvideres()
81 81
 	{
82
-		$this->stub->expects( $this->once() )->method( 'getProviders' )
83
-			->will( $this->returnValue( [] ) );
82
+		$this->stub->expects($this->once())->method('getProviders')
83
+			->will($this->returnValue([]));
84 84
 
85
-		$this->assertEquals( [], $this->object->getProviders( 'payment' ) );
85
+		$this->assertEquals([], $this->object->getProviders('payment'));
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testCheckAttributes()
90 90
 	{
91
-		$this->stub->expects( $this->once() )->method( 'checkAttributes' )
92
-			->will( $this->returnValue( [] ) );
91
+		$this->stub->expects($this->once())->method('checkAttributes')
92
+			->will($this->returnValue([]));
93 93
 
94
-		$this->assertEquals( [], $this->object->checkAttributes( -1, [] ) );
94
+		$this->assertEquals([], $this->object->checkAttributes( -1, [] ));
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testGetServices()
99 99
 	{
100
-		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem();
100
+		$basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem();
101 101
 
102
-		$this->stub->expects( $this->once() )->method( 'getServices' )
103
-			->will( $this->returnValue( [] ) );
102
+		$this->stub->expects($this->once())->method('getServices')
103
+			->will($this->returnValue([]));
104 104
 
105
-		$this->assertEquals( [], $this->object->getServices( 'payment', $basket ) );
105
+		$this->assertEquals([], $this->object->getServices('payment', $basket));
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testGetServiceAttributes()
110 110
 	{
111
-		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem();
111
+		$basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem();
112 112
 
113
-		$this->stub->expects( $this->once() )->method( 'getServiceAttributes' )
114
-			->will( $this->returnValue( [] ) );
113
+		$this->stub->expects($this->once())->method('getServiceAttributes')
114
+			->will($this->returnValue([]));
115 115
 
116
-		$this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) );
116
+		$this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket));
117 117
 	}
118 118
 
119 119
 
120 120
 	public function testGetServicePrice()
121 121
 	{
122
-		$priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem();
123
-		$basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem();
122
+		$priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem();
123
+		$basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem();
124 124
 
125
-		$this->stub->expects( $this->once() )->method( 'getServicePrice' )
126
-			->will( $this->returnValue( $priceItem ) );
125
+		$this->stub->expects($this->once())->method('getServicePrice')
126
+			->will($this->returnValue($priceItem));
127 127
 
128
-		$this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) );
128
+		$this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket));
129 129
 	}
130 130
 
131 131
 
132 132
 	public function testCheckServiceAttributes()
133 133
 	{
134
-		$this->stub->expects( $this->once() )->method( 'checkServiceAttributes' )
135
-			->will( $this->returnValue( [] ) );
134
+		$this->stub->expects($this->once())->method('checkServiceAttributes')
135
+			->will($this->returnValue([]));
136 136
 
137
-		$this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) );
137
+		$this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, []));
138 138
 	}
139 139
 
140 140
 
141 141
 	public function testGetController()
142 142
 	{
143
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
143
+		$result = $this->access('getController')->invokeArgs($this->object, []);
144 144
 
145
-		$this->assertSame( $this->stub, $result );
145
+		$this->assertSame($this->stub, $result);
146 146
 	}
147 147
 
148 148
 
149
-	protected function access( $name )
149
+	protected function access($name)
150 150
 	{
151
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' );
152
-		$method = $class->getMethod( $name );
153
-		$method->setAccessible( true );
151
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base');
152
+		$method = $class->getMethod($name);
153
+		$method->setAccessible(true);
154 154
 
155 155
 		return $method;
156 156
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Service/StandardTest.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -16,59 +16,59 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Service\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Service\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	public static function setUpBeforeClass()
24 24
 	{
25
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
26
-		$orderBaseMgr = $orderManager->getSubManager( 'base' );
25
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
26
+		$orderBaseMgr = $orderManager->getSubManager('base');
27 27
 		self::$basket = $orderBaseMgr->createItem();
28 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		unset( $this->object );
33
+		unset($this->object);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testCheckAttributes()
38 38
 	{
39
-		$attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] );
40
-		$this->assertEquals( [], $attributes );
39
+		$attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []);
40
+		$this->assertEquals([], $attributes);
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetProviders()
45 45
 	{
46
-		$providers = $this->object->getProviders( 'delivery' );
47
-		$this->assertGreaterThan( 0, count( $providers ) );
46
+		$providers = $this->object->getProviders('delivery');
47
+		$this->assertGreaterThan(0, count($providers));
48 48
 
49
-		foreach( $providers as $provider ) {
50
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
49
+		foreach ($providers as $provider) {
50
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
51 51
 		}
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testGetProvider()
56 56
 	{
57
-		$provider = $this->object->getProvider( $this->getServiceItem()->getId() );
58
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
57
+		$provider = $this->object->getProvider($this->getServiceItem()->getId());
58
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testGetServices()
63 63
 	{
64
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
65
-		$basket = $orderManager->getSubManager( 'base' )->createItem();
64
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
65
+		$basket = $orderManager->getSubManager('base')->createItem();
66 66
 
67
-		$services = $this->object->getServices( 'delivery', $basket );
68
-		$this->assertGreaterThan( 0, count( $services ) );
67
+		$services = $this->object->getServices('delivery', $basket);
68
+		$this->assertGreaterThan(0, count($services));
69 69
 
70
-		foreach( $services as $service ) {
71
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service );
70
+		foreach ($services as $service) {
71
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service);
72 72
 		}
73 73
 	}
74 74
 
@@ -76,83 +76,83 @@  discard block
 block discarded – undo
76 76
 	public function testGetServiceAttributes()
77 77
 	{
78 78
 		$service = $this->getServiceItem();
79
-		$attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket );
79
+		$attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket);
80 80
 
81
-		$this->assertEquals( 0, count( $attributes ) );
81
+		$this->assertEquals(0, count($attributes));
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testGetServiceAttributesCache()
86 86
 	{
87
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
88
-		$basket = $orderManager->getSubManager( 'base' )->createItem();
87
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
88
+		$basket = $orderManager->getSubManager('base')->createItem();
89 89
 
90
-		$services = $this->object->getServices( 'delivery', $basket );
90
+		$services = $this->object->getServices('delivery', $basket);
91 91
 
92
-		if( ( $service = reset( $services ) ) === false ) {
93
-			throw new \RuntimeException( 'No service item found' );
92
+		if (($service = reset($services)) === false) {
93
+			throw new \RuntimeException('No service item found');
94 94
 		}
95 95
 
96
-		$attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket );
96
+		$attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket);
97 97
 
98
-		$this->assertEquals( 0, count( $attributes ) );
98
+		$this->assertEquals(0, count($attributes));
99 99
 	}
100 100
 
101 101
 
102 102
 	public function testGetServiceAttributesNoItems()
103 103
 	{
104
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
105
-		$this->object->getServiceAttributes( 'invalid', -1, self::$basket );
104
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
105
+		$this->object->getServiceAttributes('invalid', -1, self::$basket);
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testGetServicePrice()
110 110
 	{
111
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
112
-		$basket = $orderManager->getSubManager( 'base' )->createItem();
111
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
112
+		$basket = $orderManager->getSubManager('base')->createItem();
113 113
 
114 114
 		$service = $this->getServiceItem();
115
-		$price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket );
115
+		$price = $this->object->getServicePrice('delivery', $service->getId(), $basket);
116 116
 
117
-		$this->assertEquals( '12.95', $price->getValue() );
118
-		$this->assertEquals( '1.99', $price->getCosts() );
117
+		$this->assertEquals('12.95', $price->getValue());
118
+		$this->assertEquals('1.99', $price->getCosts());
119 119
 	}
120 120
 
121 121
 
122 122
 	public function testGetServicePriceCache()
123 123
 	{
124
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
125
-		$basket = $orderManager->getSubManager( 'base' )->createItem();
124
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
125
+		$basket = $orderManager->getSubManager('base')->createItem();
126 126
 
127
-		$services = $this->object->getServices( 'delivery', $basket );
127
+		$services = $this->object->getServices('delivery', $basket);
128 128
 
129
-		if( ( $service = reset( $services ) ) === false ) {
130
-			throw new \RuntimeException( 'No service item found' );
129
+		if (($service = reset($services)) === false) {
130
+			throw new \RuntimeException('No service item found');
131 131
 		}
132 132
 
133
-		$price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket );
133
+		$price = $this->object->getServicePrice('delivery', $service->getId(), $basket);
134 134
 
135
-		$this->assertEquals( '12.95', $price->getValue() );
136
-		$this->assertEquals( '1.99', $price->getCosts() );
135
+		$this->assertEquals('12.95', $price->getValue());
136
+		$this->assertEquals('1.99', $price->getCosts());
137 137
 	}
138 138
 
139 139
 
140 140
 	public function testGetServicePriceNoItems()
141 141
 	{
142
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
143
-		$basket = $orderManager->getSubManager( 'base' )->createItem();
142
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
143
+		$basket = $orderManager->getSubManager('base')->createItem();
144 144
 
145
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
146
-		$this->object->getServicePrice( 'invalid', -1, $basket );
145
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
146
+		$this->object->getServicePrice('invalid', -1, $basket);
147 147
 	}
148 148
 
149 149
 
150 150
 	public function testCheckServiceAttributes()
151 151
 	{
152 152
 		$service = $this->getServiceItem();
153
-		$attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), array() );
153
+		$attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), array());
154 154
 
155
-		$this->assertEquals( array(), $attributes );
155
+		$this->assertEquals(array(), $attributes);
156 156
 	}
157 157
 
158 158
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function getServiceItem()
163 163
 	{
164
-		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
165
-		return $manager->findItem( 'unitcode', [], 'service', 'delivery' );
164
+		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext());
165
+		return $manager->findItem('unitcode', [], 'service', 'delivery');
166 166
 	}
167 167
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Iface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
28 28
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
29 29
 	 */
30
-	public function checkAttributes( $serviceId, array $attributes );
30
+	public function checkAttributes($serviceId, array $attributes);
31 31
 
32 32
 	/**
33 33
 	 * Returns the service item for the given ID
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
37 37
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
38 38
 	 */
39
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] );
39
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text']);
40 40
 
41 41
 	/**
42 42
 	 * Returns the service providers for the given type
@@ -45,5 +45,5 @@  discard block
 block discarded – undo
45 45
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
46 46
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
47 47
 	 */
48
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] );
48
+	public function getProviders($type = null, $ref = ['media', 'price', 'text']);
49 49
 }
Please login to merge, or discard this patch.