Completed
Push — master ( 30ca3b...76cfc1 )
by Aimeos
01:38
created
controller/frontend/tests/Controller/Frontend/Product/StandardTest.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -17,214 +17,214 @@
 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
-		$list = $this->object->aggregate( 'index.attribute.id' );
32
+		$list = $this->object->aggregate('index.attribute.id');
33 33
 
34
-		$this->assertGreaterThan( 0, count( $list ) );
34
+		$this->assertGreaterThan(0, count($list));
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAllOf()
39 39
 	{
40
-		$manager = \Aimeos\MShop::create( $this->context, 'attribute' );
40
+		$manager = \Aimeos\MShop::create($this->context, 'attribute');
41 41
 
42
-		$length = $manager->findItem( '30', [], 'product', 'length' )->getId();
43
-		$width = $manager->findItem( '29', [], 'product', 'width' )->getId();
42
+		$length = $manager->findItem('30', [], 'product', 'length')->getId();
43
+		$width = $manager->findItem('29', [], 'product', 'width')->getId();
44 44
 
45
-		$this->assertEquals( 2, count( $this->object->allOf( [$length, $width] )->search() ) );
45
+		$this->assertEquals(2, count($this->object->allOf([$length, $width])->search()));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testCategory()
50 50
 	{
51
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
52
-		$catId = $manager->findItem( 'cafe' )->getId();
51
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
52
+		$catId = $manager->findItem('cafe')->getId();
53 53
 
54
-		$this->assertEquals( 2, count( $this->object->category( $catId, 'promotion' )->search() ) );
54
+		$this->assertEquals(2, count($this->object->category($catId, 'promotion')->search()));
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testCategoryTree()
59 59
 	{
60
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
60
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
61 61
 
62
-		$catId = $manager->findItem( 'categories' )->getId();
63
-		$grpId = $manager->findItem( 'group' )->getId();
62
+		$catId = $manager->findItem('categories')->getId();
63
+		$grpId = $manager->findItem('group')->getId();
64 64
 
65
-		$this->object->category( [$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE );
66
-		$this->assertEquals( 3, count( $this->object->search() ) );
65
+		$this->object->category([$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE);
66
+		$this->assertEquals(3, count($this->object->search()));
67 67
 	}
68 68
 
69 69
 
70 70
 	public function testCompare()
71 71
 	{
72
-		$this->assertEquals( 1, count( $this->object->compare( '==', 'product.type', 'bundle' )->search() ) );
72
+		$this->assertEquals(1, count($this->object->compare('==', 'product.type', 'bundle')->search()));
73 73
 	}
74 74
 
75 75
 
76 76
 	public function testGet()
77 77
 	{
78
-		$item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' );
78
+		$item = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC');
79 79
 
80
-		$this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->get( $item->getId() ) );
80
+		$this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->get($item->getId()));
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testFind()
85 85
 	{
86
-		$this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->find( 'CNC' ) );
86
+		$this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->find('CNC'));
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testOneOf()
91 91
 	{
92
-		$manager = \Aimeos\MShop::create( $this->context, 'attribute' );
92
+		$manager = \Aimeos\MShop::create($this->context, 'attribute');
93 93
 
94
-		$length = $manager->findItem( '30', [], 'product', 'length' )->getId();
95
-		$width = $manager->findItem( '29', [], 'product', 'width' )->getId();
94
+		$length = $manager->findItem('30', [], 'product', 'length')->getId();
95
+		$width = $manager->findItem('29', [], 'product', 'width')->getId();
96 96
 
97
-		$this->assertEquals( 4, count( $this->object->oneOf( [$length, $width] )->search() ) );
97
+		$this->assertEquals(4, count($this->object->oneOf([$length, $width])->search()));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testParse()
102 102
 	{
103 103
 		$cond = ['&&' => [['>' => ['product.status' => 0]], ['==' => ['product.type' => 'default']]]];
104
-		$this->assertEquals( 4, count( $this->object->parse( $cond )->search() ) );
104
+		$this->assertEquals(4, count($this->object->parse($cond)->search()));
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testProduct()
109 109
 	{
110
-		$manager = \Aimeos\MShop::create( $this->context, 'product' );
110
+		$manager = \Aimeos\MShop::create($this->context, 'product');
111 111
 
112
-		$cncId = $manager->findItem( 'CNC' )->getId();
113
-		$cneId = $manager->findItem( 'CNE' )->getId();
112
+		$cncId = $manager->findItem('CNC')->getId();
113
+		$cneId = $manager->findItem('CNE')->getId();
114 114
 
115
-		$this->assertEquals( 2, count( $this->object->product( [$cncId, $cneId] )->search() ) );
115
+		$this->assertEquals(2, count($this->object->product([$cncId, $cneId])->search()));
116 116
 	}
117 117
 
118 118
 
119 119
 	public function testSearch()
120 120
 	{
121
-		$this->assertEquals( 8, count( $this->object->search() ) );
121
+		$this->assertEquals(8, count($this->object->search()));
122 122
 	}
123 123
 
124 124
 
125 125
 	public function testSlice()
126 126
 	{
127
-		$this->assertEquals( 2, count( $this->object->slice( 0, 2 )->search() ) );
127
+		$this->assertEquals(2, count($this->object->slice(0, 2)->search()));
128 128
 	}
129 129
 
130 130
 
131 131
 	public function testSort()
132 132
 	{
133
-		$this->assertEquals( 8, count( $this->object->sort( 'relevance' )->search() ) );
133
+		$this->assertEquals(8, count($this->object->sort('relevance')->search()));
134 134
 	}
135 135
 
136 136
 
137 137
 	public function testSortCode()
138 138
 	{
139
-		$result = $this->object->sort( 'code' )->search( [] );
140
-		$this->assertEquals( 'CNC', reset( $result )->getCode() );
139
+		$result = $this->object->sort('code')->search([]);
140
+		$this->assertEquals('CNC', reset($result)->getCode());
141 141
 	}
142 142
 
143 143
 
144 144
 	public function testSortCodeDesc()
145 145
 	{
146
-		$result = $this->object->sort( '-code' )->search( [] );
147
-		$this->assertStringStartsWith( 'U:', reset( $result )->getCode() );
146
+		$result = $this->object->sort('-code')->search([]);
147
+		$this->assertStringStartsWith('U:', reset($result)->getCode());
148 148
 	}
149 149
 
150 150
 
151 151
 	public function testSortCtime()
152 152
 	{
153
-		$this->assertEquals( 8, count( $this->object->sort( 'ctime' )->search( [] ) ) );
153
+		$this->assertEquals(8, count($this->object->sort('ctime')->search([])));
154 154
 	}
155 155
 
156 156
 
157 157
 	public function testSortCtimeDesc()
158 158
 	{
159
-		$this->assertEquals( 8, count( $this->object->sort( '-ctime' )->search( [] ) ) );
159
+		$this->assertEquals(8, count($this->object->sort('-ctime')->search([])));
160 160
 	}
161 161
 
162 162
 
163 163
 	public function testSortName()
164 164
 	{
165
-		$result = $this->object->sort( 'name' )->search( ['text'] );
166
-		$this->assertEquals( 'Cafe Noire Cappuccino', reset( $result )->getName() );
165
+		$result = $this->object->sort('name')->search(['text']);
166
+		$this->assertEquals('Cafe Noire Cappuccino', reset($result)->getName());
167 167
 	}
168 168
 
169 169
 
170 170
 	public function testSortNameDesc()
171 171
 	{
172
-		$result = $this->object->sort( '-name' )->search( ['text'] );
173
-		$this->assertEquals( 'Unterproduct 3', reset( $result )->getName() );
172
+		$result = $this->object->sort('-name')->search(['text']);
173
+		$this->assertEquals('Unterproduct 3', reset($result)->getName());
174 174
 	}
175 175
 
176 176
 
177 177
 	public function testSortPrice()
178 178
 	{
179
-		$result = $this->object->sort( 'price' )->search( [] );
180
-		$this->assertEquals( 'IJKL', reset( $result )->getCode() );
179
+		$result = $this->object->sort('price')->search([]);
180
+		$this->assertEquals('IJKL', reset($result)->getCode());
181 181
 	}
182 182
 
183 183
 
184 184
 	public function testSortPriceDesc()
185 185
 	{
186
-		$result = $this->object->sort( '-price' )->search( [] );
187
-		$this->assertTrue( in_array( reset( $result )->getCode(), ['CNC', 'U:BUNDLE'] ) );
186
+		$result = $this->object->sort('-price')->search([]);
187
+		$this->assertTrue(in_array(reset($result)->getCode(), ['CNC', 'U:BUNDLE']));
188 188
 	}
189 189
 
190 190
 
191 191
 	public function testSortRelevanceCategory()
192 192
 	{
193
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
194
-		$catId = $manager->findItem( 'new' )->getId();
193
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
194
+		$catId = $manager->findItem('new')->getId();
195 195
 
196
-		$result = $this->object->category( $catId )->sort( 'relevance' )->search( [] );
196
+		$result = $this->object->category($catId)->sort('relevance')->search([]);
197 197
 
198
-		$this->assertEquals( 3, count( $result ) );
199
-		$this->assertEquals( 'CNE', reset( $result )->getCode() );
200
-		$this->assertEquals( 'U:BUNDLE', end( $result )->getCode() );
198
+		$this->assertEquals(3, count($result));
199
+		$this->assertEquals('CNE', reset($result)->getCode());
200
+		$this->assertEquals('U:BUNDLE', end($result)->getCode());
201 201
 	}
202 202
 
203 203
 
204 204
 	public function testSortRelevanceSupplier()
205 205
 	{
206
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
207
-		$supId = $manager->findItem( 'unitCode001' )->getId();
206
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
207
+		$supId = $manager->findItem('unitCode001')->getId();
208 208
 
209
-		$result = $this->object->supplier( $supId )->sort( 'relevance' )->search( [] );
209
+		$result = $this->object->supplier($supId)->sort('relevance')->search([]);
210 210
 
211
-		$this->assertEquals( 2, count( $result ) );
212
-		$this->assertEquals( 'CNC', reset( $result )->getCode() );
213
-		$this->assertEquals( 'CNE', end( $result )->getCode() );
211
+		$this->assertEquals(2, count($result));
212
+		$this->assertEquals('CNC', reset($result)->getCode());
213
+		$this->assertEquals('CNE', end($result)->getCode());
214 214
 	}
215 215
 
216 216
 
217 217
 	public function testSupplier()
218 218
 	{
219
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
220
-		$supId = $manager->findItem( 'unitCode001' )->getId();
219
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
220
+		$supId = $manager->findItem('unitCode001')->getId();
221 221
 
222
-		$this->assertEquals( 2, count( $this->object->supplier( $supId )->search( [] ) ) );
222
+		$this->assertEquals(2, count($this->object->supplier($supId)->search([])));
223 223
 	}
224 224
 
225 225
 
226 226
 	public function testText()
227 227
 	{
228
-		$this->assertEquals( 3, count( $this->object->text( 'Cafe' )->search( [] ) ) );
228
+		$this->assertEquals(3, count($this->object->text('Cafe')->search([])));
229 229
 	}
230 230
 }
Please login to merge, or discard this patch.