mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 01:20:59 +00:00
[Unit] Add product option shop tests
This commit is contained in:
parent
230e03e13c
commit
cff4e4a428
4 changed files with 20 additions and 65 deletions
|
|
@ -1,12 +1,21 @@
|
|||
{
|
||||
"@context": "\/api\/v2\/contexts\/ProductOption",
|
||||
"@id": "\/api\/v2\/shop\/product-options\/COLOR",
|
||||
"@type": "ProductOption",
|
||||
"id": "@integer@",
|
||||
"code": "COLOR",
|
||||
"values": [
|
||||
"\/api\/v2\/shop\/product-option-values\/COLOR_BLUE",
|
||||
"\/api\/v2\/shop\/product-option-values\/COLOR_RED"
|
||||
],
|
||||
"name": "Color"
|
||||
"@context": "\/api\/v2\/contexts\/ProductOption",
|
||||
"@id": "\/api\/v2\/shop\/product-options\/COLOR",
|
||||
"@type": "ProductOption",
|
||||
"code": "COLOR",
|
||||
"values": [
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/product-options\/COLOR\/values\/COLOR_BLUE",
|
||||
"@type": "ProductOptionValue",
|
||||
"code": "COLOR_BLUE",
|
||||
"value": "Blue"
|
||||
},
|
||||
{
|
||||
"@id": "\/api\/v2\/shop\/product-options\/COLOR\/values\/COLOR_RED",
|
||||
"@type": "ProductOptionValue",
|
||||
"code": "COLOR_RED",
|
||||
"value": "Red"
|
||||
}
|
||||
],
|
||||
"name": "Color"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"@context": "\/api\/v2\/contexts\/ProductOptionValue",
|
||||
"@id": "\/api\/v2\/shop\/product-option-values\/COLOR_RED",
|
||||
"@type": "ProductOptionValue",
|
||||
"id": "@integer@",
|
||||
"code": "COLOR_RED",
|
||||
"option": "\/api\/v2\/shop\/product-options\/COLOR",
|
||||
"value": "Red"
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<?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\ProductOptionValueInterface;
|
||||
use Sylius\Tests\Api\JsonApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ProductOptionValuesTest extends JsonApiTestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_gets_product_option_value(): void
|
||||
{
|
||||
$fixtures = $this->loadFixturesFromFiles([
|
||||
'channel.yaml',
|
||||
'product/product_option.yaml',
|
||||
]);
|
||||
|
||||
/** @var ProductOptionValueInterface $productOptionValue */
|
||||
$productOptionValue = $fixtures['product_option_value_color_red'];
|
||||
|
||||
$this->client->request(
|
||||
method: 'GET',
|
||||
uri: sprintf('/api/v2/shop/product-option-values/%s', $productOptionValue->getCode()),
|
||||
server: self::CONTENT_TYPE_HEADER,
|
||||
);
|
||||
|
||||
$this->assertResponse(
|
||||
$this->client->getResponse(),
|
||||
'shop/product_option/get_product_option_value',
|
||||
Response::HTTP_OK,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ namespace Sylius\Tests\Api\Shop;
|
|||
|
||||
use Sylius\Tests\Api\JsonApiTestCase;
|
||||
|
||||
final class ProductOptionTest extends JsonApiTestCase
|
||||
final class ProductOptionsTest extends JsonApiTestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_returns_product_option(): void
|
||||
Loading…
Add table
Reference in a new issue