|
@@ 500-512 (lines=13) @@
|
| 497 |
|
} |
| 498 |
|
|
| 499 |
|
|
| 500 |
|
public function testPatchException() |
| 501 |
|
{ |
| 502 |
|
$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' ) |
| 503 |
|
->will( $this->throwException( new \Exception( 'test exception' ) ) ); |
| 504 |
|
|
| 505 |
|
$header = array(); |
| 506 |
|
$status = 500; |
| 507 |
|
|
| 508 |
|
$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true ); |
| 509 |
|
|
| 510 |
|
$this->assertEquals( 500, $status ); |
| 511 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
|
| 515 |
|
public function testPatchMAdminException() |
|
@@ 515-527 (lines=13) @@
|
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
|
| 515 |
|
public function testPatchMAdminException() |
| 516 |
|
{ |
| 517 |
|
$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' ) |
| 518 |
|
->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) ); |
| 519 |
|
|
| 520 |
|
$header = array(); |
| 521 |
|
$status = 500; |
| 522 |
|
|
| 523 |
|
$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true ); |
| 524 |
|
|
| 525 |
|
$this->assertEquals( 404, $status ); |
| 526 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 527 |
|
} |
| 528 |
|
|
| 529 |
|
|
| 530 |
|
public function testPatchMShopException() |
|
@@ 530-542 (lines=13) @@
|
| 527 |
|
} |
| 528 |
|
|
| 529 |
|
|
| 530 |
|
public function testPatchMShopException() |
| 531 |
|
{ |
| 532 |
|
$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' ) |
| 533 |
|
->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) ); |
| 534 |
|
|
| 535 |
|
$header = array(); |
| 536 |
|
$status = 500; |
| 537 |
|
|
| 538 |
|
$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true ); |
| 539 |
|
|
| 540 |
|
$this->assertEquals( 404, $status ); |
| 541 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
|
| 545 |
|
public function testPost() |
|
@@ 640-652 (lines=13) @@
|
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
|
| 640 |
|
public function testPostException() |
| 641 |
|
{ |
| 642 |
|
$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' ) |
| 643 |
|
->will( $this->throwException( new \Exception( 'test exception' ) ) ); |
| 644 |
|
|
| 645 |
|
$header = array(); |
| 646 |
|
$status = 500; |
| 647 |
|
|
| 648 |
|
$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true ); |
| 649 |
|
|
| 650 |
|
$this->assertEquals( 500, $status ); |
| 651 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 652 |
|
} |
| 653 |
|
|
| 654 |
|
|
| 655 |
|
public function testPostMAdminException() |
|
@@ 655-667 (lines=13) @@
|
| 652 |
|
} |
| 653 |
|
|
| 654 |
|
|
| 655 |
|
public function testPostMAdminException() |
| 656 |
|
{ |
| 657 |
|
$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' ) |
| 658 |
|
->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) ); |
| 659 |
|
|
| 660 |
|
$header = array(); |
| 661 |
|
$status = 500; |
| 662 |
|
|
| 663 |
|
$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true ); |
| 664 |
|
|
| 665 |
|
$this->assertEquals( 404, $status ); |
| 666 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 667 |
|
} |
| 668 |
|
|
| 669 |
|
|
| 670 |
|
public function testPostMShopException() |
|
@@ 670-682 (lines=13) @@
|
| 667 |
|
} |
| 668 |
|
|
| 669 |
|
|
| 670 |
|
public function testPostMShopException() |
| 671 |
|
{ |
| 672 |
|
$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' ) |
| 673 |
|
->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) ); |
| 674 |
|
|
| 675 |
|
$header = array(); |
| 676 |
|
$status = 500; |
| 677 |
|
|
| 678 |
|
$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true ); |
| 679 |
|
|
| 680 |
|
$this->assertEquals( 404, $status ); |
| 681 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 682 |
|
} |
| 683 |
|
|
| 684 |
|
|
| 685 |
|
public function testPut() |
|
@@ 714-726 (lines=13) @@
|
| 711 |
|
} |
| 712 |
|
|
| 713 |
|
|
| 714 |
|
public function testOptionsException() |
| 715 |
|
{ |
| 716 |
|
$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' ) |
| 717 |
|
->will( $this->throwException( new \Exception( 'test exception' ) ) ); |
| 718 |
|
|
| 719 |
|
$header = array(); |
| 720 |
|
$status = 500; |
| 721 |
|
|
| 722 |
|
$result = json_decode( $this->object->options( '', $header, $status ), true ); |
| 723 |
|
|
| 724 |
|
$this->assertEquals( 500, $status ); |
| 725 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 726 |
|
} |
| 727 |
|
|
| 728 |
|
|
| 729 |
|
public function testOptionsMAdminException() |
|
@@ 729-741 (lines=13) @@
|
| 726 |
|
} |
| 727 |
|
|
| 728 |
|
|
| 729 |
|
public function testOptionsMAdminException() |
| 730 |
|
{ |
| 731 |
|
$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' ) |
| 732 |
|
->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) ); |
| 733 |
|
|
| 734 |
|
$header = array(); |
| 735 |
|
$status = 500; |
| 736 |
|
|
| 737 |
|
$result = json_decode( $this->object->options( '', $header, $status ), true ); |
| 738 |
|
|
| 739 |
|
$this->assertEquals( 404, $status ); |
| 740 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 741 |
|
} |
| 742 |
|
|
| 743 |
|
|
| 744 |
|
public function testOptionsMShopException() |
|
@@ 744-756 (lines=13) @@
|
| 741 |
|
} |
| 742 |
|
|
| 743 |
|
|
| 744 |
|
public function testOptionsMShopException() |
| 745 |
|
{ |
| 746 |
|
$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' ) |
| 747 |
|
->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) ); |
| 748 |
|
|
| 749 |
|
$header = array(); |
| 750 |
|
$status = 500; |
| 751 |
|
|
| 752 |
|
$result = json_decode( $this->object->options( '', $header, $status ), true ); |
| 753 |
|
|
| 754 |
|
$this->assertEquals( 404, $status ); |
| 755 |
|
$this->assertArrayHasKey( 'errors', $result ); |
| 756 |
|
} |
| 757 |
|
|
| 758 |
|
|
| 759 |
|
protected function getProductMock( array $methods ) |