|
@@ 337-365 (lines=29) @@
|
| 334 |
|
} |
| 335 |
|
} |
| 336 |
|
|
| 337 |
|
public function testIncorrectPackIntoManyRequest() |
| 338 |
|
{ |
| 339 |
|
// Build a fake request |
| 340 |
|
// Build packing request |
| 341 |
|
$request = new \BinPacking3d\Entity\Request(); |
| 342 |
|
|
| 343 |
|
$packIntoMany = new PackIntoMany($request); |
| 344 |
|
$this->assertInstanceOf('\BinPacking3d\PackIntoMany', $packIntoMany); |
| 345 |
|
$this->assertInstanceOf('\BinPacking3d\Query', $packIntoMany); |
| 346 |
|
|
| 347 |
|
// Set expected exception |
| 348 |
|
$this->setExpectedException('\BinPacking3d\Exception\CriticalException'); |
| 349 |
|
|
| 350 |
|
// Build response mock stack |
| 351 |
|
$mock = new MockHandler( |
| 352 |
|
[ |
| 353 |
|
new Response( |
| 354 |
|
200, ['Content-Type' => 'application/json'], |
| 355 |
|
file_get_contents($this->getFilePath('responses/PackIntoMany/error_critical.json')) |
| 356 |
|
), |
| 357 |
|
] |
| 358 |
|
); |
| 359 |
|
$handler = HandlerStack::create($mock); |
| 360 |
|
$client = new Client(['handler' => $handler]); |
| 361 |
|
|
| 362 |
|
// Get response |
| 363 |
|
$response = $client->get('/PackIntoMany'); |
| 364 |
|
$packIntoMany->handleResponse($response); |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
public function testWarningPackIntoManyRequest() |
| 368 |
|
{ |
|
@@ 367-395 (lines=29) @@
|
| 364 |
|
$packIntoMany->handleResponse($response); |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
public function testWarningPackIntoManyRequest() |
| 368 |
|
{ |
| 369 |
|
// Build a fake request |
| 370 |
|
// Build packing request |
| 371 |
|
$request = new \BinPacking3d\Entity\Request(); |
| 372 |
|
|
| 373 |
|
$packIntoMany = new PackIntoMany($request); |
| 374 |
|
$this->assertInstanceOf('\BinPacking3d\PackIntoMany', $packIntoMany); |
| 375 |
|
$this->assertInstanceOf('\BinPacking3d\Query', $packIntoMany); |
| 376 |
|
|
| 377 |
|
// Set expected exception |
| 378 |
|
$this->setExpectedException('\BinPacking3d\Exception\WarningException'); |
| 379 |
|
|
| 380 |
|
// Build response mock stack |
| 381 |
|
$mock = new MockHandler( |
| 382 |
|
[ |
| 383 |
|
new Response( |
| 384 |
|
200, ['Content-Type' => 'application/json'], |
| 385 |
|
file_get_contents($this->getFilePath('responses/PackIntoMany/error_warning.json')) |
| 386 |
|
), |
| 387 |
|
] |
| 388 |
|
); |
| 389 |
|
$handler = HandlerStack::create($mock); |
| 390 |
|
$client = new Client(['handler' => $handler]); |
| 391 |
|
|
| 392 |
|
// Get response |
| 393 |
|
$response = $client->get('/PackIntoMany'); |
| 394 |
|
$packIntoMany->handleResponse($response); |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
public function testErrorPackIntoManyRequest() |
| 398 |
|
{ |
|
@@ 397-425 (lines=29) @@
|
| 394 |
|
$packIntoMany->handleResponse($response); |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
public function testErrorPackIntoManyRequest() |
| 398 |
|
{ |
| 399 |
|
// Build a fake request |
| 400 |
|
// Build packing request |
| 401 |
|
$request = new \BinPacking3d\Entity\Request(); |
| 402 |
|
|
| 403 |
|
$packIntoMany = new PackIntoMany($request); |
| 404 |
|
$this->assertInstanceOf('\BinPacking3d\PackIntoMany', $packIntoMany); |
| 405 |
|
$this->assertInstanceOf('\BinPacking3d\Query', $packIntoMany); |
| 406 |
|
|
| 407 |
|
// Set expected exception |
| 408 |
|
$this->setExpectedException('\Exception'); |
| 409 |
|
|
| 410 |
|
// Build response mock stack |
| 411 |
|
$mock = new MockHandler( |
| 412 |
|
[ |
| 413 |
|
new Response( |
| 414 |
|
200, ['Content-Type' => 'application/json'], |
| 415 |
|
file_get_contents($this->getFilePath('responses/PackIntoMany/error_other.json')) |
| 416 |
|
), |
| 417 |
|
] |
| 418 |
|
); |
| 419 |
|
$handler = HandlerStack::create($mock); |
| 420 |
|
$client = new Client(['handler' => $handler]); |
| 421 |
|
|
| 422 |
|
// Get response |
| 423 |
|
$response = $client->get('/PackIntoMany'); |
| 424 |
|
$packIntoMany->handleResponse($response); |
| 425 |
|
} |
| 426 |
|
|
| 427 |
|
public function testQuery() |
| 428 |
|
{ |