objectManager = Bootstrap::getObjectManager(); $this->quoteCollectionFactory = $this->objectManager->get(QuoteCollectionFactory::class); $this->quoteResource = $this->objectManager->get(QuoteResource::class); $this->quoteIdMaskFactory = $this->objectManager->get(QuoteIdMaskFactory::class); } #[ DataFixture(Customer::class, as: 'customer') ] public function testFailForLoggedInUser() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Use `Query.customerCart` for logged in customer."); $customer = DataFixtureStorageManager::getStorage()->get('customer'); $query = $this->getQuery(); $this->graphQlMutation( $query, [], '', $this->objectManager->get(GetCustomerAuthenticationHeader::class)->execute($customer->getEmail()) ); } /** * @return string */ private function getQuery(): string { return <<quoteCollectionFactory->create(); foreach ($quoteCollection as $quote) { $this->quoteResource->delete($quote); $quoteIdMask = $this->quoteIdMaskFactory->create(); $quoteIdMask->setQuoteId($quote->getId()) ->delete(); } parent::tearDown(); } }