[Behat] Enable API managing promotions suite

This commit is contained in:
Rafikooo 2024-07-24 13:53:27 +02:00 committed by Kamil Grygierzec
parent 33050b7e8e
commit 96284ee77e
No known key found for this signature in database
GPG key ID: 7F54EE42DAD4B9E9
4 changed files with 14 additions and 17 deletions

View file

@ -19,7 +19,6 @@ use Sylius\Behat\Client\ApiClientInterface;
use Sylius\Behat\Client\ResponseCheckerInterface;
use Sylius\Behat\Context\Api\Admin\Helper\ValidationTrait;
use Sylius\Behat\Context\Api\Resources;
use Sylius\Behat\Service\Converter\SectionAwareIriConverterInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\PromotionInterface;
@ -38,7 +37,7 @@ use Sylius\Component\Promotion\Checker\Rule\ItemTotalRuleChecker;
use Symfony\Component\HttpFoundation\Request;
use Webmozart\Assert\Assert;
final class ManagingPromotionsContext implements Context
final readonly class ManagingPromotionsContext implements Context
{
use ValidationTrait;
@ -46,7 +45,6 @@ final class ManagingPromotionsContext implements Context
private ApiClientInterface $client,
private ResponseCheckerInterface $responseChecker,
private IriConverterInterface $iriConverter,
private SectionAwareIriConverterInterface $sectionAwareIriConverter,
) {
}
@ -161,7 +159,7 @@ final class ManagingPromotionsContext implements Context
*/
public function iMakeItApplicableForTheChannel(ChannelInterface $channel): void
{
$this->client->addRequestData('channels', [$this->iriConverter->getIriFromItem($channel)]);
$this->client->addRequestData('channels', [$this->iriConverter->getIriFromResource($channel)]);
}
/**
@ -640,7 +638,7 @@ final class ManagingPromotionsContext implements Context
$this->responseChecker->hasValueInCollection(
$this->client->show(Resources::PROMOTIONS, $promotion->getCode()),
'channels',
$this->sectionAwareIriConverter->getIriFromResourceInSection($channel, 'admin'),
$this->iriConverter->getIriFromResource($channel),
),
);
}

View file

@ -20,7 +20,7 @@ use Sylius\Behat\Context\Api\Resources;
use Sylius\Component\Core\Model\ProductInterface;
use Webmozart\Assert\Assert;
final class RemovingProductContext implements Context
final readonly class RemovingProductContext implements Context
{
public function __construct(
private ApiClientInterface $client,

View file

@ -243,22 +243,21 @@
<argument type="service" id="sylius.behat.shared_storage" />
</service>
<!-- <service id="Sylius\Behat\Context\Api\Admin\RemovingProductContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- </service>-->
<service id="Sylius\Behat\Context\Api\Admin\RemovingProductContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<service id="Sylius\Behat\Context\Api\Admin\RemovingTaxonContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
</service>
<!-- <service id="sylius.behat.context.api.admin.managing_promotions" class="Sylius\Behat\Context\Api\Admin\ManagingPromotionsContext">-->
<!-- <argument type="service" id="sylius.behat.api_platform_client.admin" />-->
<!-- <argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />-->
<!-- <argument type="service" id="api_platform.iri_converter" />-->
<!-- <argument type="service" id="sylius.behat.section_iri_converter" />-->
<!-- </service>-->
<service id="sylius.behat.context.api.admin.managing_promotions" class="Sylius\Behat\Context\Api\Admin\ManagingPromotionsContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
<argument type="service" id="api_platform.iri_converter" />
</service>
<service id="sylius.behat.context.api.admin.managing_catalog_promotions" class="Sylius\Behat\Context\Api\Admin\ManagingCatalogPromotionsContext">
<argument type="service" id="sylius.behat.api_platform_client.admin" />

View file

@ -53,7 +53,7 @@ imports:
# - api/promotion/applying_promotion_rules.yml
- api/promotion/managing_catalog_promotions.yml
- api/promotion/managing_promotion_coupons.yml
# - api/promotion/managing_promotions.yml
- api/promotion/managing_promotions.yml
# - api/promotion/receiving_discount.yml
- api/promotion/removing_catalog_promotions.yml
# - api/shipping/applying_shipping_method_rules.yml TODO: Enable after making checkout resource available in API