protected function ProductVariationResourceTest::getPostDocument in Commerce Core 8.2
Returns the JSON:API POST document.
Return value
array A JSON:API request document.
Overrides ResourceTestBase::getPostDocument
See also
::testPostIndividual()
File
- modules/
product/ tests/ src/ Functional/ Jsonapi/ ProductVariationResourceTest.php, line 213
Class
- ProductVariationResourceTest
- JSON:API resource test for variations.
Namespace
Drupal\Tests\commerce_product\Functional\JsonapiCode
protected function getPostDocument() {
return [
'data' => [
'type' => 'commerce_product_variation--default',
'attributes' => [
// @todo test title generation by omitting title
// the base test checks that `title` exists by default.
'title' => $this->product
->label(),
'sku' => 'ABC123',
'price' => [
'currency_code' => 'USD',
'number' => '8.99',
],
],
'relationships' => [
'product_id' => [
'data' => [
'type' => 'commerce_product--default',
'id' => $this->product
->uuid(),
],
],
],
],
];
}