Completed
Push — master ( 1f41d8...f9fc52 )
by Aimeos
01:49
created
controller/frontend/tests/Controller/Frontend/Catalog/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Catalog\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
28
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
28
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Catalog\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Catalog\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Attribute/Decorator/BaseTest.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,117 +20,117 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\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\MW\Common\Exception' );
43
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\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\Attribute\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Attribute\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 testAddFilterTypes()
69 69
 	{
70
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
70
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'addFilterTypes' )
73
-			->will( $this->returnArgument( 0 ) );
72
+		$this->stub->expects($this->once())->method('addFilterTypes')
73
+			->will($this->returnArgument(0));
74 74
 
75
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterTypes( $search, [] ) );
75
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterTypes($search, []));
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testCreateFilter()
80 80
 	{
81
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
81
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
82 82
 
83
-		$this->stub->expects( $this->once() )->method( 'createFilter' )
84
-			->will( $this->returnValue( $search ) );
83
+		$this->stub->expects($this->once())->method('createFilter')
84
+			->will($this->returnValue($search));
85 85
 
86
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
86
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testGetItem()
91 91
 	{
92
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createItem();
92
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createItem();
93 93
 
94
-		$this->stub->expects( $this->once() )->method( 'getItem' )
95
-			->will( $this->returnValue( $item ) );
94
+		$this->stub->expects($this->once())->method('getItem')
95
+			->will($this->returnValue($item));
96 96
 
97
-		$this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $this->object->getItem( -1 ) );
97
+		$this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $this->object->getItem( -1 ));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testGetItems()
102 102
 	{
103
-		$this->stub->expects( $this->once() )->method( 'getItems' )
104
-			->will( $this->returnValue( [] ) );
103
+		$this->stub->expects($this->once())->method('getItems')
104
+			->will($this->returnValue([]));
105 105
 
106
-		$this->assertEquals( [], $this->object->getItems( [-1], ['media'] ) );
106
+		$this->assertEquals([], $this->object->getItems([-1], ['media']));
107 107
 	}
108 108
 
109 109
 
110 110
 	public function testSearchItems()
111 111
 	{
112
-		$filter = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' )->createSearch();
112
+		$filter = \Aimeos\MShop\Factory::createManager($this->context, 'attribute')->createSearch();
113 113
 
114
-		$this->stub->expects( $this->once() )->method( 'searchItems' )
115
-			->will( $this->returnValue( [] ) );
114
+		$this->stub->expects($this->once())->method('searchItems')
115
+			->will($this->returnValue([]));
116 116
 
117
-		$this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) );
117
+		$this->assertEquals([], $this->object->searchItems($filter, ['media']));
118 118
 	}
119 119
 
120 120
 
121 121
 	public function testGetController()
122 122
 	{
123
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
123
+		$result = $this->access('getController')->invokeArgs($this->object, []);
124 124
 
125
-		$this->assertSame( $this->stub, $result );
125
+		$this->assertSame($this->stub, $result);
126 126
 	}
127 127
 
128 128
 
129
-	protected function access( $name )
129
+	protected function access($name)
130 130
 	{
131
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Attribute\Decorator\Base' );
132
-		$method = $class->getMethod( $name );
133
-		$method->setAccessible( true );
131
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Attribute\Decorator\Base');
132
+		$method = $class->getMethod($name);
133
+		$method->setAccessible(true);
134 134
 
135 135
 		return $method;
136 136
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Attribute/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\\Attribute\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Attribute\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\\MW\\Common\\Exception' );
29
-		\Aimeos\Controller\Frontend\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
29
+		\Aimeos\Controller\Frontend\Attribute\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\Attribute\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Attribute\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\Attribute\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Attribute\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/Decorator/BaseTest.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,54 +20,54 @@  discard block
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\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\MW\Common\Exception' );
43
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\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\Basket\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Basket\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 testClear()
69 69
 	{
70
-		$this->stub->expects( $this->once() )->method( 'clear' );
70
+		$this->stub->expects($this->once())->method('clear');
71 71
 
72 72
 		$this->object->clear();
73 73
 	}
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 	public function testGet()
77 77
 	{
78 78
 		$context = \TestHelperFrontend::getContext();
79
-		$order = \Aimeos\MShop\Factory::createManager( $context, 'order/base' )->createItem();
79
+		$order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem();
80 80
 
81
-		$this->stub->expects( $this->once() )->method( 'get' )
82
-			->will( $this->returnValue( $order ) );
81
+		$this->stub->expects($this->once())->method('get')
82
+			->will($this->returnValue($order));
83 83
 
84
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() );
84
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get());
85 85
 	}
86 86
 
87 87
 
88 88
 	public function testSave()
89 89
 	{
90
-		$this->stub->expects( $this->once() )->method( 'save' );
90
+		$this->stub->expects($this->once())->method('save');
91 91
 
92 92
 		$this->object->save();
93 93
 	}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 
96 96
 	public function testSetType()
97 97
 	{
98
-		$this->stub->expects( $this->once() )->method( 'setType' );
98
+		$this->stub->expects($this->once())->method('setType');
99 99
 
100
-		$this->object->setType( 'test' );
100
+		$this->object->setType('test');
101 101
 	}
102 102
 
103 103
 
104 104
 	public function testStore()
105 105
 	{
106
-		$this->stub->expects( $this->once() )->method( 'store' );
106
+		$this->stub->expects($this->once())->method('store');
107 107
 
108 108
 		$this->object->store();
109 109
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 	public function testLoad()
113 113
 	{
114
-		$this->stub->expects( $this->once() )->method( 'load' );
114
+		$this->stub->expects($this->once())->method('load');
115 115
 
116 116
 		$this->object->load( -1 );
117 117
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	public function testAddProduct()
121 121
 	{
122
-		$this->stub->expects( $this->once() )->method( 'addProduct' );
122
+		$this->stub->expects($this->once())->method('addProduct');
123 123
 
124 124
 		$this->object->addProduct( -1 );
125 125
 	}
@@ -127,73 +127,73 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function testDeleteProduct()
129 129
 	{
130
-		$this->stub->expects( $this->once() )->method( 'deleteProduct' );
130
+		$this->stub->expects($this->once())->method('deleteProduct');
131 131
 
132
-		$this->object->deleteProduct( 0 );
132
+		$this->object->deleteProduct(0);
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testEditProduct()
137 137
 	{
138
-		$this->stub->expects( $this->once() )->method( 'editProduct' );
138
+		$this->stub->expects($this->once())->method('editProduct');
139 139
 
140
-		$this->object->editProduct( 0, 1 );
140
+		$this->object->editProduct(0, 1);
141 141
 	}
142 142
 
143 143
 
144 144
 	public function testAddCoupon()
145 145
 	{
146
-		$this->stub->expects( $this->once() )->method( 'addCoupon' );
146
+		$this->stub->expects($this->once())->method('addCoupon');
147 147
 
148
-		$this->object->addCoupon( 'test' );
148
+		$this->object->addCoupon('test');
149 149
 	}
150 150
 
151 151
 
152 152
 	public function testDeleteCoupon()
153 153
 	{
154
-		$this->stub->expects( $this->once() )->method( 'deleteCoupon' );
154
+		$this->stub->expects($this->once())->method('deleteCoupon');
155 155
 
156
-		$this->object->deleteCoupon( 'test' );
156
+		$this->object->deleteCoupon('test');
157 157
 	}
158 158
 
159 159
 
160 160
 	public function testSetAddress()
161 161
 	{
162
-		$this->stub->expects( $this->once() )->method( 'setAddress' );
162
+		$this->stub->expects($this->once())->method('setAddress');
163 163
 
164
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
164
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
165 165
 	}
166 166
 
167 167
 
168 168
 	public function testAddService()
169 169
 	{
170
-		$this->stub->expects( $this->once() )->method( 'addService' );
170
+		$this->stub->expects($this->once())->method('addService');
171 171
 
172
-		$this->object->addService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1 );
172
+		$this->object->addService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, -1);
173 173
 	}
174 174
 
175 175
 
176 176
 	public function testDeleteService()
177 177
 	{
178
-		$this->stub->expects( $this->once() )->method( 'deleteService' );
178
+		$this->stub->expects($this->once())->method('deleteService');
179 179
 
180
-		$this->object->deleteService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT );
180
+		$this->object->deleteService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT);
181 181
 	}
182 182
 
183 183
 
184 184
 	public function testGetController()
185 185
 	{
186
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
186
+		$result = $this->access('getController')->invokeArgs($this->object, []);
187 187
 
188
-		$this->assertSame( $this->stub, $result );
188
+		$this->assertSame($this->stub, $result);
189 189
 	}
190 190
 
191 191
 
192
-	protected function access( $name )
192
+	protected function access($name)
193 193
 	{
194
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Basket\Decorator\Base' );
195
-		$method = $class->getMethod( $name );
196
-		$method->setAccessible( true );
194
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Basket\Decorator\Base');
195
+		$method = $class->getMethod($name);
196
+		$method->setAccessible(true);
197 197
 
198 198
 		return $method;
199 199
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
 	{
15 15
 		$target = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface';
16 16
 
17
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext() );
18
-		$this->assertInstanceOf( $target, $controller );
17
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext());
18
+		$this->assertInstanceOf($target, $controller);
19 19
 
20
-		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
21
-		$this->assertInstanceOf( $target, $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
21
+		$this->assertInstanceOf($target, $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerInvalidImplementation()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' );
28
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
27
+		$this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
28
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Basket\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Basket\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 }
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,13 +27,13 @@  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 );
33
-		$item->setDateEnd( $item->getDateNext() );
34
-		$item->setReason( \Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL );
32
+		$item = $this->getItem($id);
33
+		$item->setDateEnd($item->getDateNext());
34
+		$item->setReason(\Aimeos\MShop\Subscription\Item\Iface::REASON_CANCEL);
35 35
 
36
-		return $this->saveItem( $item );
36
+		return $this->saveItem($item);
37 37
 	}
38 38
 
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function createFilter()
46 46
 	{
47
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch();
47
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch();
48 48
 	}
49 49
 
50 50
 
@@ -54,25 +54,25 @@  discard block
 block discarded – undo
54 54
 	 * @param string $id Unique subscription ID
55 55
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
56 56
 	 */
57
-	public function getItem( $id )
57
+	public function getItem($id)
58 58
 	{
59 59
 		$context = $this->getContext();
60
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
60
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
61 61
 
62 62
 		$filter = $manager->createSearch();
63 63
 		$expr = [
64
-			$filter->compare( '==', 'subscription.id', $id ),
65
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
64
+			$filter->compare('==', 'subscription.id', $id),
65
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
66 66
 			$filter->getConditions(),
67 67
 		];
68
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
68
+		$filter->setConditions($filter->combine('&&', $expr));
69 69
 
70
-		$items = $this->searchItems( $filter );
70
+		$items = $this->searchItems($filter);
71 71
 
72
-		if( ( $item = reset( $items ) ) === false )
72
+		if (($item = reset($items)) === false)
73 73
 		{
74 74
 			$msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"';
75
-			throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) );
75
+			throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId()));
76 76
 		}
77 77
 
78 78
 		return $item;
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	public function getIntervals()
88 88
 	{
89 89
 		$intervals = [];
90
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
90
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
91 91
 
92
-		$search = $manager->createSearch( true );
92
+		$search = $manager->createSearch(true);
93 93
 		$expr = array(
94 94
 			$search->getConditions(),
95
-			$search->compare( '==', 'attribute.domain', 'product' ),
96
-			$search->compare( '==', 'attribute.type.code', 'interval' ),
95
+			$search->compare('==', 'attribute.domain', 'product'),
96
+			$search->compare('==', 'attribute.type.code', 'interval'),
97 97
 		);
98
-		$search->setConditions( $search->combine( '&&', $expr ) );
99
-		$search->setSlice( 0, 0x7fffffff );
98
+		$search->setConditions($search->combine('&&', $expr));
99
+		$search->setSlice(0, 0x7fffffff);
100 100
 
101
-		foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) {
101
+		foreach ($manager->searchItems($search, ['text']) as $attrItem) {
102 102
 			$intervals[$attrItem->getCode()] = $attrItem;
103 103
 		}
104 104
 
@@ -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 \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item );
116
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item);
117 117
 	}
118 118
 
119 119
 
@@ -124,17 +124,17 @@  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 129
 		$context = $this->getContext();
130
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
130
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
131 131
 
132 132
 		$expr = [
133
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
133
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
134 134
 			$filter->getConditions(),
135 135
 		];
136
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
136
+		$filter->setConditions($filter->combine('&&', $expr));
137 137
 
138
-		return $manager->searchItems( $filter, [], $total );
138
+		return $manager->searchItems($filter, [], $total);
139 139
 	}
140 140
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Base.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -31,52 +31,52 @@  discard block
 block discarded – undo
31 31
 	 * @param integer $quantity New product quantity
32 32
 	 * @return \Aimeos\MShop\Price\Item\Iface Price item with calculated price
33 33
 	 */
34
-	protected function calcPrice( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity )
34
+	protected function calcPrice(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity)
35 35
 	{
36 36
 		$context = $this->getContext();
37 37
 
38
-		if( empty( $prices ) )
38
+		if (empty($prices))
39 39
 		{
40
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
41
-			$prices = $manager->getItem( $product->getProductId(), array( 'price' ) )->getRefItems( 'price', 'default' );
40
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
41
+			$prices = $manager->getItem($product->getProductId(), array('price'))->getRefItems('price', 'default');
42 42
 		}
43 43
 
44 44
 
45
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
46
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
45
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
46
+		$price = $priceManager->getLowestPrice($prices, $quantity);
47 47
 
48 48
 		// customers can pay what they would like to pay
49
-		if( ( $attr = $product->getAttributeItem( 'price', 'custom' ) ) !== null )
49
+		if (($attr = $product->getAttributeItem('price', 'custom')) !== null)
50 50
 		{
51 51
 			$amount = $attr->getValue();
52 52
 
53
-			if( preg_match( '/^[0-9]*(\.[0-9]+)?$/', $amount ) !== 1 || ((double) $amount) < 0.01 )
53
+			if (preg_match('/^[0-9]*(\.[0-9]+)?$/', $amount) !== 1 || ((double) $amount) < 0.01)
54 54
 			{
55
-				$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid price value "%1$s"' );
56
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $amount ) );
55
+				$msg = $context->getI18n()->dt('controller/frontend', 'Invalid price value "%1$s"');
56
+				throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $amount));
57 57
 			}
58 58
 
59
-			$price->setValue( $amount );
59
+			$price->setValue($amount);
60 60
 		}
61 61
 
62 62
 		$orderAttributes = $product->getAttributes();
63
-		$attrItems = $this->getAttributeItems( $orderAttributes );
63
+		$attrItems = $this->getAttributeItems($orderAttributes);
64 64
 
65 65
 		// add prices of (optional) attributes
66
-		foreach( $orderAttributes as $orderAttrItem )
66
+		foreach ($orderAttributes as $orderAttrItem)
67 67
 		{
68 68
 			$attrId = $orderAttrItem->getAttributeId();
69 69
 
70
-			if( isset( $attrItems[$attrId] )
71
-				&& ( $prices = $attrItems[$attrId]->getRefItems( 'price', 'default' ) ) !== []
70
+			if (isset($attrItems[$attrId])
71
+				&& ($prices = $attrItems[$attrId]->getRefItems('price', 'default')) !== []
72 72
 			) {
73
-				$attrPrice = $priceManager->getLowestPrice( $prices, $orderAttrItem->getQuantity() );
74
-				$price->addItem( $attrPrice, $orderAttrItem->getQuantity() );
73
+				$attrPrice = $priceManager->getLowestPrice($prices, $orderAttrItem->getQuantity());
74
+				$price->addItem($attrPrice, $orderAttrItem->getQuantity());
75 75
 			}
76 76
 		}
77 77
 
78 78
 		// remove product rebate of original price in favor to rebates granted for the order
79
-		$price->setRebate( '0.00' );
79
+		$price->setRebate('0.00');
80 80
 
81 81
 		return $price;
82 82
 	}
@@ -90,43 +90,43 @@  discard block
 block discarded – undo
90 90
 	 * @param array $refMap Associative list of list type codes as keys and lists of reference IDs as values
91 91
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated
92 92
 	 */
93
-	protected function checkListRef( $prodId, $domain, array $refMap )
93
+	protected function checkListRef($prodId, $domain, array $refMap)
94 94
 	{
95
-		if( empty( $refMap ) ) {
95
+		if (empty($refMap)) {
96 96
 			return;
97 97
 		}
98 98
 
99 99
 		$context = $this->getContext();
100
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
101
-		$search = $productManager->createSearch( true );
100
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
101
+		$search = $productManager->createSearch(true);
102 102
 
103 103
 		$expr = array(
104
-			$search->compare( '==', 'product.id', $prodId ),
104
+			$search->compare('==', 'product.id', $prodId),
105 105
 			$search->getConditions(),
106 106
 		);
107 107
 
108
-		foreach( $refMap as $listType => $refIds )
108
+		foreach ($refMap as $listType => $refIds)
109 109
 		{
110
-			if( empty( $refIds ) ) {
110
+			if (empty($refIds)) {
111 111
 				continue;
112 112
 			}
113 113
 
114
-			foreach( $refIds as $key => $refId ) {
114
+			foreach ($refIds as $key => $refId) {
115 115
 				$refIds[$key] = (string) $refId;
116 116
 			}
117 117
 
118
-			$param = array( $domain, $this->getProductListTypeItem( $domain, $listType )->getId(), $refIds );
119
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
118
+			$param = array($domain, $this->getProductListTypeItem($domain, $listType)->getId(), $refIds);
119
+			$cmpfunc = $search->createFunction('product.contains', $param);
120 120
 
121
-			$expr[] = $search->compare( '==', $cmpfunc, count( $refIds ) );
121
+			$expr[] = $search->compare('==', $cmpfunc, count($refIds));
122 122
 		}
123 123
 
124
-		$search->setConditions( $search->combine( '&&', $expr ) );
124
+		$search->setConditions($search->combine('&&', $expr));
125 125
 
126
-		if( count( $productManager->searchItems( $search, [] ) ) === 0 )
126
+		if (count($productManager->searchItems($search, [])) === 0)
127 127
 		{
128
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' );
129
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) );
128
+			$msg = $context->getI18n()->dt('controller/frontend', 'Invalid "%1$s" references for product with ID %2$s');
129
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, json_encode($prodId)));
130 130
 		}
131 131
 	}
132 132
 
@@ -137,40 +137,40 @@  discard block
 block discarded – undo
137 137
 	 * @param \Aimeos\MShop\Locale\Item\Iface $locale Locale object from current basket
138 138
 	 * @param string $type Basket type
139 139
 	 */
140
-	protected function checkLocale( \Aimeos\MShop\Locale\Item\Iface $locale, $type )
140
+	protected function checkLocale(\Aimeos\MShop\Locale\Item\Iface $locale, $type)
141 141
 	{
142 142
 		$errors = [];
143 143
 		$context = $this->getContext();
144 144
 		$session = $context->getSession();
145 145
 
146
-		$localeStr = $session->get( 'aimeos/basket/locale' );
146
+		$localeStr = $session->get('aimeos/basket/locale');
147 147
 		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();
148 148
 
149
-		if( $localeStr !== null && $localeStr !== $localeKey )
149
+		if ($localeStr !== null && $localeStr !== $localeKey)
150 150
 		{
151
-			$locParts = explode( '|', $localeStr );
152
-			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
153
-			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
154
-			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );
151
+			$locParts = explode('|', $localeStr);
152
+			$locSite = (isset($locParts[0]) ? $locParts[0] : '');
153
+			$locLanguage = (isset($locParts[1]) ? $locParts[1] : '');
154
+			$locCurrency = (isset($locParts[2]) ? $locParts[2] : '');
155 155
 
156
-			$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
157
-			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );
156
+			$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
157
+			$locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false);
158 158
 
159 159
 			$context = clone $context;
160
-			$context->setLocale( $locale );
160
+			$context->setLocale($locale);
161 161
 
162
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
163
-			$basket = $manager->getSession( $type );
162
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
163
+			$basket = $manager->getSession($type);
164 164
 
165
-			$this->copyAddresses( $basket, $errors, $localeKey );
166
-			$this->copyServices( $basket, $errors );
167
-			$this->copyProducts( $basket, $errors, $localeKey );
168
-			$this->copyCoupons( $basket, $errors, $localeKey );
165
+			$this->copyAddresses($basket, $errors, $localeKey);
166
+			$this->copyServices($basket, $errors);
167
+			$this->copyProducts($basket, $errors, $localeKey);
168
+			$this->copyCoupons($basket, $errors, $localeKey);
169 169
 
170
-			$manager->setSession( $basket, $type );
170
+			$manager->setSession($basket, $type);
171 171
 		}
172 172
 
173
-		$session->set( 'aimeos/basket/locale', $localeKey );
173
+		$session->set('aimeos/basket/locale', $localeKey);
174 174
 	}
175 175
 
176 176
 
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 	 * @param string $localeKey Unique identifier of the site, language and currency
183 183
 	 * @return array Associative list of errors occured
184 184
 	 */
185
-	protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
185
+	protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
186 186
 	{
187
-		foreach( $basket->getAddresses() as $type => $item )
187
+		foreach ($basket->getAddresses() as $type => $item)
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->setAddress( $type, $item->toArray() );
192
-				$basket->deleteAddress( $type );
191
+				$this->setAddress($type, $item->toArray());
192
+				$basket->deleteAddress($type);
193 193
 			}
194
-			catch( \Exception $e )
194
+			catch (\Exception $e)
195 195
 			{
196 196
 				$logger = $this->getContext()->getLogger();
197 197
 				$errors['address'][$type] = $e->getMessage();
198 198
 
199 199
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
200
-				$logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
200
+				$logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
201 201
 			}
202 202
 		}
203 203
 
@@ -213,22 +213,22 @@  discard block
 block discarded – undo
213 213
 	 * @param string $localeKey Unique identifier of the site, language and currency
214 214
 	 * @return array Associative list of errors occured
215 215
 	 */
216
-	protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
216
+	protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
217 217
 	{
218
-		foreach( $basket->getCoupons() as $code => $list )
218
+		foreach ($basket->getCoupons() as $code => $list)
219 219
 		{
220 220
 			try
221 221
 			{
222
-				$this->addCoupon( $code );
223
-				$basket->deleteCoupon( $code, true );
222
+				$this->addCoupon($code);
223
+				$basket->deleteCoupon($code, true);
224 224
 			}
225
-			catch( \Exception $e )
225
+			catch (\Exception $e)
226 226
 			{
227 227
 				$logger = $this->getContext()->getLogger();
228 228
 				$errors['coupon'][$code] = $e->getMessage();
229 229
 
230 230
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
231
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
231
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
232 232
 			}
233 233
 		}
234 234
 
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 * @param string $localeKey Unique identifier of the site, language and currency
245 245
 	 * @return array Associative list of errors occured
246 246
 	 */
247
-	protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
247
+	protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
248 248
 	{
249
-		foreach( $basket->getProducts() as $pos => $product )
249
+		foreach ($basket->getProducts() as $pos => $product)
250 250
 		{
251
-			if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) {
251
+			if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) {
252 252
 				continue;
253 253
 			}
254 254
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			{
257 257
 				$variantIds = $configIds = $customIds = [];
258 258
 
259
-				foreach( $product->getAttributeItems() as $attrItem )
259
+				foreach ($product->getAttributeItems() as $attrItem)
260 260
 				{
261
-					switch( $attrItem->getType() )
261
+					switch ($attrItem->getType())
262 262
 					{
263 263
 						case 'variant': $variantIds[] = $attrItem->getAttributeId(); break;
264 264
 						case 'config': $configIds[$attrItem->getAttributeId()] = $attrItem->getQuantity(); break;
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
 					$variantIds, $configIds, [], $customIds
272 272
 				);
273 273
 
274
-				$basket->deleteProduct( $pos );
274
+				$basket->deleteProduct($pos);
275 275
 			}
276
-			catch( \Exception $e )
276
+			catch (\Exception $e)
277 277
 			{
278 278
 				$code = $product->getProductCode();
279 279
 				$logger = $this->getContext()->getLogger();
280 280
 				$errors['product'][$pos] = $e->getMessage();
281 281
 
282 282
 				$str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s';
283
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
283
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
284 284
 			}
285 285
 		}
286 286
 
@@ -295,24 +295,24 @@  discard block
 block discarded – undo
295 295
 	 * @param array $errors Associative list of previous errors
296 296
 	 * @return array Associative list of errors occured
297 297
 	 */
298
-	protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors )
298
+	protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors)
299 299
 	{
300
-		foreach( $basket->getServices() as $type => $list )
300
+		foreach ($basket->getServices() as $type => $list)
301 301
 		{
302
-			foreach( $list as $item )
302
+			foreach ($list as $item)
303 303
 			{
304 304
 				try
305 305
 				{
306 306
 					$attributes = [];
307 307
 
308
-					foreach( $item->getAttributes() as $attrItem ) {
308
+					foreach ($item->getAttributes() as $attrItem) {
309 309
 						$attributes[$attrItem->getCode()] = $attrItem->getValue();
310 310
 					}
311 311
 
312
-					$this->addService( $type, $item->getServiceId(), $attributes );
313
-					$basket->deleteService( $type );
312
+					$this->addService($type, $item->getServiceId(), $attributes);
313
+					$basket->deleteService($type);
314 314
 				}
315
-				catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
315
+				catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically
316 316
 			}
317 317
 		}
318 318
 
@@ -325,28 +325,28 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
327 327
 	 */
328
-	protected function createSubscriptions( \Aimeos\MShop\Order\Item\Base\Iface $basket )
328
+	protected function createSubscriptions(\Aimeos\MShop\Order\Item\Base\Iface $basket)
329 329
 	{
330
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' );
330
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription');
331 331
 
332
-		foreach( $basket->getProducts() as $orderProduct )
332
+		foreach ($basket->getProducts() as $orderProduct)
333 333
 		{
334
-			if( ( $interval = $orderProduct->getAttribute( 'interval', 'config' ) ) !== null )
334
+			if (($interval = $orderProduct->getAttribute('interval', 'config')) !== null)
335 335
 			{
336 336
 				$item = $manager->createItem();
337
-				$item->setOrderBaseId( $basket->getId() );
338
-				$item->setOrderProductId( $orderProduct->getId() );
339
-				$item->setInterval( $interval );
340
-				$item->setStatus( 1 );
341
-
342
-				if( ( $end = $orderProduct->getAttribute( 'intervalend', 'custom' ) ) !== null
343
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'config' ) ) !== null
344
-					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'hidden' ) ) !== null
337
+				$item->setOrderBaseId($basket->getId());
338
+				$item->setOrderProductId($orderProduct->getId());
339
+				$item->setInterval($interval);
340
+				$item->setStatus(1);
341
+
342
+				if (($end = $orderProduct->getAttribute('intervalend', 'custom')) !== null
343
+					|| ($end = $orderProduct->getAttribute('intervalend', 'config')) !== null
344
+					|| ($end = $orderProduct->getAttribute('intervalend', 'hidden')) !== null
345 345
 				) {
346
-					$item->setDateEnd( $end );
346
+					$item->setDateEnd($end);
347 347
 				}
348 348
 
349
-				$manager->saveItem( $item, false );
349
+				$manager->saveItem($item, false);
350 350
 			}
351 351
 		}
352 352
 	}
@@ -360,32 +360,32 @@  discard block
 block discarded – undo
360 360
 	 * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface
361 361
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one
362 362
 	 */
363
-	protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) )
363
+	protected function getAttributes(array $attributeIds, array $domains = array('price', 'text'))
364 364
 	{
365
-		if( empty( $attributeIds ) ) {
365
+		if (empty($attributeIds)) {
366 366
 			return [];
367 367
 		}
368 368
 
369
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
369
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
370 370
 
371
-		$search = $attributeManager->createSearch( true );
371
+		$search = $attributeManager->createSearch(true);
372 372
 		$expr = array(
373
-			$search->compare( '==', 'attribute.id', $attributeIds ),
373
+			$search->compare('==', 'attribute.id', $attributeIds),
374 374
 			$search->getConditions(),
375 375
 		);
376
-		$search->setConditions( $search->combine( '&&', $expr ) );
377
-		$search->setSlice( 0, 0x7fffffff );
376
+		$search->setConditions($search->combine('&&', $expr));
377
+		$search->setSlice(0, 0x7fffffff);
378 378
 
379
-		$attrItems = $attributeManager->searchItems( $search, $domains );
379
+		$attrItems = $attributeManager->searchItems($search, $domains);
380 380
 
381
-		if( count( $attrItems ) !== count( $attributeIds ) )
381
+		if (count($attrItems) !== count($attributeIds))
382 382
 		{
383 383
 			$i18n = $this->getContext()->getI18n();
384
-			$expected = implode( ',', $attributeIds );
385
-			$actual = implode( ',', array_keys( $attrItems ) );
386
-			$msg = $i18n->dt( 'controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"' );
384
+			$expected = implode(',', $attributeIds);
385
+			$actual = implode(',', array_keys($attrItems));
386
+			$msg = $i18n->dt('controller/frontend', 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"');
387 387
 
388
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $actual, $expected ) );
388
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $actual, $expected));
389 389
 		}
390 390
 
391 391
 		return $attrItems;
@@ -398,31 +398,31 @@  discard block
 block discarded – undo
398 398
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items
399 399
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values
400 400
 	 */
401
-	protected function getAttributeItems( array $orderAttributes )
401
+	protected function getAttributeItems(array $orderAttributes)
402 402
 	{
403
-		if( empty( $orderAttributes ) ) {
403
+		if (empty($orderAttributes)) {
404 404
 			return [];
405 405
 		}
406 406
 
407
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
408
-		$search = $attributeManager->createSearch( true );
407
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
408
+		$search = $attributeManager->createSearch(true);
409 409
 		$expr = [];
410 410
 
411
-		foreach( $orderAttributes as $item )
411
+		foreach ($orderAttributes as $item)
412 412
 		{
413 413
 			$tmp = array(
414
-				$search->compare( '==', 'attribute.domain', 'product' ),
415
-				$search->compare( '==', 'attribute.code', $item->getValue() ),
416
-				$search->compare( '==', 'attribute.type.domain', 'product' ),
417
-				$search->compare( '==', 'attribute.type.code', $item->getCode() ),
418
-				$search->compare( '>', 'attribute.type.status', 0 ),
414
+				$search->compare('==', 'attribute.domain', 'product'),
415
+				$search->compare('==', 'attribute.code', $item->getValue()),
416
+				$search->compare('==', 'attribute.type.domain', 'product'),
417
+				$search->compare('==', 'attribute.type.code', $item->getCode()),
418
+				$search->compare('>', 'attribute.type.status', 0),
419 419
 				$search->getConditions(),
420 420
 			);
421
-			$expr[] = $search->combine( '&&', $tmp );
421
+			$expr[] = $search->combine('&&', $tmp);
422 422
 		}
423 423
 
424
-		$search->setConditions( $search->combine( '||', $expr ) );
425
-		return $attributeManager->searchItems( $search, array( 'price' ) );
424
+		$search->setConditions($search->combine('||', $expr));
425
+		return $attributeManager->searchItems($search, array('price'));
426 426
 	}
427 427
 
428 428
 
@@ -435,24 +435,24 @@  discard block
 block discarded – undo
435 435
 	 * @param array $quantities Associative list of attribute IDs as keys and their quantities as values
436 436
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
437 437
 	 */
438
-	protected function getOrderProductAttributes( $type, array $ids, array $values = [], array $quantities = [] )
438
+	protected function getOrderProductAttributes($type, array $ids, array $values = [], array $quantities = [])
439 439
 	{
440
-		if( empty( $ids ) ) {
440
+		if (empty($ids)) {
441 441
 			return [];
442 442
 		}
443 443
 
444 444
 		$list = [];
445
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
445
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
446 446
 
447
-		foreach( $this->getAttributes( $ids ) as $id => $attrItem )
447
+		foreach ($this->getAttributes($ids) as $id => $attrItem)
448 448
 		{
449 449
 			$item = $manager->createItem();
450
-			$item->copyFrom( $attrItem );
451
-			$item->setType( $type );
452
-			$item->setQuantity( isset( $quantities[$id] ) ? $quantities[$id] : 1 );
450
+			$item->copyFrom($attrItem);
451
+			$item->setType($type);
452
+			$item->setQuantity(isset($quantities[$id]) ? $quantities[$id] : 1);
453 453
 
454
-			if( isset( $values[$id] ) ) {
455
-				$item->setValue( $values[$id] );
454
+			if (isset($values[$id])) {
455
+				$item->setValue($values[$id]);
456 456
 			}
457 457
 
458 458
 			$list[] = $item;
@@ -469,23 +469,23 @@  discard block
 block discarded – undo
469 469
 	 * @param string $code Code of the list type
470 470
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface List type item
471 471
 	 */
472
-	protected function getProductListTypeItem( $domain, $code )
472
+	protected function getProductListTypeItem($domain, $code)
473 473
 	{
474 474
 		$context = $this->getContext();
475 475
 
476
-		if( empty( $this->listTypeItems ) )
476
+		if (empty($this->listTypeItems))
477 477
 		{
478
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' );
478
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
479 479
 
480
-			foreach( $manager->searchItems( $manager->createSearch( true ) ) as $item ) {
481
-				$this->listTypeItems[ $item->getDomain() ][ $item->getCode() ] = $item;
480
+			foreach ($manager->searchItems($manager->createSearch(true)) as $item) {
481
+				$this->listTypeItems[$item->getDomain()][$item->getCode()] = $item;
482 482
 			}
483 483
 		}
484 484
 
485
-		if( !isset( $this->listTypeItems[$domain][$code] ) )
485
+		if (!isset($this->listTypeItems[$domain][$code]))
486 486
 		{
487
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found' );
488
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, $code ) );
487
+			$msg = $context->getI18n()->dt('controller/frontend', 'List type for domain "%1$s" and code "%2$s" not found');
488
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $domain, $code));
489 489
 		}
490 490
 
491 491
 		return $this->listTypeItems[$domain][$code];
@@ -500,43 +500,43 @@  discard block
 block discarded – undo
500 500
 	 * @param array $domains Names of the domain items that should be fetched too
501 501
 	 * @return array List of products matching the given attributes
502 502
 	 */
503
-	protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
504
-			array $domains = array( 'attribute', 'media', 'price', 'text' ) )
503
+	protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
504
+			array $domains = array('attribute', 'media', 'price', 'text'))
505 505
 	{
506 506
 		$subProductIds = [];
507
-		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
507
+		foreach ($productItem->getRefItems('product', 'default', 'default') as $item) {
508 508
 			$subProductIds[] = $item->getId();
509 509
 		}
510 510
 
511
-		if( count( $subProductIds ) === 0 ) {
511
+		if (count($subProductIds) === 0) {
512 512
 			return [];
513 513
 		}
514 514
 
515
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
516
-		$search = $productManager->createSearch( true );
515
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
516
+		$search = $productManager->createSearch(true);
517 517
 
518 518
 		$expr = array(
519
-			$search->compare( '==', 'product.id', $subProductIds ),
519
+			$search->compare('==', 'product.id', $subProductIds),
520 520
 			$search->getConditions(),
521 521
 		);
522 522
 
523
-		if( count( $variantAttributeIds ) > 0 )
523
+		if (count($variantAttributeIds) > 0)
524 524
 		{
525
-			foreach( $variantAttributeIds as $key => $id ) {
525
+			foreach ($variantAttributeIds as $key => $id) {
526 526
 				$variantAttributeIds[$key] = (string) $id;
527 527
 			}
528 528
 
529
-			$listTypeItem = $this->getProductListTypeItem( 'attribute', 'variant' );
529
+			$listTypeItem = $this->getProductListTypeItem('attribute', 'variant');
530 530
 
531
-			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
532
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
531
+			$param = array('attribute', $listTypeItem->getId(), $variantAttributeIds);
532
+			$cmpfunc = $search->createFunction('product.contains', $param);
533 533
 
534
-			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
534
+			$expr[] = $search->compare('==', $cmpfunc, count($variantAttributeIds));
535 535
 		}
536 536
 
537
-		$search->setConditions( $search->combine( '&&', $expr ) );
537
+		$search->setConditions($search->combine('&&', $expr));
538 538
 
539
-		return $productManager->searchItems( $search, $domains );
539
+		return $productManager->searchItems($search, $domains);
540 540
 	}
541 541
 
542 542
 
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @param mixed $default Default value if no value is available for the given name
549 549
 	 * @return mixed Value from the array or default value
550 550
 	 */
551
-	protected function getValue( array $values, $name, $default = null )
551
+	protected function getValue(array $values, $name, $default = null)
552 552
 	{
553
-		if( isset( $values[$name] ) ) {
553
+		if (isset($values[$name])) {
554 554
 			return $values[$name];
555 555
 		}
556 556
 
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Supplier/StandardTest.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard(\TestHelperFrontend::getContext());
20 20
 	}
21 21
 
22 22
 
23 23
 	protected function tearDown()
24 24
 	{
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
@@ -30,34 +30,34 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32 32
 
33
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
34
-		$this->assertEquals( 0, $filter->getSliceStart() );
35
-		$this->assertEquals( 100, $filter->getSliceSize() );
33
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
34
+		$this->assertEquals(0, $filter->getSliceStart());
35
+		$this->assertEquals(100, $filter->getSliceSize());
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetItem()
40 40
 	{
41 41
 		$context = \TestHelperFrontend::getContext();
42
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' );
43
-		$id = $manager->findItem( 'unitCode001' )->getId();
42
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'supplier');
43
+		$id = $manager->findItem('unitCode001')->getId();
44 44
 
45
-		$result = $this->object->getItem( $id );
45
+		$result = $this->object->getItem($id);
46 46
 
47
-		$this->assertInstanceOf( '\Aimeos\MShop\Supplier\Item\Iface', $result );
47
+		$this->assertInstanceOf('\Aimeos\MShop\Supplier\Item\Iface', $result);
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testGetItems()
52 52
 	{
53 53
 		$context = \TestHelperFrontend::getContext();
54
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' );
55
-		$id = $manager->findItem( 'unitCode001' )->getId();
54
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'supplier');
55
+		$id = $manager->findItem('unitCode001')->getId();
56 56
 
57
-		$result = $this->object->getItems( [$id] );
57
+		$result = $this->object->getItems([$id]);
58 58
 
59
-		$this->assertInternalType( 'array', $result );
60
-		$this->assertEquals( 1, count( $result ) );
59
+		$this->assertInternalType('array', $result);
60
+		$this->assertEquals(1, count($result));
61 61
 	}
62 62
 
63 63
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 		$filter = $this->object->createFilter();
67 67
 
68 68
 		$total = 0;
69
-		$results = $this->object->searchItems( $filter, [], $total );
69
+		$results = $this->object->searchItems($filter, [], $total);
70 70
 
71
-		$this->assertGreaterThanOrEqual( 2, $total );
72
-		$this->assertGreaterThanOrEqual( 2, count( $results ) );
71
+		$this->assertGreaterThanOrEqual(2, $total);
72
+		$this->assertGreaterThanOrEqual(2, count($results));
73 73
 	}
74 74
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Product/StandardTest.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
 	protected function setUp()
18 18
 	{
19 19
 		$this->context = \TestHelperFrontend::getContext();
20
-		$this->object = new \Aimeos\Controller\Frontend\Product\Standard( $this->context );
20
+		$this->object = new \Aimeos\Controller\Frontend\Product\Standard($this->context);
21 21
 	}
22 22
 
23 23
 
24 24
 	protected function tearDown()
25 25
 	{
26
-		unset( $this->object );
26
+		unset($this->object);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testAggregate()
31 31
 	{
32 32
 		$filter = $this->object->createFilter();
33
-		$list = $this->object->aggregate( $filter, 'index.attribute.id' );
33
+		$list = $this->object->aggregate($filter, 'index.attribute.id');
34 34
 
35
-		$this->assertGreaterThan( 0, count( $list ) );
35
+		$this->assertGreaterThan(0, count($list));
36 36
 	}
37 37
 
38 38
 
@@ -40,129 +40,129 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$filter = $this->object->createFilter();
42 42
 
43
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
44
-		$this->assertEquals( [], $filter->getSortations() );
45
-		$this->assertEquals( 0, $filter->getSliceStart() );
46
-		$this->assertEquals( 100, $filter->getSliceSize() );
43
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
44
+		$this->assertEquals([], $filter->getSortations());
45
+		$this->assertEquals(0, $filter->getSliceStart());
46
+		$this->assertEquals(100, $filter->getSliceSize());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testCreateFilterIgnoreDates()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/frontend/product/ignore-dates', true );
52
+		$this->context->getConfig()->set('controller/frontend/product/ignore-dates', true);
53 53
 
54 54
 		$filter = $this->object->createFilter();
55 55
 
56
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
56
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testAddFilterAttribute()
61 61
 	{
62 62
 		$filter = $this->object->createFilter();
63
-		$filter = $this->object->addFilterAttribute( $filter, array( 1, 2 ), [], [] );
63
+		$filter = $this->object->addFilterAttribute($filter, array(1, 2), [], []);
64 64
 
65 65
 		$list = $filter->getConditions()->getExpressions();
66 66
 
67
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
68
-			throw new \RuntimeException( 'Wrong expression' );
67
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
68
+			throw new \RuntimeException('Wrong expression');
69 69
 		}
70 70
 
71
-		$this->assertEquals( 'index.attributeaggregate([1,2])', $list[0]->getName() );
72
-		$this->assertEquals( 2, $list[0]->getValue() );
71
+		$this->assertEquals('index.attributeaggregate([1,2])', $list[0]->getName());
72
+		$this->assertEquals(2, $list[0]->getValue());
73 73
 	}
74 74
 
75 75
 
76 76
 	public function testAddFilterAttributeOptions()
77 77
 	{
78 78
 		$filter = $this->object->createFilter();
79
-		$filter = $this->object->addFilterAttribute( $filter, [], array( 1 ), [] );
79
+		$filter = $this->object->addFilterAttribute($filter, [], array(1), []);
80 80
 
81 81
 		$list = $filter->getConditions()->getExpressions();
82 82
 
83
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
84
-			throw new \RuntimeException( 'Wrong expression' );
83
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
84
+			throw new \RuntimeException('Wrong expression');
85 85
 		}
86 86
 
87
-		$this->assertEquals( 'index.attributeaggregate([1])', $list[0]->getName() );
88
-		$this->assertEquals( 0, $list[0]->getValue() );
87
+		$this->assertEquals('index.attributeaggregate([1])', $list[0]->getName());
88
+		$this->assertEquals(0, $list[0]->getValue());
89 89
 	}
90 90
 
91 91
 
92 92
 	public function testAddFilterAttributeOne()
93 93
 	{
94 94
 		$filter = $this->object->createFilter();
95
-		$filter = $this->object->addFilterAttribute( $filter, [], [], array( 'test' => array( 2 ) ) );
95
+		$filter = $this->object->addFilterAttribute($filter, [], [], array('test' => array(2)));
96 96
 
97 97
 		$list = $filter->getConditions()->getExpressions();
98 98
 
99
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
100
-			throw new \RuntimeException( 'Wrong expression' );
99
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
100
+			throw new \RuntimeException('Wrong expression');
101 101
 		}
102 102
 
103
-		$this->assertEquals( 'index.attributeaggregate([2])', $list[0]->getName() );
104
-		$this->assertEquals( 0, $list[0]->getValue() );
103
+		$this->assertEquals('index.attributeaggregate([2])', $list[0]->getName());
104
+		$this->assertEquals(0, $list[0]->getValue());
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testAddFilterCategory()
109 109
 	{
110 110
 		$context = \TestHelperFrontend::getContext();
111
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' );
111
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'catalog');
112 112
 
113
-		$catId = $manager->findItem( 'root' )->getId();
113
+		$catId = $manager->findItem('root')->getId();
114 114
 		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST;
115 115
 
116 116
 		$filter = $this->object->createFilter();
117
-		$filter = $this->object->addFilterCategory( $filter, $catId, $level );
117
+		$filter = $this->object->addFilterCategory($filter, $catId, $level);
118 118
 
119 119
 		$list = $filter->getConditions()->getExpressions();
120 120
 
121
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
122
-			throw new \RuntimeException( 'Wrong expression' );
121
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
122
+			throw new \RuntimeException('Wrong expression');
123 123
 		}
124 124
 
125
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
126
-		$this->assertEquals( 3, count( $list[0]->getValue() ) );
127
-		$this->assertEquals( [], $filter->getSortations() );
125
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
126
+		$this->assertEquals(3, count($list[0]->getValue()));
127
+		$this->assertEquals([], $filter->getSortations());
128 128
 	}
129 129
 
130 130
 
131 131
 	public function testAddFilterSupplier()
132 132
 	{
133 133
 		$filter = $this->object->createFilter();
134
-		$filter = $this->object->addFilterSupplier( $filter, [1, 2] );
134
+		$filter = $this->object->addFilterSupplier($filter, [1, 2]);
135 135
 
136 136
 		$list = $filter->getConditions()->getExpressions();
137 137
 
138
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
139
-			throw new \RuntimeException( 'Wrong expression' );
138
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
139
+			throw new \RuntimeException('Wrong expression');
140 140
 		}
141 141
 
142
-		$this->assertEquals( 'index.supplier.id', $list[0]->getName() );
143
-		$this->assertEquals( 2, count( $list[0]->getValue() ) );
142
+		$this->assertEquals('index.supplier.id', $list[0]->getName());
143
+		$this->assertEquals(2, count($list[0]->getValue()));
144 144
 	}
145 145
 
146 146
 
147 147
 	public function testAddFilterText()
148 148
 	{
149 149
 		$filter = $this->object->createFilter();
150
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
150
+		$filter = $this->object->addFilterText($filter, 'Espresso');
151 151
 
152
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
152
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
153 153
 
154 154
 		$list = $filter->getConditions()->getExpressions();
155 155
 
156 156
 
157
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
158
-			throw new \RuntimeException( 'Wrong expression' );
157
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
158
+			throw new \RuntimeException('Wrong expression');
159 159
 		}
160
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
161
-		$this->assertEquals( 0, $list[0]->getValue() );
160
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
161
+		$this->assertEquals(0, $list[0]->getValue());
162 162
 
163
-		$this->assertEquals( [], $filter->getSortations() );
164
-		$this->assertEquals( 0, $filter->getSliceStart() );
165
-		$this->assertEquals( 100, $filter->getSliceSize() );
163
+		$this->assertEquals([], $filter->getSortations());
164
+		$this->assertEquals(0, $filter->getSliceStart());
165
+		$this->assertEquals(100, $filter->getSliceSize());
166 166
 	}
167 167
 
168 168
 
@@ -171,177 +171,177 @@  discard block
 block discarded – undo
171 171
 		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE;
172 172
 
173 173
 		$filter = $this->object->createFilter();
174
-		$filter = $this->object->addFilterCategory( $filter, 0, $level, 'relevance', '-', 'test' );
174
+		$filter = $this->object->addFilterCategory($filter, 0, $level, 'relevance', '-', 'test');
175 175
 
176
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
176
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
177 177
 
178 178
 		$sort = $filter->getSortations();
179
-		if( ( $item = reset( $sort ) ) === false ) {
180
-			throw new \RuntimeException( 'Sortation not set' );
179
+		if (($item = reset($sort)) === false) {
180
+			throw new \RuntimeException('Sortation not set');
181 181
 		}
182 182
 
183
-		$this->assertEquals( 'sort:index.catalog.position("test",["0"])', $item->getName() );
184
-		$this->assertEquals( '-', $item->getOperator() );
183
+		$this->assertEquals('sort:index.catalog.position("test",["0"])', $item->getName());
184
+		$this->assertEquals('-', $item->getOperator());
185 185
 	}
186 186
 
187 187
 
188 188
 	public function testCreateFilterSortRelevanceText()
189 189
 	{
190
-		$filter = $this->object->createFilter( 'relevance', '-', 1, 2, 'test' );
191
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
190
+		$filter = $this->object->createFilter('relevance', '-', 1, 2, 'test');
191
+		$filter = $this->object->addFilterText($filter, 'Espresso');
192 192
 
193
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
194
-		$this->assertEquals( [], $filter->getSortations() );
195
-		$this->assertEquals( 1, $filter->getSliceStart() );
196
-		$this->assertEquals( 2, $filter->getSliceSize() );
193
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
194
+		$this->assertEquals([], $filter->getSortations());
195
+		$this->assertEquals(1, $filter->getSliceStart());
196
+		$this->assertEquals(2, $filter->getSliceSize());
197 197
 	}
198 198
 
199 199
 
200 200
 	public function testCreateFilterSortCode()
201 201
 	{
202
-		$filter = $this->object->createFilter( 'code' );
202
+		$filter = $this->object->createFilter('code');
203 203
 
204
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
204
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
205 205
 
206 206
 		$sort = $filter->getSortations();
207
-		if( ( $item = reset( $sort ) ) === false ) {
208
-			throw new \RuntimeException( 'Sortation not set' );
207
+		if (($item = reset($sort)) === false) {
208
+			throw new \RuntimeException('Sortation not set');
209 209
 		}
210 210
 
211
-		$this->assertEquals( 'product.code', $item->getName() );
211
+		$this->assertEquals('product.code', $item->getName());
212 212
 	}
213 213
 
214 214
 
215 215
 	public function testCreateFilterSortCtime()
216 216
 	{
217
-		$filter = $this->object->createFilter( 'ctime' );
217
+		$filter = $this->object->createFilter('ctime');
218 218
 
219
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
219
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
220 220
 
221 221
 		$sort = $filter->getSortations();
222
-		if( ( $item = reset( $sort ) ) === false ) {
223
-			throw new \RuntimeException( 'Sortation not set' );
222
+		if (($item = reset($sort)) === false) {
223
+			throw new \RuntimeException('Sortation not set');
224 224
 		}
225 225
 
226
-		$this->assertEquals( 'product.ctime', $item->getName() );
226
+		$this->assertEquals('product.ctime', $item->getName());
227 227
 	}
228 228
 
229 229
 
230 230
 	public function testCreateFilterSortName()
231 231
 	{
232
-		$filter = $this->object->createFilter( 'name' );
232
+		$filter = $this->object->createFilter('name');
233 233
 
234
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
234
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
235 235
 
236 236
 		$sort = $filter->getSortations();
237
-		if( ( $item = reset( $sort ) ) === false ) {
238
-			throw new \RuntimeException( 'Sortation not set' );
237
+		if (($item = reset($sort)) === false) {
238
+			throw new \RuntimeException('Sortation not set');
239 239
 		}
240 240
 
241
-		$this->assertEquals( 'sort:index.text.name("de","")', $item->getName() );
241
+		$this->assertEquals('sort:index.text.name("de","")', $item->getName());
242 242
 	}
243 243
 
244 244
 
245 245
 	public function testCreateFilterSortPrice()
246 246
 	{
247
-		$filter = $this->object->createFilter( 'price' );
247
+		$filter = $this->object->createFilter('price');
248 248
 
249
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
249
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
250 250
 
251 251
 		$sort = $filter->getSortations();
252
-		if( ( $item = reset( $sort ) ) === false ) {
253
-			throw new \RuntimeException( 'Sortation not set' );
252
+		if (($item = reset($sort)) === false) {
253
+			throw new \RuntimeException('Sortation not set');
254 254
 		}
255 255
 
256
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
256
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
257 257
 	}
258 258
 
259 259
 
260 260
 	public function testCreateFilterSortInvalid()
261 261
 	{
262
-		$filter = $this->object->createFilter( '', 'failure' );
262
+		$filter = $this->object->createFilter('', 'failure');
263 263
 
264
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
265
-		$this->assertEquals( [], $filter->getSortations() );
264
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
265
+		$this->assertEquals([], $filter->getSortations());
266 266
 	}
267 267
 
268 268
 
269 269
 	public function testGetItem()
270 270
 	{
271 271
 		$context = \TestHelperFrontend::getContext();
272
-		$id = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'CNC' )->getId();
272
+		$id = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('CNC')->getId();
273 273
 
274
-		$result = $this->object->getItem( $id );
274
+		$result = $this->object->getItem($id);
275 275
 
276
-		$this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $result );
277
-		$this->assertGreaterThan( 0, $result->getPropertyItems() );
278
-		$this->assertGreaterThan( 0, $result->getRefItems( 'attribute' ) );
279
-		$this->assertGreaterThan( 0, $result->getRefItems( 'media' ) );
280
-		$this->assertGreaterThan( 0, $result->getRefItems( 'price' ) );
281
-		$this->assertGreaterThan( 0, $result->getRefItems( 'product' ) );
282
-		$this->assertGreaterThan( 0, $result->getRefItems( 'text' ) );
276
+		$this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $result);
277
+		$this->assertGreaterThan(0, $result->getPropertyItems());
278
+		$this->assertGreaterThan(0, $result->getRefItems('attribute'));
279
+		$this->assertGreaterThan(0, $result->getRefItems('media'));
280
+		$this->assertGreaterThan(0, $result->getRefItems('price'));
281
+		$this->assertGreaterThan(0, $result->getRefItems('product'));
282
+		$this->assertGreaterThan(0, $result->getRefItems('text'));
283 283
 	}
284 284
 
285 285
 
286 286
 	public function testGetItems()
287 287
 	{
288 288
 		$context = \TestHelperFrontend::getContext();
289
-		$context->getConfig()->set( 'controller/frontend/product/ignore-dates', true );
289
+		$context->getConfig()->set('controller/frontend/product/ignore-dates', true);
290 290
 
291
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
291
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
292 292
 
293 293
 		$search = $manager->createSearch();
294
-		$search->setConditions( $search->compare( '==', 'product.code', array( 'CNC', 'CNE' ) ) );
294
+		$search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
295 295
 
296 296
 		$ids = [];
297
-		foreach( $manager->searchItems( $search ) as $productItem ) {
297
+		foreach ($manager->searchItems($search) as $productItem) {
298 298
 			$ids[] = $productItem->getId();
299 299
 		}
300 300
 
301 301
 
302
-		$result = $this->object->getItems( $ids );
302
+		$result = $this->object->getItems($ids);
303 303
 
304
-		$this->assertEquals( 2, count( $result ) );
304
+		$this->assertEquals(2, count($result));
305 305
 
306
-		foreach( $result as $productItem ) {
307
-			$this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $productItem );
306
+		foreach ($result as $productItem) {
307
+			$this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $productItem);
308 308
 		}
309 309
 	}
310 310
 
311 311
 
312 312
 	public function testSearchItemsCategory()
313 313
 	{
314
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
314
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
315 315
 		$search = $catalogManager->createSearch();
316 316
 
317
-		$search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) );
318
-		$search->setSlice( 0, 1 );
319
-		$items = $catalogManager->searchItems( $search );
317
+		$search->setConditions($search->compare('==', 'catalog.code', 'new'));
318
+		$search->setSlice(0, 1);
319
+		$items = $catalogManager->searchItems($search);
320 320
 
321
-		if( ( $item = reset( $items ) ) === false ) {
322
-			throw new \RuntimeException( 'Product item not found' );
321
+		if (($item = reset($items)) === false) {
322
+			throw new \RuntimeException('Product item not found');
323 323
 		}
324 324
 
325
-		$filter = $this->object->createFilter( 'position', '+', 1, 1 );
326
-		$filter = $this->object->addFilterCategory( $filter, $item->getId() );
325
+		$filter = $this->object->createFilter('position', '+', 1, 1);
326
+		$filter = $this->object->addFilterCategory($filter, $item->getId());
327 327
 
328 328
 		$total = 0;
329
-		$results = $this->object->searchItems( $filter, [], $total );
329
+		$results = $this->object->searchItems($filter, [], $total);
330 330
 
331
-		$this->assertEquals( 3, $total );
332
-		$this->assertEquals( 1, count( $results ) );
331
+		$this->assertEquals(3, $total);
332
+		$this->assertEquals(1, count($results));
333 333
 	}
334 334
 
335 335
 
336 336
 	public function testSearchItemsText()
337 337
 	{
338
-		$filter = $this->object->createFilter( 'relevance', '+', 0, 1, 'unittype13' );
339
-		$filter = $this->object->addFilterText( $filter, 'Expresso', 'relevance', '+', 'unittype13' );
338
+		$filter = $this->object->createFilter('relevance', '+', 0, 1, 'unittype13');
339
+		$filter = $this->object->addFilterText($filter, 'Expresso', 'relevance', '+', 'unittype13');
340 340
 
341 341
 		$total = 0;
342
-		$results = $this->object->searchItems( $filter, [], $total );
342
+		$results = $this->object->searchItems($filter, [], $total);
343 343
 
344
-		$this->assertEquals( 2, $total );
345
-		$this->assertEquals( 1, count( $results ) );
344
+		$this->assertEquals(2, $total);
345
+		$this->assertEquals(1, count($results));
346 346
 	}
347 347
 }
Please login to merge, or discard this patch.