resetHistory example

use IntegrationTestBehaviour;

    /** * @before * * @after */
    public function resetHistory(): void
    {
        /** @var GuzzleHistoryCollector $historyCollector */
        $historyCollector = $this->getContainer()->get(GuzzleHistoryCollector::class);
        $historyCollector->resetHistory();
        /** @var MockHandler $mockHandler */
        $mockHandler = $this->getContainer()->get(MockHandler::class);
        $mockHandler->reset();
        /** @var TestAppServer $testServer */
        $testServer = $this->getContainer()->get(TestAppServer::class);
        $testServer->reset();
    }

    public function getLastRequest(): ?RequestInterface
    {
        /** @var MockHandler $mockHandler */
        
$appLifecycle->install($manifest, true, $this->context);

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('name', 'testPayments'));
        $appRepository = $this->getContainer()->get('app.repository');

        /** @var AppEntity $app */
        $app = $appRepository->search($criteria$this->context)->first();
        $this->app = $app;
        $this->ids = new IdsCollection();

        $this->resetHistory();
    }

    protected function createCustomer(): string
    {
        $customerId = $this->ids->get('customer');
        $addressId = $this->ids->get('address');

        $customer = (new CustomerBuilder($this->ids, '1337'))
            ->firstName('Max')
            ->lastName('Mustermann')
            ->add('id', $this->ids->get('customer'))
            
/** * @internal */
class AuthMiddlewareTest extends TestCase
{
    use GuzzleTestClientBehaviour;

    private SalesChannelContext $salesChannelContext;

    protected function setUp(): void
    {
        $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()]);

        
Home | Imprint | This part of the site doesn't use cookies.