lchrusciel / apitestcase Goto Github PK
View Code? Open in Web Editor NEWHandy PHPUnit test case for testing JSON APIs in your Symfony applications.
License: MIT License
Handy PHPUnit test case for testing JSON APIs in your Symfony applications.
License: MIT License
It is about time to finally publish a stable release of this library. Because I'm really into merging some of awaiting PR's I have decide to publish an alpha version, to encourage us to finish them. I would like to publish a new version every week, until we reach a stable phase.
Between alpha1 and alpha2 I would like to merge #63, extract warning from #43 and maybe also add #52. Changes proposed in #60 could be added without BC Brakes so we can add them later.
Of course if there would be any further problems in a mean time, new versions could be added to this release cycle.
As Lakion seems inactive, what is the status of this project now and for the future?
Hi @lchrusciel !
What is the status of this package? Is it abandoned or would you be okay with allowing PHP 8.0 and releasing a new minor version?
This probably needs a look into dependencies and their support for PHP 8.0.
Thanks!
Using PHPUnit 9.1.5 I'm seeing this deprecation notice on every run.
Other deprecation notices (1)
1x: The "PHPUnit\Framework\TestCase::__construct()" method is considered internal This method is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not extend it from "ApiTestCase\ApiTestCase".
I haven't got a proposed fix, I mean what you do in the constructor seems sensible 🤷♂️
Whenever I run tests using ApiTestCase, PHPUnit gives the following depreciation notices:
Accessing Doctrine\Common\Lexer\Token properties via ArrayAccess is deprecated, use the value, type or position property instead (Token.php:108 called by Parser.php:69, https://github.com/doctrine/lexer/pull/79, package doctrine/lexer)
While it's not currently a breaking bug, I'm afraid it might completely break tests once Doctrine completely removes the possibility to access Token properties via ArrayAccess.
Every time test case fails, it's massive PITA to figure out which field is actually different when using @integer@
notations, because during diffs (which is triggered on failure only) it uses them as literals. So output is like following. So bad in figuring out what is actually different:
@@ -1,51 +1,51 @@
{
- "id": @integer@,
+ "id": 3,
"method": {
"name": "MangoPay Credit Card",
- "id": @integer@,
+ "id": 1,
"code": "mangopay_credit_card",
- "position": @integer@,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "position": 0,
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
},
- "amount": @integer@,
+ "amount": 1490,
"state": "failed",
"details": {
- "id": @string@,
+ "resultCode": "101304",
+ "resultMessage": "Secure mode: The 3DSecure authentication session has expired",
"status": "FAILED",
- "resultCode": "101304",
- "resultMessage": "Secure mode: The 3DSecure authentication session has expired"
+ "id": "1234567"
},
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"order": {
- "id": @integer@,
+ "id": 3,
"checkoutCompletedAt": null,
"number": null,
"items": [
{
- "id": @integer@,
- "quantity": @integer@,
- "unitPrice": @integer@,
- "total": @integer@,
+ "id": 6,
+ "quantity": 1,
+ "unitPrice": 8099,
+ "total": 8099,
"units": [
{
- "id": @integer@,
+ "id": 18,
"orderItem": null,
"adjustments": [],
- "adjustmentsTotal": @integer@,
+ "adjustmentsTotal": 0,
"shipment": null,
"returnState": null
}
],
- "unitsTotal": @integer@,
+ "unitsTotal": 8099,
"adjustments": [],
- "adjustmentsTotal": @integer@,
+ "adjustmentsTotal": 0,
"product": {
"name": "Jean Paul Gaultier Le Male",
"description": "ean Paul Gaultier pays tribute to a symbolic figure who has long been a source of inspiration for him: the sailor. Le Male, as virile as it is sexy, is a fragrance which offers a nonconformist view of masculinity… a reassuring fragrance with an extremely modern trail. Lavender, evoking the familiar, comforting scent of shaving soap, is enhanced by the sensuality of vanilla.\n",
@@ -53,12 +53,12 @@
{
"name": "Mug 5",
"descriptor": "Mug 5 (GAULTIER_LE_MALE)",
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER_LE_MALE",
"optionValues": [],
- "position": @integer@,
- "onHold": @integer@,
- "onHand": @integer@,
+ "position": 0,
+ "onHold": 31,
+ "onHand": 2806,
"tracked": true,
"channelPricings": {
"EUR": {
@@ -73,9 +73,10 @@
}
},
"shippingRequired": true,
- "buyableStock": @integer@,
+ "buyableStock": 2775,
"sizeValue": null,
"colorValue": null,
+ "isolatedPreviewImage": null,
"previewImage": null,
"designer": {
"billingAddress": {
@@ -86,7 +87,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -95,44 +96,43 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"sku": null,
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
}
},
"priceLocalized": "72,95 €",
- "originalPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
+ "originalPriceLocalized": "72,95 €"
}
],
"slug": "gaultier-le-male",
"options": [],
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER-LE-MALE",
"attributes": [],
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2013-10-10T08:26:00+02:00",
+ "updatedAt": "2015-10-05T08:26:00+02:00",
"enabled": true,
"productTaxons": [],
"mainTaxon": null,
"images": [],
"similarProducts": [],
+ "isolatedPreviewImage": null,
"previewImage": null,
"size": null,
"color": null,
- "topics": [],
"designer": {
"billingAddress": {
"addressLine1": "Street 2",
@@ -142,7 +142,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -151,35 +151,34 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
},
"variants": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/"
}
},
"lowestPriceLocalized": "72,95 €",
- "originalLowestPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
+ "originalLowestPriceLocalized": "72,95 €"
},
"variant": {
"name": "Mug 5",
"descriptor": "Mug 5 (GAULTIER_LE_MALE)",
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER_LE_MALE",
"optionValues": [],
- "position": @integer@,
- "onHold": @integer@,
- "onHand": @integer@,
+ "position": 0,
+ "onHold": 31,
+ "onHand": 2806,
"tracked": true,
"channelPricings": {
"EUR": {
@@ -194,9 +193,10 @@
}
},
"shippingRequired": true,
- "buyableStock": @integer@,
+ "buyableStock": 2775,
"sizeValue": null,
"colorValue": null,
+ "isolatedPreviewImage": null,
"previewImage": null,
"designer": {
"billingAddress": {
@@ -207,7 +207,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -216,76 +216,75 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"sku": null,
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
}
},
"priceLocalized": "72,95 €",
- "originalPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
+ "originalPriceLocalized": "72,95 €"
},
- "returnableUnitCount": @integer@,
+ "returnableUnitCount": 1,
"affiliateBlogger": null,
"hash": null,
"_links": {
"order": {
- "href": @string@
+ "href": "/api/v1/orders/3"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
},
"variant": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
}
},
"totalLocalized": "80,99 $",
"unitPriceLocalized": "80,99 $"
}
],
- "itemsTotal": @integer@,
+ "itemsTotal": 8099,
"adjustments": [],
- "adjustmentsTotal": @integer@,
- "total": @integer@,
+ "adjustmentsTotal": 0,
+ "total": 8099,
"state": "new",
"customer": {
- "id": @integer@,
+ "id": 6,
"communityReferenceId": "591af0b9e966af744602c55f",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/customers/6"
}
}
},
"channel": {
- "id": @integer@,
+ "id": 2,
"code": "USD",
"name": "USD Channel",
"description": "Lorem ipsum",
"hostname": "localhost",
"color": "red",
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
"baseCurrencyCode": "USD",
- "baseCurrencyMinAmount": @integer@,
- "baseCurrencyMaxAmount": @integer@,
+ "baseCurrencyMinAmount": 10,
+ "baseCurrencyMaxAmount": 133700,
"taxCalculationStrategy": "order_items_based",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/channels/USD"
}
}
},
@@ -294,36 +293,36 @@
"payments": [
null,
{
- "id": @integer@,
+ "id": 6,
"method": {
"name": "MangoPay Credit Card",
- "id": @integer@,
+ "id": 1,
"code": "mangopay_credit_card",
- "position": @integer@,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "position": 0,
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
},
- "amount": @integer@,
+ "amount": 8099,
"state": "new",
"details": [],
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"order": null,
"methodDetails": [],
"_links": {
"order": {
- "href": @string@
+ "href": "/api/v1/orders/3"
},
"self": {
- "href": @string@
+ "href": "/api/v1/payments/6"
},
"payment-method": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
}
@@ -339,59 +338,59 @@
"billingAddress": null,
"shippingAddress": null,
"checkoutCompletedAt": null,
- "cancellableAt": "@[email protected]()",
+ "cancellableAt": "2020-01-14T15:56:51+01:00",
"paymentCompletedAt": null,
"customer": {
- "id": @integer@,
+ "id": 6,
"communityReferenceId": "591af0b9e966af744602c55f",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/customers/6"
}
}
},
"deliveryUntil": null,
- "estimatedDeliveryUntil": "@[email protected]()",
+ "estimatedDeliveryUntil": "2020-01-31T15:57:52+01:00",
"deliveryUntilOverdue": false,
"number": null,
"payments": [
null,
{
- "id": @integer@,
+ "id": 6,
"method": {
"name": "MangoPay Credit Card",
- "id": @integer@,
+ "id": 1,
"code": "mangopay_credit_card",
- "position": @integer@,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "position": 0,
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
},
- "amount": @integer@,
+ "amount": 8099,
"state": "new",
"details": [],
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"order": null,
"methodDetails": [],
"_links": {
"order": {
- "href": @string@
+ "href": "/api/v1/orders/3"
},
"self": {
- "href": @string@
+ "href": "/api/v1/payments/6"
},
"payment-method": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
}
],
- "shippedUnitCount": @integer@,
+ "shippedUnitCount": 0,
"paymentState": "awaiting_payment",
"state": "new",
"currencyCode": "USD",
@@ -405,7 +404,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -414,33 +413,33 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"items": [
{
- "id": @integer@,
- "quantity": @integer@,
- "unitPrice": @integer@,
- "total": @integer@,
+ "id": 6,
+ "quantity": 1,
+ "unitPrice": 8099,
+ "total": 8099,
"units": [
{
- "id": @integer@,
+ "id": 18,
"orderItem": null,
"adjustments": [],
- "adjustmentsTotal": @integer@,
+ "adjustmentsTotal": 0,
"shipment": null,
"returnState": null
}
],
- "unitsTotal": @integer@,
+ "unitsTotal": 8099,
"adjustments": [],
- "adjustmentsTotal": @integer@,
+ "adjustmentsTotal": 0,
"product": {
"name": "Jean Paul Gaultier Le Male",
"description": "ean Paul Gaultier pays tribute to a symbolic figure who has long been a source of inspiration for him: the sailor. Le Male, as virile as it is sexy, is a fragrance which offers a nonconformist view of masculinity… a reassuring fragrance with an extremely modern trail. Lavender, evoking the familiar, comforting scent of shaving soap, is enhanced by the sensuality of vanilla.\n",
@@ -448,12 +447,12 @@
{
"name": "Mug 5",
"descriptor": "Mug 5 (GAULTIER_LE_MALE)",
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER_LE_MALE",
"optionValues": [],
- "position": @integer@,
- "onHold": @integer@,
- "onHand": @integer@,
+ "position": 0,
+ "onHold": 31,
+ "onHand": 2806,
"tracked": true,
"channelPricings": {
"EUR": {
@@ -468,9 +467,10 @@
}
},
"shippingRequired": true,
- "buyableStock": @integer@,
+ "buyableStock": 2775,
"sizeValue": null,
"colorValue": null,
+ "isolatedPreviewImage": null,
"previewImage": null,
"designer": {
"billingAddress": {
@@ -481,7 +481,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -490,44 +490,43 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"sku": null,
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
}
},
"priceLocalized": "72,95 €",
- "originalPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
+ "originalPriceLocalized": "72,95 €"
}
],
"slug": "gaultier-le-male",
"options": [],
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER-LE-MALE",
"attributes": [],
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2013-10-10T08:26:00+02:00",
+ "updatedAt": "2015-10-05T08:26:00+02:00",
"enabled": true,
"productTaxons": [],
"mainTaxon": null,
"images": [],
"similarProducts": [],
+ "isolatedPreviewImage": null,
"previewImage": null,
"size": null,
"color": null,
- "topics": [],
"designer": {
"billingAddress": {
"addressLine1": "Street 2",
@@ -537,7 +536,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -546,35 +545,34 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
},
"variants": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/"
}
},
"lowestPriceLocalized": "72,95 €",
- "originalLowestPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
+ "originalLowestPriceLocalized": "72,95 €"
},
"variant": {
"name": "Mug 5",
"descriptor": "Mug 5 (GAULTIER_LE_MALE)",
- "id": @integer@,
+ "id": 5,
"code": "GAULTIER_LE_MALE",
"optionValues": [],
- "position": @integer@,
- "onHold": @integer@,
- "onHand": @integer@,
+ "position": 0,
+ "onHold": 31,
+ "onHand": 2806,
"tracked": true,
"channelPricings": {
"EUR": {
@@ -589,9 +587,10 @@
}
},
"shippingRequired": true,
- "buyableStock": @integer@,
+ "buyableStock": 2775,
"sizeValue": null,
"colorValue": null,
+ "isolatedPreviewImage": null,
"previewImage": null,
"designer": {
"billingAddress": {
@@ -602,7 +601,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -611,46 +610,45 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
},
"sku": null,
"_links": {
"self": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
}
},
"priceLocalized": "72,95 €",
- "originalPriceLocalized": "72,95 €",
- "isolatedPreviewImage": null
- },
- "returnableUnitCount": @integer@,
+ "originalPriceLocalized": "72,95 €"
+ },
+ "returnableUnitCount": 1,
"affiliateBlogger": null,
"hash": null,
"_links": {
"order": {
- "href": @string@
+ "href": "/api/v1/orders/3"
},
"product": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE"
},
"variant": {
- "href": @string@
+ "href": "/api/v1/products/GAULTIER-LE-MALE/variants/GAULTIER_LE_MALE"
}
},
"totalLocalized": "80,99 $",
"unitPriceLocalized": "80,99 $"
}
],
- "itemsTotal": @integer@,
+ "itemsTotal": 8099,
"shippingState": "ready",
"shipments": [],
"totalLocalized": "80,99 $"
@@ -666,7 +664,7 @@
"region": null,
"country": "FR"
},
- "id": @string@,
+ "id": "0123456789abcdef76543210",
"name": "Jean-Paul Gaultier",
"canonicalName": "jean-paulgaultier",
"displayName": "Jean-Paul Gaultier",
@@ -675,21 +673,21 @@
"hasAvatar": false,
"vatRegistrationNumber": "VAT1338",
"taxIdentificationNumber": null,
- "createdAt": "@[email protected]()",
- "updatedAt": "@[email protected]()",
+ "createdAt": "2020-01-14T15:57:51+01:00",
+ "updatedAt": "2020-01-14T15:57:51+01:00",
"enabled": true,
- "shippingOthersMaxDeliveryDays": @integer@,
+ "shippingOthersMaxDeliveryDays": 17,
"shippingOriginCountry": "FR",
- "shippingOriginMaxDeliveryDays": @integer@,
+ "shippingOriginMaxDeliveryDays": 4,
"type": "designer"
}
],
"paymentCompletedAt": null,
- "cancellableAt": "@[email protected]()",
- "cancellable": true,
- "shippedUnitCount": @integer@,
+ "cancellableAt": "2020-01-14T15:56:51+01:00",
+ "shippedUnitCount": 0,
"shippingState": "ready",
"deliveryUntilOverdue": false,
+ "cancellable": true,
"removedItems": [],
"totalLocalized": "80,99 $",
"limitLocalized": "1.337,00 $",
@@ -698,13 +696,13 @@
"methodDetails": [],
"_links": {
"order": {
- "href": @string@
+ "href": "/api/v1/orders/3"
},
"self": {
- "href": @string@
+ "href": "/api/v1/payments/3"
},
"payment-method": {
- "href": @string@
+ "href": "/api/v1/payment-methods/mangopay_credit_card"
}
}
}
It's a big pain for us with this library. Anything we can do clean output out of false positives?
With ATC 3.0 final, using coduo/php-matcher
3.0 and @[email protected]()
pattern match results in an error, while everything works as expected with ATC 3.0 and PHP Matcher 2.4.
TypeError: Argument 1 passed to Coduo\PHPMatcher\Parser::unexpectedSyntaxError() must be of the type array, null given, called in vendor/coduo/php-matcher/src/Parser.php on line 62
vendor/coduo/php-matcher/src/Parser.php:248
vendor/coduo/php-matcher/src/Parser.php:62
vendor/coduo/php-matcher/src/Parser.php:50
vendor/coduo/php-matcher/src/Parser.php:29
vendor/coduo/php-matcher/src/Matcher/StringMatcher.php:43
vendor/coduo/php-matcher/src/Matcher/ChainMatcher.php:32
vendor/coduo/php-matcher/src/Matcher/ChainMatcher.php:33
vendor/coduo/php-matcher/src/Matcher/ArrayMatcher.php:165
vendor/coduo/php-matcher/src/Matcher/ArrayMatcher.php:88
vendor/coduo/php-matcher/src/Matcher/ArrayMatcher.php:46
vendor/coduo/php-matcher/src/Matcher/ChainMatcher.php:33
vendor/coduo/php-matcher/src/Matcher/JsonMatcher.php:35
vendor/coduo/php-matcher/src/Matcher/ChainMatcher.php:33
vendor/coduo/php-matcher/src/Matcher.php:20
vendor/lakion/api-test-case/src/ApiTestCase.php:206
vendor/lakion/api-test-case/src/JsonApiTestCase.php:80
vendor/lakion/api-test-case/src/JsonApiTestCase.php:59
I'm not sure if this is an issue with PHP Matcher lib or ATC not supporting PHP Matcher 3.0 correctly.
There should be information about an upgrade path to 3.0
Ref. https://github.com/Lakion/ApiTestCase/pull/102/files#diff-98c12a693941ae3c4f50872403416471L5
With api platform, error such as not found or not authorized response has this following content-type: "application/problem+json; charset=utf-8"
assertResponse method fails because of that.
Adding phpunit/phpunit as a dependency is discouraged in favor of Symfony's PHPUnit Bridge.
* Instead:
1. Remove it now: composer remove --dev phpunit/phpunit
2. Use Symfony's bridge: composer require --dev phpunit
Maybe the dependency should be removed, or some Documentation can be added for Symfony users?
Cannot install symfony/maker-bundle:^1.43
because of doctrine/orm
conflict.
Using version ^1.43 for symfony/maker-bundle
./composer.json has been updated
Running composer update symfony/maker-bundle --with-all-dependencies
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "^5.4"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- lchrusciel/api-test-case is locked to version v5.2.0 and an update of this package was not requested.
- symfony/maker-bundle v1.43.0 conflicts with doctrine/orm <2.10.
- lchrusciel/api-test-case v5.2.0 requires doctrine/orm ^2.5 -> satisfiable by doctrine/orm[2.9.6].
- Root composer.json requires symfony/maker-bundle ^1.43 -> satisfiable by symfony/maker-bundle[v1.43.0].
You can also try re-running composer require with an explicit version constraint, e.g. "composer require symfony/maker-bundle:*" to figure out if any version is installable, or "composer require symfony/maker-bundle:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
This is full error while I try to install this package. Do you know how to solve it?
Script cache:clear returned with error code 1
!!
!! In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
!!
!! The service "nelmio_alice.property_accessor.std" has a dependency on a non-
!! existent service "property_accessor". Did you mean this: "nelmio_alice.prop
!! erty_accessor.std"?
!!
!!
!!Script @auto-scripts was called via post-update-cmd
As library supports only PHP7.1 and higher (https://github.com/Lakion/ApiTestCase/blob/master/composer.json#L27), it would be nice to use PHP7.1 features, like return types, scalar type hints etc.
@lchrusciel With version 5.3
came a problem when using @dataProvider
annotation.
App\Tests\Integration\Controller\Authentication\AuthenticationTest::testShopApiIsProtected
ArgumentCountError: Too few arguments to function App\Tests\Integration\Controller\Authentication\AuthenticationTest::testShopApiIsProtected(), 0 passed in /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1608 and exactly 3 expected
The reason for this error is change in commit 602a891 in file ApiTestCase.php
in __construct
method
We should try some tool that will help to maintain clean code base.
Hi,
Is there easy way to use the assert offert by JsonApiTestCase, minely the $this->assertResponse()
In a behat test ?
Thx in advance
RuntimeException: File SyliusShopApiPlugin/tests/Controller/Checkout/../DataFixtures/ORM/shop.yml does not exist
The Checkout
folder should be taken into account when we are determining a folder with fixtures.
I use PHPUnit 8.2, Symfony 4.2 and i have following problem.
[docker-compose://[/home/nikolay/PhpstormProjects/klubok/docker-compose.yml]:php/]:php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=172.17.0.1 /srv/api/vendor/phpunit/phpunit/phpunit --configuration /srv/api/phpunit.xml.dist --filter "/(::testUsersRegisterValidation)( .*)?$/" App\Tests\Functional\Users\RegisterTest /srv/api/tests/functional/Users/RegisterTest.php --teamcity
PHP Fatal error: Uncaught TypeError: Argument 3 passed to ApiTestCase\ApiTestCase::__construct() must be of the type string, int given, called in /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php on line 160 and defined in /srv/api/vendor/lchrusciel/api-test-case/src/ApiTestCase.php:67
Stack trace:
#0 /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php(160): ApiTestCase\ApiTestCase->__construct('testUsersRegist...', Array, 0)
#1 /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php(96): PHPUnit\Framework\TestBuilder->buildDataProviderTestSuite('testUsersRegist...', 'App\\Tests\\Funct...', Array, false, NULL, false, Array)
#2 /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php(732): PHPUnit\Framework\TestBuilder->build(Object(ReflectionClass), 'testUsersRegist...')
#3 /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php(194): PHPUnit\Framework\TestSuite->addTestMethod(Object(ReflectionClass), Object(ReflectionMethod))
#4 /srv/api/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php( in /srv/api/vendor/lchrusciel/api-test-case/src/ApiTestCase.php on line 67
Fatal error: Uncaught TypeError: Argument 3 passed to ApiTestCase\ApiTestCase::__construct() must be of the type string, int given, called in /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php on line 160 and defined in /srv/api/vendor/lchrusciel/api-test-case/src/ApiTestCase.php on line 67
TypeError: Argument 3 passed to ApiTestCase\ApiTestCase::__construct() must be of the type string, int given, called in /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php on line 160 in /srv/api/vendor/lchrusciel/api-test-case/src/ApiTestCase.php on line 67
Call Stack:
0.0523 399432 1. {main}() /srv/api/vendor/phpunit/phpunit/phpunit:0
0.0605 1206136 2. PHPUnit\TextUI\Command::main(???) /srv/api/vendor/phpunit/phpunit/phpunit:61
0.0605 1206248 3. PHPUnit\TextUI\Command->run(???, ???) /srv/api/vendor/phpunit/phpunit/src/TextUI/Command.php:160
0.0834 2118304 4. PHPUnit\TextUI\TestRunner->getTest(???, ???, ???) /srv/api/vendor/phpunit/phpunit/src/TextUI/Command.php:178
0.0901 3300032 5. PHPUnit\Framework\TestSuite->__construct(???, ???) /srv/api/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:124
0.0902 3382184 6. PHPUnit\Framework\TestSuite->addTestMethod(???, ???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php:194
0.0916 3748632 7. PHPUnit\Framework\TestBuilder->build(???, ???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php:732
3.6729 3775632 8. PHPUnit\Framework\TestBuilder->buildDataProviderTestSuite(???, ???, ???, ???, ???, ???, ???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php:96
4.9519 3794704 9. App\Tests\Functional\Users\RegisterTest->__construct(???, ???, ???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestBuilder.php:160
Process finished with exit code 255
Problem is in following:
abstract class ApiTestCase extends WebTestCase
{
public function __construct(?string $name = null, array $data = [], string $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->matcherFactory = new MatcherFactory();
}
}
But please take a look at WebTestCase __construct
abstract class TestCase extends Assert implements SelfDescribing, Test
{
public function __construct($name = null, array $data = [], $dataName = '')
{
// ...
}
}
Check 3d parameter type. It is different. Unfortunatelly, i dont have time to fix it and create PR.
Hi,
I wanted to use hautelook/alice-bundle
, and the different provided Traits, but it has a side effect with ATC because the Symfony's KernelTestCase & WebTestCase classes have been forked. And an exception is thrown (on their side).
I have a (may be stupid) question: why did you fork the Symfony's KernelTestCase & WebTestCase classes? What is the reason behind? I can't see any benefit.
Anyway, thanks a lot for the work, it's a great library :)
Hi
I try to test a simple json, but show up below message, have any idea to figure out that ?
Thanks!
PHPUnit 4.8.22 by Sebastian Bergmann and contributors.
E
Time: 525 ms, Memory: 27.00Mb
There was 1 error:
/Users/xxxx/Documents/www/yyyy/app/bootstrap.php.cache:2214
/Users/xxxx/Documents/www/yyyy/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:182
/Users/xxxx/Documents/www/yyyy/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:192
/Users/xxxx/Documents/www/yyyy/vendor/lakion/api-test-case/src/ApiTestCase.php:112
When you have some base fixtures in base_setup.yml
and you want to reference to one of the instances in there from another fixture file, lets say products.yml
, you get:
UnexpectedValueException: Instance workspace_1 is not defined
I think this is caused by that the loadFixturesFromFile
instantiates a new Alice Loader
every time you load a fixture file (see: https://github.com/Lakion/ApiTestCase/blob/master/src/ApiTestCase.php#L279).
@pjedrzejewski Would it be a good solution if you instantiate the Alice Loader in the setup method, so that the fixture references are preserved when you load multiple fixture files in a single test?
Hey everyone !
I am currently working on a REST api (using symfony + FOSRestBundle). My output is being serialised using JMSSerializer, which by default uses CDATA for escaping content.
The CDATA section apparently cannot be parsed by the diffing mechanism you use.
Example:
1) ControllerTest::testList
"Array(1)" does not match "1".
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<result>
- <items>
- <item>
- <id>1</id>
- <return_id>1</return_id>
- <order_number>1</order_number>
- <return_date>@[email protected]()</return_date>
- <created_at>@[email protected]()</created_at>
- <updated_at>@[email protected]()</updated_at>
- </item>
- </items>
- <count>1</count>
- <total>1</total>
+ <items>
+ <item>
+ <id>1</id>
+ <return_id><![CDATA[1]]></return_id>
+ <order_number><![CDATA[1]]></order_number>
+ <return_date><![CDATA[2017-10-31T00:00:00+0100]]></return_date>
+ <created_at><![CDATA[2017-10-30T15:39:57+0100]]></created_at>
+ <updated_at><![CDATA[2017-10-30T15:39:57+0100]]></updated_at>
+ </item>
+ </items>
+ <count>1</count>
+ <total>1</total>
</result>
Any idea on how to circumvent that ?
Kind regards,
Jan
hi, can you make PolishSymfonyCommunity/SymfonyMockerContainer
optional, seems it is not actively maintained, also it doesn't support Symfony4. it will caused a weird exception when it is used with Symfony 4.2.2, see stopwatch error after updating symfony to v4.2.2 . please consider make is optional.
I send a PR
Mongodb fixtures should be load by fixture loader before tests.
What the title says. Once the shared kernel boots, the configuration for the bundles is not loaded for the test environment. In my particular use case, I'm trying to configure the default purge mode of the fixture loader.
$ composer require --dev lakion/api-test-case
[InvalidArgumentException]
Could not find package lakion/api-test-case at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
It's not possible to use ApiTestCase with the official plugin phpunit/dbunit
Here is why:
ApiTestCase is overloading the tearDown method and altering it's visibility from protected to public.
Doing so will prevent dbunit trait TestCaseTrait from overloading tearDown method. and a fatal exception is fired.
Here is an example of test who won't work :
namespace ApiBundle\Tests\Controller;
use Lakion\ApiTestCase\JsonApiTestCase;
use PHPUnit_Extensions_Database_TestCase_Trait;
class ProductControllerTest extends JsonApiTestCase
{
use PHPUnit_Extensions_Database_TestCase_Trait;
}
The best thing to do is avoiding any overloading.
Currently the builds are stalled (like #179).
You have requested a non-existent service "fidry_alice_data_fixtures.loader.doctrine"
shows up after upgrading from v2 to v3, might be worth to add related info to upgrade file.
It's unable to get package through the composer
Problem 1
- Installation request for lakion/api-test-case ^1.0 -> satisfiable by lakion/api-test-case[v1.0.0].
- Conclusion: remove doctrine/data-fixtures v1.2.2
- Can only install one of: doctrine/data-fixtures[v1.2.2, v1.1.0].
- Can only install one of: doctrine/data-fixtures[v1.1.0, v1.2.2].
- lakion/api-test-case v1.0.0 requires doctrine/data-fixtures ~1.1.0 -> satisfiable by doctrine/data-fixtures[v1.1.0, v1.1.1].
- Conclusion: don't install doctrine/data-fixtures v1.1.1
- Installation request for doctrine/data-fixtures (locked at v1.2.2) -> satisfiable by doctrine/data-fixtures[v1.2.2].
There's any plan of upgrading support of nelmio/alice
to version 3? Has it been studied?
Now I'm getting a lot of deprecation warnings as many of the features I'm using are being dropped in version 3. If you have not taken a look, I can see if it would be easy.
Thanks!
Related lib: https://github.com/phpstan/phpstan
I've seen #82 merged and I wonder if it is really used, I think it should be defined locally inside JsonApiTestCase
/ XmlApiTestCase
.
@lchrusciel Today after updating to the latest Symfony 4.1 I start getting this error in my tests:
Error : Call to undefined method Symfony\Bundle\FrameworkBundle\Test\TestContainer::getMockedServices()
/vendor/lakion/api-test-case/src/ApiTestCase.php:117
Problem related to getting MockedContainer Services for unmocking:
public function tearDown()
{
if (null !== $this->client && null !== $this->client->getContainer()) {
foreach ($this->client->getContainer()->getMockedServices() as $id => $service) {
$this->client->getContainer()->unmock($id);
}
}
\Mockery::close();
$this->client = null;
$this->entityManager = null;
$this->fixtureLoader = null;
parent::tearDown();
}
As symfony update states they have simplified testing container =) So this code should be removed/changed and docs updated.
As temporary solution/workaround until fix would be released create your own TestCase wrapper and override tearDown()
like this:
use Lakion\ApiTestCase\JsonApiTestCase;
/**
* TestCase wrapper.
*/
class TestCase extends JsonApiTestCase
{
public function tearDown()
{
\Mockery::close();
$this->client = null;
static::ensureKernelShutdown();
}
}
Hi, when doing composer require --dev lakion/api-test-case:dev-master@dev (since there is no stable version), i got the following errors:
Problem 1
- Installation request for lakion/api-test-case dev-master@dev -> satisfiable by lakion/api-test-case[dev-master].
- lakion/api-test-case dev-master requires coduo/php-matcher ^2.1@dev -> no matching package found.
Could you please tell me what is wrong?
Thanks.
Hello together,
i really like this libraby, but i have a problem. Maybe to due missing symfony skills, but i think this library does it on purpose.
In my projects i like to have to databases. One for local development. Lets call this myproject_dev
.
I can reset this database any time i want with the same contents.
For my functional / database tests i want to use a second database. Lets call is myproject_test
.
It seems like this library always uses the "default" database, right?
Is there a way, maybe with a setting in phpunit.xml.dist
to control this behaviour?
Greetings,
Chucky2305
It would be awesome if 2.0 version of this lib supported PHPUnit 6, so we can use v1.x with PHPUnit 4.x and 5.x on PHP 5.6, and use version 2 with PHPUnit 6 on PHP 7.x
Using assertContains
with strings is deprecated in PHPUnit 8 and will be removed in PHPUnit 9.
It would be great to support Symfony 4, what is needed for this to happen?
The Symfony\Bundle\MonologBundle\DependencyInjection\Compiler\DebugHandlerPass class is deprecated since version 2.12 and will be removed in 3.0. Use AddDebugLogProcessorPass in FrameworkBundle instead: 1x
1x in ApiTestCase::createSharedKernel from Lakion\ApiTestCase
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.