This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php namespace BinPacking3d\Tests; |
||
2 | |||
3 | class BinPackingTest extends BinPackingTestBase |
||
4 | { |
||
5 | |||
6 | /** |
||
7 | * @var \UnitTester |
||
8 | */ |
||
9 | protected $tester; |
||
10 | |||
11 | public function testCreateBin() |
||
12 | { |
||
13 | $bin = new \BinPacking3d\Entity\Bin; |
||
14 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
15 | $result = $bin->setWidth(100); |
||
16 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
17 | $result = $bin->setHeight(120); |
||
18 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
19 | $result = $bin->setDepth(130); |
||
20 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
21 | $result = $bin->setMaxWeight(10); |
||
22 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
23 | $result = $bin->setOuterWidth(110); |
||
24 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
25 | $result = $bin->setOuterHeight(130); |
||
26 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
27 | $result = $bin->setOuterDepth(140); |
||
28 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
29 | $result = $bin->setWeight(0.1); |
||
30 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
31 | $result = $bin->setIdentifier('Test'); |
||
32 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
33 | |||
34 | $this->assertEquals('Test', $bin->getIdentifier()); |
||
35 | $this->assertEquals(100, $bin->getWidth()); |
||
36 | $this->assertEquals(120, $bin->getHeight()); |
||
37 | $this->assertEquals(130, $bin->getDepth()); |
||
38 | $this->assertEquals(0.1, $bin->getWeight()); |
||
39 | $this->assertNull($bin->getImage()); |
||
40 | $this->assertNull($bin->getUsedSpace()); |
||
41 | $this->assertNull($bin->getUsedWeight()); |
||
42 | $this->assertEmpty($bin->getItems()); |
||
43 | $this->assertFalse($bin->saveImage('test.png')); |
||
44 | } |
||
45 | |||
46 | public function testAddBin() |
||
47 | { |
||
48 | $request = new \BinPacking3d\Entity\Request(); |
||
49 | |||
50 | $bin = new \BinPacking3d\Entity\Bin; |
||
51 | $bin->setWidth(100) |
||
52 | ->setHeight(120) |
||
53 | ->setDepth(130) |
||
54 | ->setMaxWeight(10) |
||
55 | ->setOuterWidth(110) |
||
56 | ->setOuterHeight(130) |
||
57 | ->setOuterDepth(140) |
||
58 | ->setWeight(0.1) |
||
59 | ->setIdentifier('Test') |
||
60 | ->setInternalIdentifier('Test1'); |
||
61 | |||
62 | $this->assertInstanceOf('\BinPacking3d\Entity\Request', $request->addBin($bin)); |
||
63 | $this->assertCount(1, $request->getBins()); |
||
64 | } |
||
65 | |||
66 | public function testDuplicateItem() |
||
67 | { |
||
68 | $this->setExpectedException('\BinPacking3d\Exception\CriticalException'); |
||
0 ignored issues
–
show
|
|||
69 | $request = new \BinPacking3d\Entity\Request(); |
||
70 | |||
71 | // Item |
||
72 | $item = new \BinPacking3d\Entity\Item(); |
||
73 | $item->setWidth(50); |
||
74 | $item->setHeight(60); |
||
75 | $item->setDepth(70); |
||
76 | $item->setWeight(5); |
||
77 | $item->setItemIdentifier('Test'); |
||
78 | $item->setProduct(['product_id' => 1]); |
||
79 | $request->addItem($item); |
||
80 | |||
81 | // Item |
||
82 | $item = new \BinPacking3d\Entity\Item(); |
||
83 | $item->setWidth(50); |
||
84 | $item->setHeight(60); |
||
85 | $item->setDepth(70); |
||
86 | $item->setWeight(5); |
||
87 | $item->setItemIdentifier('Test'); |
||
88 | $item->setProduct(['product_id' => 1]); |
||
89 | $request->addItem($item); |
||
90 | } |
||
91 | |||
92 | public function testInvalidItem() |
||
93 | { |
||
94 | $this->setExpectedException('\BinPacking3d\Exception\CriticalException'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
95 | $request = new \BinPacking3d\Entity\Request(); |
||
96 | |||
97 | // Item |
||
98 | $item = new \BinPacking3d\Entity\Item(); |
||
99 | $item->setWidth(50); |
||
100 | $item->setHeight(60); |
||
101 | $item->setDepth(70); |
||
102 | $item->setProduct(['product_id' => 1]); |
||
103 | $request->addItem($item); |
||
104 | } |
||
105 | |||
106 | public function testSetQuantity() |
||
107 | { |
||
108 | $request = new \BinPacking3d\Entity\Request(); |
||
109 | |||
110 | // Item |
||
111 | $item = new \BinPacking3d\Entity\Item(); |
||
112 | $item->setWidth(50); |
||
113 | $item->setHeight(60); |
||
114 | $item->setDepth(70); |
||
115 | $item->setWeight(5); |
||
116 | $item->setItemIdentifier('Test'); |
||
117 | $this->assertNull($item->getProduct()); |
||
118 | $item->setProduct(['product_id' => 1]); |
||
119 | $this->assertEquals(['product_id' => 1], $item->getProduct()); |
||
120 | $this->assertEquals(1, $item->getQuantity()); |
||
121 | $item->setQuantity(2); |
||
122 | $this->assertEquals(2, $item->getQuantity()); |
||
123 | $this->assertFalse($item->isVerticalRotationLock()); |
||
124 | $item->setVerticalRotationLock(true); |
||
125 | $this->assertTrue($item->isVerticalRotationLock()); |
||
126 | $request->addItem($item); |
||
127 | } |
||
128 | |||
129 | public function testSetItems() |
||
130 | { |
||
131 | $request = new \BinPacking3d\Entity\Request(); |
||
132 | |||
133 | // Item |
||
134 | $item = new \BinPacking3d\Entity\Item(); |
||
135 | $item->setWidth(50); |
||
136 | $item->setHeight(60); |
||
137 | $item->setDepth(70); |
||
138 | $item->setWeight(5); |
||
139 | $item->setItemIdentifier('Test'); |
||
140 | $item->setProduct(['product_id' => 1]); |
||
141 | $item->setQuantity(2); |
||
142 | $item->setVerticalRotationLock(true); |
||
143 | $request->addItem($item); |
||
144 | $request->setItems([$item]); |
||
145 | $this->assertCount(1, $request->getItems()); |
||
146 | $this->assertEquals($item, $request->getItems()[0]); |
||
147 | } |
||
148 | |||
149 | public function testAddInvalidBin() |
||
150 | { |
||
151 | $this->setExpectedException('\BinPacking3d\Exception\CriticalException'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
152 | $request = new \BinPacking3d\Entity\Request(); |
||
153 | |||
154 | $bin = new \BinPacking3d\Entity\Bin; |
||
155 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
156 | $result = $bin->setWidth(100); |
||
157 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
158 | $result = $bin->setHeight(120); |
||
159 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
160 | $result = $bin->setDepth(130); |
||
161 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
162 | $result = $bin->setMaxWeight(10); |
||
163 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
164 | $result = $bin->setOuterWidth(110); |
||
165 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
166 | $result = $bin->setOuterHeight(130); |
||
167 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
168 | $result = $bin->setOuterDepth(140); |
||
169 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
170 | $request->addBin($bin); |
||
171 | } |
||
172 | |||
173 | public function testAddDuplicateBin() |
||
174 | { |
||
175 | $this->setExpectedException('\BinPacking3d\Exception\CriticalException'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
176 | $request = new \BinPacking3d\Entity\Request(); |
||
177 | |||
178 | $bin = new \BinPacking3d\Entity\Bin; |
||
179 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
180 | $result = $bin->setWidth(100); |
||
181 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
182 | $result = $bin->setHeight(120); |
||
183 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
184 | $result = $bin->setDepth(130); |
||
185 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
186 | $result = $bin->setMaxWeight(10); |
||
187 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
188 | $result = $bin->setOuterWidth(110); |
||
189 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
190 | $result = $bin->setOuterHeight(130); |
||
191 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
192 | $result = $bin->setOuterDepth(140); |
||
193 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
194 | $result = $bin->setWeight(0.1); |
||
195 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
196 | $result = $bin->setIdentifier('Test'); |
||
197 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
198 | $request->addBin($bin); |
||
199 | |||
200 | $bin = new \BinPacking3d\Entity\Bin; |
||
201 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
202 | $result = $bin->setWidth(100); |
||
203 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
204 | $result = $bin->setHeight(120); |
||
205 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
206 | $result = $bin->setDepth(130); |
||
207 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
208 | $result = $bin->setMaxWeight(10); |
||
209 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
210 | $result = $bin->setOuterWidth(110); |
||
211 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
212 | $result = $bin->setOuterHeight(130); |
||
213 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
214 | $result = $bin->setOuterDepth(140); |
||
215 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
216 | $result = $bin->setWeight(0.1); |
||
217 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
218 | $result = $bin->setIdentifier('Test'); |
||
219 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $result); |
||
220 | $request->addBin($bin); |
||
221 | } |
||
222 | |||
223 | public function testRequestNoApiKey() |
||
224 | { |
||
225 | $request = new \BinPacking3d\Entity\Request(); |
||
226 | $this->setExpectedException('BinPacking3d\Exception\CriticalException'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
227 | $request->validate(); |
||
228 | } |
||
229 | |||
230 | View Code Duplication | public function testAddBinExceptionOuterWidth() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
231 | { |
||
232 | $bin = new \BinPacking3d\Entity\Bin; |
||
233 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
234 | $bin->setWidth(50); |
||
235 | $bin->setOuterWidth(51); |
||
236 | $this->assertEquals(50, $bin->getWidth()); |
||
237 | $this->assertEquals(51, $bin->getOuterWidth()); |
||
238 | $this->assertGreaterThan($bin->getWidth(), $bin->getOuterWidth()); |
||
239 | |||
240 | $bin = new \BinPacking3d\Entity\Bin; |
||
241 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
242 | $this->setExpectedException('Exception'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
243 | $bin->setOuterWidth(100); |
||
244 | } |
||
245 | |||
246 | // tests |
||
247 | |||
248 | View Code Duplication | public function testAddBinExceptionOuterDepth() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
249 | { |
||
250 | $bin = new \BinPacking3d\Entity\Bin; |
||
251 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
252 | $bin->setDepth(50); |
||
253 | $bin->setOuterDepth(51); |
||
254 | $this->assertEquals(50, $bin->getDepth()); |
||
255 | $this->assertEquals(51, $bin->getOuterDepth()); |
||
256 | $this->assertGreaterThan($bin->getDepth(), $bin->getOuterDepth()); |
||
257 | |||
258 | $bin = new \BinPacking3d\Entity\Bin; |
||
259 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
260 | $this->setExpectedException('Exception'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
261 | $bin->setOuterDepth(100); |
||
262 | } |
||
263 | |||
264 | View Code Duplication | public function testAddBinExceptionOuterHeight() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
265 | { |
||
266 | $bin = new \BinPacking3d\Entity\Bin; |
||
267 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
268 | $bin->setHeight(50); |
||
269 | $bin->setOuterHeight(51); |
||
270 | $this->assertEquals(50, $bin->getHeight()); |
||
271 | $this->assertEquals(51, $bin->getOuterHeight()); |
||
272 | $this->assertGreaterThan($bin->getHeight(), $bin->getOuterHeight()); |
||
273 | |||
274 | $bin = new \BinPacking3d\Entity\Bin; |
||
275 | $this->assertInstanceOf('\BinPacking3d\Entity\Bin', $bin); |
||
276 | $this->setExpectedException('Exception'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
277 | $bin->setOuterHeight(100); |
||
278 | } |
||
279 | |||
280 | } |
||
281 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.