mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
* 2.0: (776 commits) Add missing validation for the customers first and last name [CS][DX] Refactor Bring back all Sylius' state machines to Winzou Add overriding the Resource's state machine with the one from the Sylius abstraction Add missing locales to contract test [Taxon][Behat] validate translations with unexisting locales [ShippingMethod][Behat] validate translations with unexisting locales [Promotion][Behat] validate translations with unexisting locales [Product][Behat] validate translations with unexisting locales [PaymentMethod][Behat] validate translations with unexisting locales Validate all translatable objects for unexisiting locales Validate customer's password reset Validate customer creation and edit Make the validation trait more generic [Api] Change namespace of TaxonImagesTest class [Api] Remove _response suffix [Behat] Minor improvments of viewing_taxon_image scenario [Api][ProductImage] Add https prefix check [Api][Admin] Allow using float for ratio in exchange rate SYL-3329 Fix behat test for SyliusPayPalPlugin ...
57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Sylius package.
|
|
*
|
|
* (c) Sylius Sp. z o.o.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Sylius\Tests\Api\Shop;
|
|
|
|
use Sylius\Component\Product\Model\ProductAssociationInterface;
|
|
use Sylius\Tests\Api\JsonApiTestCase;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
final class ProductAssociationsTest extends JsonApiTestCase
|
|
{
|
|
/** @test */
|
|
public function it_gets_product_association(): void
|
|
{
|
|
$fixtures = $this->loadFixturesFromFile('product/product_with_many_locales.yaml');
|
|
|
|
/** @var ProductAssociationInterface $association */
|
|
$association = $fixtures['product_association'];
|
|
$this->client->request(
|
|
method: 'GET',
|
|
uri: sprintf('/api/v2/shop/product-associations/%s', $association->getId()),
|
|
server: self::CONTENT_TYPE_HEADER,
|
|
);
|
|
|
|
$this->assertResponse(
|
|
$this->client->getResponse(),
|
|
'shop/product_association/get_product_association_response',
|
|
Response::HTTP_OK,
|
|
);
|
|
}
|
|
|
|
/** @test */
|
|
public function it_returns_nothing_if_association_not_found(): void
|
|
{
|
|
$this->loadFixturesFromFile('product/product_with_many_locales.yaml');
|
|
|
|
$this->client->request(
|
|
method: 'GET',
|
|
uri: sprintf('/api/v2/shop/product-associations/%s', 'wrong input'),
|
|
server: self::CONTENT_TYPE_HEADER,
|
|
);
|
|
|
|
$response = $this->client->getResponse();
|
|
|
|
$this->assertSame(Response::HTTP_NOT_FOUND, $response->getStatusCode());
|
|
}
|
|
}
|