$this->
resetHistory();
$salesChannelContextFactory =
$this->
getContainer()->
get(SalesChannelContextFactory::
class);
$this->salesChannelContext =
$salesChannelContextFactory->
create(Uuid::
randomHex(), TestDefaults::SALES_CHANNEL
);
} public function testSetDefaultHeaderWithAdminApiSource(): void
{ $middleware =
new AuthMiddleware('6.4',
$this->
getContainer()->
get(AppLocaleProvider::
class));
$request =
new Request('POST', 'https://example.local'
);
$request =
$middleware->
getDefaultHeaderRequest($request,
[AuthMiddleware::APP_REQUEST_CONTEXT => Context::
createDefaultContext()]);
static::
assertArrayHasKey('sw-version',
$request->
getHeaders());
static::
assertEquals('6.4',
$request->
getHeader('sw-version'
)[0
]);
static::
assertEquals(Defaults::LANGUAGE_SYSTEM,
$request->
getHeader(AuthMiddleware::SHOPWARE_CONTEXT_LANGUAGE
)[0
]);
static::
assertEquals('en-GB',
$request->
getHeader(AuthMiddleware::SHOPWARE_USER_LANGUAGE
)[0
]);
} public function testSetDefaultHeaderWithSaleChannelApiSource(): void
{ $middleware =
new AuthMiddleware('6.4',
$this->
getContainer()->
get(AppLocaleProvider::
class));
$request =
new Request('POST', 'https://example.local'
);