static::
assertEquals('http://localhost/api/product/' .
$id,
$response->headers->
get('Location'
));
$this->
assertEntityExists($browser, 'product',
$id);
$browser->
request('POST', '/api/_action/version/product/' .
$id);
$response =
json_decode((string) $browser->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame(Response::HTTP_OK,
$browser->
getResponse()->
getStatusCode(),
(string) $browser->
getResponse()->
getContent());
static::
assertArrayHasKey('versionId',
$response);
static::
assertArrayHasKey('versionName',
$response);
static::
assertArrayHasKey('id',
$response);
static::
assertArrayHasKey('entity',
$response);
static::
assertTrue(Uuid::
isValid($response['versionId'
]));
$versionId =
$response['versionId'
];
$browser->
request('POST', '/api/_action/version/' .
$response['versionId'
] . '/product/' .
$id);
$response =
json_decode((string) $browser->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame(Response::HTTP_OK,
$browser->
getResponse()->
getStatusCode(),
(string) $browser->
getResponse()->
getContent());
static::
assertEmpty($response);
$this->
assertEntityExists($browser, 'product',
$id);
/** @var EntityRepository $productRepo */
$productRepo =
$this->
getContainer()->
get(ProductDefinition::ENTITY_NAME . '.repository'
);