model = $objectManager->get(Revoker::class); $this->reader = $objectManager->get(Reader::class); $this->customerRepo = $objectManager->get(CustomerRepositoryInterface::class); $this->userModel = $objectManager->create(UserModel::class); $this->paramsFactory = $objectManager->get(UserTokenParametersFactory::class); $this->issuer = $objectManager->get(Issuer::class); } /** * Verify that tokens are actually being revoked. * * @return void * @throws \Throwable * @magentoDataFixture Magento/Customer/_files/customer.php */ public function testRevoking(): void { //Preparing the token $customer = $this->customerRepo->get('customer@example.com'); /** @var UserTokenParameters $params */ $params = $this->paramsFactory->create(); $token = $this->issuer->create( new CustomUserContext((int) $customer->getId(), UserContextInterface::USER_TYPE_CUSTOMER), $params ); $this->model->revokeFor( new CustomUserContext((int) $customer->getId(), UserContextInterface::USER_TYPE_CUSTOMER) ); $this->expectException(UserTokenException::class); $this->reader->read($token); } }