@@ -682,6 +682,9 @@ discard block |
||
| 682 | 682 | return $mapping; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | + /** |
|
| 686 | + * @param string $idKey |
|
| 687 | + */ |
|
| 685 | 688 | private function getProductMetadata($idKey) |
| 686 | 689 | { |
| 687 | 690 | $productMetadata = new ClassMetadata( |
@@ -699,6 +702,9 @@ discard block |
||
| 699 | 702 | return $productMetadata; |
| 700 | 703 | } |
| 701 | 704 | |
| 705 | + /** |
|
| 706 | + * @param string $idKey |
|
| 707 | + */ |
|
| 702 | 708 | private function getCartItemDetailMetadata($idKey) |
| 703 | 709 | { |
| 704 | 710 | $cartItemDetailMetadata = new ClassMetadata( |
@@ -719,6 +725,9 @@ discard block |
||
| 719 | 725 | return $cartItemDetailMetadata; |
| 720 | 726 | } |
| 721 | 727 | |
| 728 | + /** |
|
| 729 | + * @param string $idKey |
|
| 730 | + */ |
|
| 722 | 731 | private function getCartItemMetadata($idKey) |
| 723 | 732 | { |
| 724 | 733 | $cartItemMetadata = new ClassMetadata( |
@@ -745,6 +754,9 @@ discard block |
||
| 745 | 754 | return $cartItemMetadata; |
| 746 | 755 | } |
| 747 | 756 | |
| 757 | + /** |
|
| 758 | + * @param string $idKey |
|
| 759 | + */ |
|
| 748 | 760 | private function getCartMetadata($idKey) |
| 749 | 761 | { |
| 750 | 762 | $cartMetadata = new ClassMetadata( |
@@ -772,7 +784,7 @@ discard block |
||
| 772 | 784 | * createNewCart |
| 773 | 785 | * |
| 774 | 786 | * @access private |
| 775 | - * @return AbstractModel |
|
| 787 | + * @return \Mapado\RestClientSdk\Tests\Model\Cart |
|
| 776 | 788 | */ |
| 777 | 789 | private function createNewCart() |
| 778 | 790 | { |
@@ -791,7 +803,7 @@ discard block |
||
| 791 | 803 | * createCart |
| 792 | 804 | * |
| 793 | 805 | * @access private |
| 794 | - * @return void |
|
| 806 | + * @return \Mapado\RestClientSdk\Tests\Model\Cart |
|
| 795 | 807 | */ |
| 796 | 808 | private function createCart() |
| 797 | 809 | { |
@@ -805,7 +817,7 @@ discard block |
||
| 805 | 817 | * createKnownCartItem |
| 806 | 818 | * |
| 807 | 819 | * @access private |
| 808 | - * @return AbstractModel |
|
| 820 | + * @return \Mapado\RestClientSdk\Tests\Model\CartItem |
|
| 809 | 821 | */ |
| 810 | 822 | private function createKnownCartItem() |
| 811 | 823 | { |
@@ -826,7 +838,7 @@ discard block |
||
| 826 | 838 | * createNewCartItem |
| 827 | 839 | * |
| 828 | 840 | * @access private |
| 829 | - * @return AbstractModel |
|
| 841 | + * @return \Mapado\RestClientSdk\Tests\Model\CartItem |
|
| 830 | 842 | */ |
| 831 | 843 | private function createNewCartItem($addKnownedProduct = true) |
| 832 | 844 | { |
@@ -849,7 +861,7 @@ discard block |
||
| 849 | 861 | * createNewProduct |
| 850 | 862 | * |
| 851 | 863 | * @access private |
| 852 | - * @return AbstractModel |
|
| 864 | + * @return \Mapado\RestClientSdk\Tests\Model\Product |
|
| 853 | 865 | */ |
| 854 | 866 | private function createNewProduct() |
| 855 | 867 | { |
@@ -866,7 +878,7 @@ discard block |
||
| 866 | 878 | * createKnownedProduct |
| 867 | 879 | * |
| 868 | 880 | * @access private |
| 869 | - * @return AbstractModel |
|
| 881 | + * @return \Mapado\RestClientSdk\Tests\Model\Product |
|
| 870 | 882 | */ |
| 871 | 883 | private function createKnownedProduct() |
| 872 | 884 | { |
@@ -889,6 +901,7 @@ discard block |
||
| 889 | 901 | * createNewInstance |
| 890 | 902 | * |
| 891 | 903 | * @access private |
| 904 | + * @param Mapping $mapping |
|
| 892 | 905 | * @return void |
| 893 | 906 | */ |
| 894 | 907 | private function createNewInstance($mapping = null) |
@@ -917,6 +930,9 @@ discard block |
||
| 917 | 930 | $this->testedInstance->setSdk($sdk); |
| 918 | 931 | } |
| 919 | 932 | |
| 933 | + /** |
|
| 934 | + * @param string $modelName |
|
| 935 | + */ |
|
| 920 | 936 | private function getCartRepositoryMock($sdk, $restClient, $modelName) |
| 921 | 937 | { |
| 922 | 938 | $repository = new \mock\Mapado\RestClientSdk\EntityRepository( |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ->array($data = $this->testedInstance->serialize( |
| 78 | 78 | $cart, |
| 79 | 79 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
| 80 | - [ 'serializeRelations' => ['cart_items'] ] |
|
| 80 | + ['serializeRelations' => ['cart_items']] |
|
| 81 | 81 | )) |
| 82 | 82 | ->isIdenticalTo([ |
| 83 | 83 | '@id' => '/v1/carts/8', |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->array($data = $this->testedInstance->serialize( |
| 106 | 106 | $cart, |
| 107 | 107 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
| 108 | - [ 'serializeRelations' => ['cart_items'] ] |
|
| 108 | + ['serializeRelations' => ['cart_items']] |
|
| 109 | 109 | )) |
| 110 | 110 | ->isIdenticalTo([ |
| 111 | 111 | '@id' => '/v1/carts/8', |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | 'who' => 'John', |
| 248 | 248 | ], |
| 249 | 249 | 'cartItemDetailList' => [ |
| 250 | - [ 'name' => 'Bill' ], |
|
| 251 | - [ 'name' => 'Bill', ], |
|
| 250 | + ['name' => 'Bill'], |
|
| 251 | + ['name' => 'Bill', ], |
|
| 252 | 252 | ], |
| 253 | 253 | ], |
| 254 | 254 | ], |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | ->array($data = $this->testedInstance->serialize( |
| 278 | 278 | $cart, |
| 279 | 279 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
| 280 | - [ 'serializeRelations' => ['cart_items'] ] |
|
| 280 | + ['serializeRelations' => ['cart_items']] |
|
| 281 | 281 | )) |
| 282 | 282 | ->isIdenticalTo([ |
| 283 | 283 | '@id' => '/v1/carts/8', |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | ->then |
| 341 | 341 | ->object($cartItemDetail->getCartItem()) |
| 342 | 342 | ->isInstanceOf('Mapado\RestClientSdk\Tests\Model\CartItem') |
| 343 | - ->exception(function () use ($testedInstance, $cartItemDetail) { |
|
| 343 | + ->exception(function() use ($testedInstance, $cartItemDetail) { |
|
| 344 | 344 | $testedInstance->serialize($cartItemDetail, 'Mapado\RestClientSdk\Tests\Model\CartItemDetail'); |
| 345 | 345 | }) |
| 346 | 346 | ->isInstanceOf('Mapado\RestClientSdk\Exception\SdkException') |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | ->array($data = $this->testedInstance->serialize( |
| 516 | 516 | $cart, |
| 517 | 517 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
| 518 | - [ 'serializeRelations' => ['cart_items'] ] |
|
| 518 | + ['serializeRelations' => ['cart_items']] |
|
| 519 | 519 | )) |
| 520 | 520 | ->isIdenticalTo([ |
| 521 | 521 | 'weirdId' => '/v1/carts/8', |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | ->array($data = $this->testedInstance->serialize( |
| 544 | 544 | $cart, |
| 545 | 545 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
| 546 | - [ 'serializeRelations' => ['cart_items'] ] |
|
| 546 | + ['serializeRelations' => ['cart_items']] |
|
| 547 | 547 | )) |
| 548 | 548 | ->isIdenticalTo([ |
| 549 | 549 | 'weirdId' => '/v1/carts/8', |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | ->serialize( |
| 647 | 647 | $section, |
| 648 | 648 | 'Mapado\RestClientSdk\Tests\Model\Issue46\Section', |
| 649 | - [ 'serializeRelations' => ['articleList'] ] |
|
| 649 | + ['serializeRelations' => ['articleList']] |
|
| 650 | 650 | )) |
| 651 | 651 | ->isIdenticalTo([ |
| 652 | 652 | '@id' => '/sections/46', |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | |
| 906 | 906 | $cartRepositoryMock = $this->getCartRepositoryMock($sdk, $restClient, 'Mapado\RestClientSdk\Tests\Model\Cart'); |
| 907 | 907 | |
| 908 | - $this->calling($sdk)->getRepository = function ($modelName) use ($cartRepositoryMock) { |
|
| 908 | + $this->calling($sdk)->getRepository = function($modelName) use ($cartRepositoryMock) { |
|
| 909 | 909 | switch ($modelName) { |
| 910 | 910 | case 'Mapado\RestClientSdk\Tests\Model\Cart': |
| 911 | 911 | return $cartRepositoryMock; |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | |
| 928 | 928 | $_this = $this; |
| 929 | 929 | |
| 930 | - $this->calling($repository)->find = function ($id) use ($_this) { |
|
| 930 | + $this->calling($repository)->find = function($id) use ($_this) { |
|
| 931 | 931 | return $_this->createCart(); |
| 932 | 932 | }; |
| 933 | 933 | |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | $this |
| 341 | 341 | ->if($repository->findBy(['section' => $section1])) |
| 342 | 342 | // ->then(ldd(iterator_to_array($arrayAdapter->getItems()))) |
| 343 | - ->then |
|
| 344 | - ->mock($this->mockedRestClient) |
|
| 345 | - ->call('get') |
|
| 346 | - ->withArguments('/sections?section=%2Fsections%2F1')->once() |
|
| 343 | + ->then |
|
| 344 | + ->mock($this->mockedRestClient) |
|
| 345 | + ->call('get') |
|
| 346 | + ->withArguments('/sections?section=%2Fsections%2F1')->once() |
|
| 347 | 347 | |
| 348 | 348 | ->if($repository->findAll()) |
| 349 | 349 | // ->then(ldd(iterator_to_array($arrayAdapter->getItems()))) |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | ->boolean($arrayAdapter->hasItem('test_prefix__sections_1')) |
| 352 | 352 | ->isTrue() |
| 353 | 353 | |
| 354 | - ->if($repository->find(1)) |
|
| 355 | - ->then |
|
| 356 | - ->mock($this->mockedRestClient) |
|
| 357 | - ->call('get') |
|
| 358 | - ->withArguments('/sections/1')->never() |
|
| 354 | + ->if($repository->find(1)) |
|
| 355 | + ->then |
|
| 356 | + ->mock($this->mockedRestClient) |
|
| 357 | + ->call('get') |
|
| 358 | + ->withArguments('/sections/1')->never() |
|
| 359 | 359 | |
| 360 | 360 | // after update |
| 361 | 361 | ->if($repository->update($section1)) |
@@ -262,7 +262,7 @@ |
||
| 262 | 262 | $mapping = $this->sdk->getMapping(); |
| 263 | 263 | |
| 264 | 264 | return array_map( |
| 265 | - function ($item) use ($mapping) { |
|
| 265 | + function($item) use ($mapping) { |
|
| 266 | 266 | if (is_object($item)) { |
| 267 | 267 | $classname = get_class($item); |
| 268 | 268 | |