| Conditions | 1 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 96 | public function requestAddConfigurableItemsToCart(ProductConfigurationsApiTester $I): void |
||
| 97 | { |
||
| 98 | // Arrange |
||
| 99 | $I->amAuthorizedCustomer($this->fixtures->getCustomerTransfer()); |
||
| 100 | $quoteTransfer = $I->havePersistentQuote([ |
||
| 101 | QuoteTransfer::CUSTOMER => $this->fixtures->getCustomerTransfer(), |
||
| 102 | QuoteTransfer::STORE => [StoreTransfer::NAME => $this->fixtures::STORE_NAME_DE], |
||
| 103 | QuoteTransfer::PRICE_MODE => PriceConfig::PRICE_MODE_GROSS, |
||
| 104 | ]); |
||
| 105 | $quoteUuid = $quoteTransfer->getUuidOrFail(); |
||
| 106 | $productConcreteSku = $this->fixtures->getProductConcreteTransfer()->getSkuOrFail(); |
||
| 107 | |||
| 108 | // Act |
||
| 109 | $I->sendPOST( |
||
| 110 | $I->formatUrl( |
||
| 111 | '{resourceCarts}/{cartUuid}/{resourceCartItems}?include={resourceCartItems}', |
||
| 112 | [ |
||
| 113 | 'resourceCarts' => CartsRestApiConfig::RESOURCE_CARTS, |
||
| 114 | 'cartUuid' => $quoteUuid, |
||
| 115 | 'resourceCartItems' => CartsRestApiConfig::RESOURCE_CART_ITEMS, |
||
| 116 | ], |
||
| 117 | ), |
||
| 118 | [ |
||
| 119 | 'data' => [ |
||
| 120 | 'type' => CartsRestApiConfig::RESOURCE_CART_ITEMS, |
||
| 121 | 'attributes' => [ |
||
| 122 | 'sku' => $productConcreteSku, |
||
| 123 | 'quantity' => 1, |
||
| 124 | 'productConfigurationInstance' => $this->fixtures::PRODUCT_CONFIGURATION_CART_ITEM_DATA, |
||
| 125 | ], |
||
| 126 | ], |
||
| 127 | ], |
||
| 128 | ); |
||
| 129 | |||
| 130 | // Assert |
||
| 131 | $I->seeResponseCodeIs(HttpCode::CREATED); |
||
| 132 | $I->seeResponseMatchesOpenApiSchema(); |
||
| 133 | |||
| 134 | $I->amSure('Returned resource has correct id') |
||
| 135 | ->whenI() |
||
| 136 | ->seeSingleResourceIdEqualTo($quoteUuid); |
||
| 137 | |||
| 138 | $I->amSure(sprintf('Returned resource is of type %s', CartsRestApiConfig::RESOURCE_CARTS)) |
||
| 139 | ->whenI() |
||
| 140 | ->seeResponseDataContainsSingleResourceOfType(CartsRestApiConfig::RESOURCE_CARTS); |
||
| 141 | |||
| 142 | $I->amSure('Returned resource has include of type items') |
||
| 143 | ->whenI() |
||
| 144 | ->seeIncludesContainResourceOfType(CartsRestApiConfig::RESOURCE_CART_ITEMS); |
||
| 145 | |||
| 146 | $I->amSure('Included resource has product configuration instance') |
||
| 147 | ->whenI() |
||
| 148 | ->seeCartItemContainsProductConfigurationInstance( |
||
| 149 | CartsRestApiConfig::RESOURCE_CART_ITEMS, |
||
| 150 | $productConcreteSku, |
||
| 151 | ); |
||
| 152 | |||
| 153 | $I->seeSingleResourceHasSelfLink( |
||
| 154 | $I->formatFullUrl( |
||
| 155 | '{resourceCarts}/{cartUuid}', |
||
| 156 | [ |
||
| 157 | 'resourceCarts' => CartsRestApiConfig::RESOURCE_CARTS, |
||
| 158 | 'cartUuid' => $I->getDataFromResponseByJsonPath('$.data')['id'], |
||
| 159 | ], |
||
| 204 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths