Skip to content

Commit

Permalink
Fix issues in configuration and failing behat
Browse files Browse the repository at this point in the history
  • Loading branch information
arti0090 committed Apr 29, 2021
1 parent 08cc365 commit 786a7d6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ and field name as a field that will be transformed from IRI to `code`/`id`. All
<argument key="Sylius\Bundle\ApiBundle\Command\AddProductReview">product</argument>
<argument key="Sylius\Bundle\ApiBundle\Command\Checkout\ChoosePaymentMethod">paymentMethod</argument>
<argument key="Sylius\Bundle\ApiBundle\Command\Account\ChangePaymentMethod">paymentMethod</argument>
<argument key="NewCommandFQCN">NewCommandFieldName</argument><-- Example -->
<argument key="NewCommandFQCN">NewCommandFieldName</argument>
</argument>
</service>
````
Expand Down
16 changes: 10 additions & 6 deletions src/Sylius/Behat/Context/Api/Shop/CartContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function iAddThisProductWithToTheCart(

Assert::same($variantsData['hydra:totalItems'], 1);

$variantIri = $variantsData['hydra:member'][0]['@id'];
$variantIri = $variantsData['@id'].'/'.$variantsData['hydra:member'][0]['code'];
}
}

Expand Down Expand Up @@ -215,11 +215,11 @@ public function iRemoveProductFromTheCart(ProductInterface $product, string $tok

/**
* @When I pick up my cart (again)
* @When I pick up cart in the :localeCode locale
* @When I pick up cart in the :locale locale
*/
public function iPickUpMyCart(?string $localeCode = null): void
public function iPickUpMyCart(?LocaleInterface $locale = null): void
{
$this->pickupCart($localeCode);
$this->pickupCart($locale);
}

/**
Expand Down Expand Up @@ -537,10 +537,14 @@ public function thisItemShouldHaveOptionValue(ProductInterface $product, string
throw new \DomainException(sprintf('Could not find item with option "%s" set to "%s"', $optionName, $optionValue));
}

private function pickupCart(?string $localeCode = null): string
private function pickupCart(?LocaleInterface $locale = null): string
{
$this->cartsClient->buildCreateRequest();
$this->cartsClient->addRequestData('locale', $localeCode);
$this->cartsClient->addRequestData('locale', null);
if ($locale !== null) {
$this->cartsClient->addRequestData('locale', $this->iriConverter->getIriFromItem($locale));
}

$tokenValue = $this->responseChecker->getValue($this->cartsClient->create(), 'tokenValue');

$this->sharedStorage->set('cart_token', $tokenValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.locale.class%" shortName="Locale">
<attribute name="route_prefix">admin</attribute>

<attribute name="validation_groups">sylius</attribute>

<collectionOperations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<attribute>sylius.api.product_variant_option_value_filter</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">admin:product_variant:read</attribute>
<attribute name="groups">shop:product_variant:read</attribute>
</attribute>
</collectionOperation>
</collectionOperations>
Expand Down

0 comments on commit 786a7d6

Please sign in to comment.