/**
* @internal
*/
class ScriptControllerTest extends TestCase
{ use AppSystemTestBehaviour;
use IntegrationTestBehaviour;
use StorefrontControllerTestBehaviour;
public function testGetApiEndpoint(): void
{ $this->
loadAppsFromDir(__DIR__ . '/fixtures/Apps'
);
$response =
$this->
request('GET', '/storefront/script/json-response',
[]);
static::
assertNotFalse($response->
getContent());
$body = \
json_decode($response->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertSame(Response::HTTP_OK,
$response->
getStatusCode(),
print_r($body, true
));
$traces =
$this->
getScriptTraces();
static::
assertArrayHasKey('storefront-json-response',
$traces);
static::
assertCount(1,
$traces['storefront-json-response'
]);
static::
assertSame('some debug information',
$traces['storefront-json-response'
][0
]['output'
][0
]);