[Unit] Test getting collection of orders filtered by many currencies in admin context

This commit is contained in:
Rafikooo 2024-02-27 01:35:59 +01:00
parent 50c9820521
commit d04a63ab7a
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B
3 changed files with 402 additions and 1 deletions

View file

@ -89,7 +89,7 @@ final class OrdersTest extends JsonApiTestCase
'channel.yaml',
'order/customer.yaml',
'order/new.yaml',
'order/new_in_polish_currency.yaml',
'order/new_in_different_currencies.yaml',
]);
$this->getOrdersByCurrencyCodes('PLN');
@ -107,6 +107,14 @@ final class OrdersTest extends JsonApiTestCase
'admin/order/get_orders_filtered_by_usd_currency_code_response',
Response::HTTP_OK,
);
$this->getOrdersByCurrencyCodes('PLN', 'USD');
$this->assertResponse(
$this->client->getResponse(),
'admin/order/get_orders_filtered_by_pln_and_usd_currency_codes_response',
Response::HTTP_OK,
);
}
/** @test */

View file

@ -23,6 +23,18 @@ Sylius\Component\Core\Model\Order:
customer: "@customer_dave"
billingAddress: "@polish_currency_second_order_billing_address"
shippingAddress: "@polish_currency_second_order_shipping_address"
new_order_in_channel_mobile_in_euro_currency:
channel: "@channel_mobile"
currencyCode: "EUR"
localeCode: "en_US"
state: "new"
paymentState: "paid"
shippingState: "ready"
checkoutState: "completed"
tokenValue: "euroCurrencyToken"
customer: "@customer_dave"
billingAddress: "@euro_currency_order_billing_address"
shippingAddress: "@euro_currency_order_shipping_address"
Sylius\Component\Core\Model\Address:
polish_currency_first_order_billing_address:
@ -61,6 +73,30 @@ Sylius\Component\Core\Model\Address:
phoneNumber: "111999222"
provinceCode: "PL-PL"
provinceName: "kujawsko-pomorskie"
euro_currency_order_shipping_address:
customer: "@customer_dave"
firstName: "Andrzej"
lastName: "Legs"
company: "Polmotors manufactory"
street: "Moniuszki 16/20"
countryCode: "PL"
city: "Pabianice"
postcode: "31-999"
phoneNumber: "111999222"
provinceCode: "PL-PL"
provinceName: "kujawsko-pomorskie"
euro_currency_order_billing_address:
customer: "@customer_dave"
firstName: "Andrzej"
lastName: "Legs"
company: "Polmotors office"
street: "Moniuszki 16/20"
countryCode: "PL"
city: "Pabianice"
postcode: "31-999"
phoneNumber: "111999222"
provinceCode: "PL-PL"
provinceName: "kujawsko-pomorskie"
polish_currency_second_order_shipping_address:
customer: "@customer_dave"
firstName: "Andrzej"

View file

@ -0,0 +1,357 @@
{
"@context": "\/api\/v2\/contexts\/Order",
"@id": "\/api\/v2\/admin\/orders",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "\/api\/v2\/admin\/orders\/polishCurrencyFirstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors manufactory",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
"localeCode": "en_US",
"checkoutState": "completed",
"paymentState": "paid",
"shippingState": "ready",
"tokenValue": "polishCurrencyFirstToken",
"id": @integer@,
"items": [],
"itemsTotal": 0,
"total": 0,
"state": "new",
"itemsSubtotal": 0,
"taxTotal": 0,
"shippingTaxTotal": 0,
"taxExcludedTotal": 0,
"taxIncludedTotal": 0,
"shippingTotal": 0,
"orderPromotionTotal": 0,
"shippingPromotionTotal": 0
},
{
"@id": "\/api\/v2\/admin\/orders\/polishCurrencySecondToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors manufactory",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "PLN",
"localeCode": "en_US",
"checkoutState": "completed",
"paymentState": "paid",
"shippingState": "ready",
"tokenValue": "polishCurrencySecondToken",
"id": @integer@,
"items": [],
"itemsTotal": 0,
"total": 0,
"state": "new",
"itemsSubtotal": 0,
"taxTotal": 0,
"shippingTaxTotal": 0,
"taxExcludedTotal": 0,
"taxIncludedTotal": 0,
"shippingTotal": 0,
"orderPromotionTotal": 0,
"shippingPromotionTotal": 0
},
{
"@id": "\/api\/v2\/admin\/orders\/firstToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/WEB",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors manufactory",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
"localeCode": "en_US",
"checkoutState": "completed",
"paymentState": "paid",
"shippingState": "ready",
"tokenValue": "firstToken",
"id": @integer@,
"items": [],
"itemsTotal": 0,
"total": 0,
"state": "new",
"itemsSubtotal": 0,
"taxTotal": 0,
"shippingTaxTotal": 0,
"taxExcludedTotal": 0,
"taxIncludedTotal": 0,
"shippingTotal": 0,
"orderPromotionTotal": 0,
"shippingPromotionTotal": 0
},
{
"@id": "\/api\/v2\/admin\/orders\/secondToken",
"@type": "Order",
"customer": "\/api\/v2\/admin\/customers\/@integer@",
"channel": "\/api\/v2\/admin\/channels\/MOBILE",
"billingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors office",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"shippingAddress": {
"@id": "\/api\/v2\/admin\/addresses\/@integer@",
"@type": "Address",
"firstName": "Andrzej",
"lastName": "Legs",
"phoneNumber": "111999222",
"company": "Polmotors manufactory",
"countryCode": "PL",
"provinceName": "kujawsko-pomorskie",
"street": "Moniuszki 16\/20",
"city": "Pabianice",
"postcode": "31-999"
},
"payments": [],
"shipments": [],
"currencyCode": "USD",
"localeCode": "en_US",
"checkoutState": "completed",
"paymentState": "paid",
"shippingState": "ready",
"tokenValue": "secondToken",
"id": @integer@,
"items": [],
"itemsTotal": 0,
"total": 0,
"state": "new",
"itemsSubtotal": 0,
"taxTotal": 0,
"shippingTaxTotal": 0,
"taxExcludedTotal": 0,
"taxIncludedTotal": 0,
"shippingTotal": 0,
"orderPromotionTotal": 0,
"shippingPromotionTotal": 0
}
],
"hydra:totalItems": 4,
"hydra:view": {
"@id": "\/api\/v2\/admin\/orders?currencyCode%5B%5D=PLN&currencyCode%5B%5D=USD",
"@type": "hydra:PartialCollectionView"
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "\/api\/v2\/admin\/orders{?channel.code,currencyCode,currencyCode[],customer.id,customer.id[],checkoutCompletedAt[before],checkoutCompletedAt[strictly_before],checkoutCompletedAt[after],checkoutCompletedAt[strictly_after],order[number],items.productName,items.productName[],shipments.method.code,shipments.method.code[],total[between],total[gt],total[gte],total[lt],total[lte],items.variant.translations.name,items.variant.translations.name[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
"@type": "IriTemplateMapping",
"variable": "channel.code",
"property": "channel.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "currencyCode",
"property": "currencyCode",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "currencyCode[]",
"property": "currencyCode",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "customer.id",
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "customer.id[]",
"property": "customer.id",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_before]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "checkoutCompletedAt[strictly_after]",
"property": "checkoutCompletedAt",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "order[number]",
"property": "number",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName",
"property": "items.productName",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.productName[]",
"property": "items.productName",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "shipments.method.code",
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "shipments.method.code[]",
"property": "shipments.method.code",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[between]",
"property": "total",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[gt]",
"property": "total",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[gte]",
"property": "total",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[lt]",
"property": "total",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "total[lte]",
"property": "total",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name",
"property": "items.variant.translations.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "items.variant.translations.name[]",
"property": "items.variant.translations.name",
"required": false
}
]
}
}