diff --git a/src/Authentication/Event/JwtAuthBaseEvent.php b/src/Authentication/Event/JwtAuthBaseEvent.php
index 5b947d0..18eba13 100644
--- a/src/Authentication/Event/JwtAuthBaseEvent.php
+++ b/src/Authentication/Event/JwtAuthBaseEvent.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\jwt\Authentication\Event;
 
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
 use Drupal\jwt\JsonWebToken\JsonWebTokenInterface;
 
 /**
diff --git a/src/Authentication/Provider/JwtAuth.php b/src/Authentication/Provider/JwtAuth.php
index c3696ef..5040104 100644
--- a/src/Authentication/Provider/JwtAuth.php
+++ b/src/Authentication/Provider/JwtAuth.php
@@ -71,13 +71,13 @@ class JwtAuth implements AuthenticationProviderInterface {
 
     $validate = new JwtAuthValidateEvent($jwt);
     // Signature is validated, but allow modules to do additional validation.
-    $this->eventDispatcher->dispatch(JwtAuthEvents::VALIDATE, $validate);
+    $this->eventDispatcher->dispatch($validate, JwtAuthEvents::VALIDATE);
     if (!$validate->isValid()) {
       return NULL;
     }
 
     $valid = new JwtAuthValidEvent($jwt);
-    $this->eventDispatcher->dispatch(JwtAuthEvents::VALID, $valid);
+    $this->eventDispatcher->dispatch($valid, JwtAuthEvents::VALID);
     $user = $valid->getUser();
 
     if (!$user) {
@@ -95,7 +95,7 @@ class JwtAuth implements AuthenticationProviderInterface {
    */
   public function generateToken() {
     $event = new JwtAuthGenerateEvent(new JsonWebToken());
-    $this->eventDispatcher->dispatch(JwtAuthEvents::GENERATE, $event);
+    $this->eventDispatcher->dispatch($event, JwtAuthEvents::GENERATE);
     $jwt = $event->getToken();
     return $this->transcoder->encode($jwt);
   }
diff --git a/tests/src/Functional/JwtAuthTest.php b/tests/src/Functional/JwtAuthTest.php
index 861939b..8d047ce 100644
--- a/tests/src/Functional/JwtAuthTest.php
+++ b/tests/src/Functional/JwtAuthTest.php
@@ -20,7 +20,7 @@ class JwtAuthTest extends BrowserTestBase {
    *
    * @var array
    */
-  public static $modules = [
+  protected static $modules = [
     'system',
     'user',
     'router_test',
@@ -53,7 +53,7 @@ class JwtAuthTest extends BrowserTestBase {
     $auth = $this->container->get('jwt.authentication.jwt');
     $token = $auth->generateToken();
     $decoded_jwt = $transcoder->decode($token);
-    $this->assertEqual($account->id(), $decoded_jwt->getClaim(['drupal', 'uid']));
+    $this->assertEquals($account->id(), $decoded_jwt->getClaim(['drupal', 'uid']));
     foreach (['jwt_test.11.1', 'jwt_test.11.2'] as $route_name) {
       $url = Url::fromRoute($route_name);
       foreach (['Authorization', 'JWT-Authorization'] as $header_name) {
@@ -97,9 +97,9 @@ class JwtAuthTest extends BrowserTestBase {
     // cache if jwt credentials are provided.
     $url = Url::fromRoute('jwt_test.10');
     $this->drupalGet($url);
-    $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
+    $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
     $this->drupalGet($url);
-    $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
+    $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT');
     foreach (['Authorization', 'JWT-Authorization'] as $header_name) {
       $headers = [
         $header_name => 'Bearer ' . $token,
diff --git a/tests/src/Functional/JwtPathAuthTest.php b/tests/src/Functional/JwtPathAuthTest.php
index e806786..b004ef9 100644
--- a/tests/src/Functional/JwtPathAuthTest.php
+++ b/tests/src/Functional/JwtPathAuthTest.php
@@ -48,7 +48,7 @@ class JwtPathAuthTest extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->adminUser = $this->drupalCreateUser(['administer jwt', 'access content']);
@@ -87,12 +87,12 @@ class JwtPathAuthTest extends BrowserTestBase {
     $edit = [
       'allowed_path_prefixes' => "/system/files/\nzzz",
     ];
-    $this->drupalPostForm(NULL, $edit, 'Save configuration');
-    $this->assertText('Paths must start with a slash.');
+    $this->submitForm($edit, 'Save configuration');
+    $this->assertSession()->pageTextContains('Paths must start with a slash.');
     $edit = [
       'allowed_path_prefixes' => "/system/files/\r\n/foo/zzz/ \r\n/entity/file/",
     ];
-    $this->drupalPostForm(NULL, $edit, 'Save configuration');
+    $this->submitForm($edit, 'Save configuration');
     $config = $this->config('jwt_path_auth.config');
     $expected = ['/system/files/', '/foo/zzz/', '/entity/file/'];
     $this->assertSame($expected, $config->get('allowed_path_prefixes'));
@@ -105,8 +105,8 @@ class JwtPathAuthTest extends BrowserTestBase {
     $file_real_path = $file_system->realpath($file->getFileUri());
     $this->assertFileExists($file_real_path);
     $this->drupalGet($file->createFileUrl());
-    $this->assertResponse(200);
-    $this->assertText($this->getFileContent($file));
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->pageTextContains($this->getFileContent($file));
     // Make sure the logged-in user can access the REST resource. The path
     // should be '/entity/file/' . $file->id().
     $options = [
@@ -116,11 +116,11 @@ class JwtPathAuthTest extends BrowserTestBase {
     ];
     $file_rest_url = Url::fromRoute('rest.entity.file.GET', ['file' => $file->id()], $options);
     $this->drupalGet($file_rest_url);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $this->drupalLogout();
     // Expect a 403 when not authenticated.
     $this->drupalGet($file->createFileUrl());
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     // When Drupal is in a subdirectory (such as drupal.org testbot) any
     // path in the JWT other than a "/" must bre prefixed with the base
     // path - the system does not expect the client to know where Drupal
@@ -140,8 +140,8 @@ class JwtPathAuthTest extends BrowserTestBase {
     ];
     // Make a real request with the token in the query string.
     $this->drupalGet($file->createFileUrl(), $options);
-    $this->assertResponse(200);
-    $this->assertText($this->getFileContent($file));
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->pageTextContains($this->getFileContent($file));
     // If the path claim on the JWT doesn't match, access should be denied.
     $jwt = new JsonWebToken();
     $jwt->setClaim(['drupal', 'path_auth', 'uid'], $this->adminUser->id());
@@ -153,7 +153,7 @@ class JwtPathAuthTest extends BrowserTestBase {
       ],
     ];
     $this->drupalGet($file->createFileUrl(), $options);
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     // Making a REST api request with no JWT should be denied.
     $options = [
       'query' => [
@@ -162,7 +162,7 @@ class JwtPathAuthTest extends BrowserTestBase {
     ];
     $file_rest_url = Url::fromRoute('rest.entity.file.GET', ['file' => $file->id()], $options);
     $this->drupalGet($file_rest_url);
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     // Token path does not match, should still be 403.
     $options = [
       'query' => [
@@ -172,7 +172,7 @@ class JwtPathAuthTest extends BrowserTestBase {
     ];
     $file_rest_url = Url::fromRoute('rest.entity.file.GET', ['file' => $file->id()], $options);
     $this->drupalGet($file_rest_url);
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     // Create a new token matching the request path prefix.
     $jwt = new JsonWebToken();
     $jwt->setClaim(['drupal', 'path_auth', 'uid'], $this->adminUser->id());
@@ -186,7 +186,7 @@ class JwtPathAuthTest extends BrowserTestBase {
     ];
     $file_rest_url = Url::fromRoute('rest.entity.file.GET', ['file' => $file->id()], $options);
     $this->drupalGet($file_rest_url);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $json = $this->getSession()->getPage()->getContent();
     $data = json_decode($json, TRUE);
     $this->assertEquals($file->uuid(), $data['uuid'][0]['value']);
@@ -194,7 +194,7 @@ class JwtPathAuthTest extends BrowserTestBase {
     $this->adminUser->block();
     $this->adminUser->save();
     $this->drupalGet($file_rest_url);
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
   }
 
   /**
diff --git a/tests/src/Kernel/BasicTest.php b/tests/src/Kernel/BasicTest.php
index 0b3c0b9..5ac155c 100644
--- a/tests/src/Kernel/BasicTest.php
+++ b/tests/src/Kernel/BasicTest.php
@@ -15,12 +15,12 @@ class BasicTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['system', 'key', 'jwt', 'jwt_test'];
+  protected static $modules = ['system', 'key', 'jwt', 'jwt_test'];
 
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installConfig(['key', 'jwt', 'jwt_test']);
   }
@@ -33,24 +33,24 @@ class BasicTest extends KernelTestBase {
     $key_repository = $this->container->get('key.repository');
     $key_hmac = $key_repository->getKey('jwt_test_hmac');
     $this->assertNotEmpty($key_hmac);
-    $this->assertEqual('jwt_hs', $key_hmac->getKeyType()->getPluginId());
+    $this->assertEquals('jwt_hs', $key_hmac->getKeyType()->getPluginId());
     $key_rsa = $key_repository->getKey('jwt_test_rsa');
     $this->assertNotEmpty($key_rsa);
-    $this->assertEqual('jwt_rs', $key_rsa->getKeyType()->getPluginId());
+    $this->assertEquals('jwt_rs', $key_rsa->getKeyType()->getPluginId());
     // The jwt_test module configures the jwt_test_hmac key to be used.
     /** @var \Drupal\jwt\Transcoder\JwtTranscoderInterface $transcoder */
     $transcoder = $this->container->get('jwt.transcoder');
     $reflected = new \ReflectionClass($transcoder);
     $algorithm = $reflected->getProperty('algorithm');
     $algorithm->setAccessible(TRUE);
-    $this->assertEqual('HS256', $algorithm->getValue($transcoder));
+    $this->assertEquals('HS256', $algorithm->getValue($transcoder));
     $jwt = new JsonWebToken();
     $jwt->setClaim(['drupal', 'test'], 1234);
     $encoded = $transcoder->encode($jwt);
     $this->assertNotEmpty($encoded);
     $this->assertTrue(is_string($encoded));
     $decoded_jwt = $transcoder->decode($encoded);
-    $this->assertEqual(1234, $decoded_jwt->getClaim(['drupal', 'test']));
+    $this->assertEquals(1234, $decoded_jwt->getClaim(['drupal', 'test']));
   }
 
 }
diff --git a/tests/src/Kernel/RsaKeyTest.php b/tests/src/Kernel/RsaKeyTest.php
index 52c027a..3225c0b 100644
--- a/tests/src/Kernel/RsaKeyTest.php
+++ b/tests/src/Kernel/RsaKeyTest.php
@@ -18,12 +18,12 @@ class RsaKeyTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['system', 'user', 'field', 'key', 'jwt', 'jwt_auth_issuer', 'jwt_auth_consumer', 'jwt_test'];
+  protected static $modules = ['system', 'user', 'field', 'key', 'jwt', 'jwt_auth_issuer', 'jwt_auth_consumer', 'jwt_test'];
 
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installSchema('system', 'sequences');
 
@@ -48,13 +48,13 @@ class RsaKeyTest extends KernelTestBase {
     /** @var \Drupal\jwt\Transcoder\JwtTranscoderInterface $transcoder */
     $transcoder = $this->container->get('jwt.transcoder');
     $decoded_jwt = $transcoder->decode($token);
-    $this->assertEqual($account->id(), $decoded_jwt->getClaim(['drupal', 'uid']));
+    $this->assertEquals($account->id(), $decoded_jwt->getClaim(['drupal', 'uid']));
     // Test decoding with the matched and mis-matched public keys.
-    $path = drupal_get_path('module', 'jwt_test') . '/fixtures/jwt_test_rsa-public.pem';
+    $path = \Drupal::service('extension.list.module')->getPath('jwt_test') . '/fixtures/jwt_test_rsa-public.pem';
     $public_key = file_get_contents($path);
     $payload = JWT::decode($token, $public_key, ['RS256']);
-    $this->assertEqual($account->id(), $payload->drupal->uid);
-    $path = drupal_get_path('module', 'jwt_test') . '/fixtures/jwt_test_rsa2-public.pem';
+    $this->assertEquals($account->id(), $payload->drupal->uid);
+    $path = \Drupal::service('extension.list.module')->getPath('jwt_test') . '/fixtures/jwt_test_rsa2-public.pem';
     $public_key = file_get_contents($path);
     $this->expectException(SignatureInvalidException::class);
     $payload = JWT::decode($token, $public_key, ['RS256']);
@@ -68,7 +68,7 @@ class RsaKeyTest extends KernelTestBase {
     $config->set('algorithm', 'RS256');
     $config->set('key_id', 'jwt_test_rsa2');
     $config->save();
-    $path = drupal_get_path('module', 'jwt_test') . '/fixtures/jwt_test_rsa2-private.pem';
+    $path = \Drupal::service('extension.list.module')->getPath('jwt_test') . '/fixtures/jwt_test_rsa2-private.pem';
     $private_key = file_get_contents($path);
     $exp = \Drupal::time()->getRequestTime() + 1000;
     $payload = [
@@ -82,8 +82,8 @@ class RsaKeyTest extends KernelTestBase {
     /** @var \Drupal\jwt\Transcoder\JwtTranscoderInterface $transcoder */
     $transcoder = $this->container->get('jwt.transcoder');
     $decoded_jwt = $transcoder->decode($token);
-    $this->assertEqual(999, $decoded_jwt->getClaim(['test', 'uid']));
-    $this->assertEqual($exp, $decoded_jwt->getClaim('exp'));
+    $this->assertEquals(999, $decoded_jwt->getClaim(['test', 'uid']));
+    $this->assertEquals($exp, $decoded_jwt->getClaim('exp'));
   }
 
 }
diff --git a/tests/src/Kernel/UserPathAuthTest.php b/tests/src/Kernel/UserPathAuthTest.php
index 2521684..4a8ed0c 100644
--- a/tests/src/Kernel/UserPathAuthTest.php
+++ b/tests/src/Kernel/UserPathAuthTest.php
@@ -18,7 +18,7 @@ class UserPathAuthTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = [
+  protected static $modules = [
     'system',
     'user',
     'field',
@@ -31,7 +31,7 @@ class UserPathAuthTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installSchema('system', 'sequences');
 
