diff --git a/src/RateBotDetector.php b/src/RateBotDetector.php
index 9e81dbe..05b8d25 100644
--- a/src/RateBotDetector.php
+++ b/src/RateBotDetector.php
@@ -142,7 +142,7 @@ class RateBotDetector {
    */
   protected function checkThreshold($interval) {
     $sql = 'SELECT COUNT(*) FROM {votingapi_vote} WHERE vote_source = :ip AND timestamp > :time';
-    return $this->database->query($sql, [':ip' => $this->ip, ':time' => REQUEST_TIME - $interval])->fetchField();
+    return $this->database->query($sql, [':ip' => $this->ip, ':time' => \Drupal::time()->getRequestTime() - $interval])->fetchField();
   }
 
   /**
diff --git a/tests/src/Functional/RateWidgetTest.php b/tests/src/Functional/RateWidgetTest.php
index 519864d..c0e8921 100644
--- a/tests/src/Functional/RateWidgetTest.php
+++ b/tests/src/Functional/RateWidgetTest.php
@@ -52,7 +52,7 @@ class RateWidgetTest extends BrowserTestBase {
     // The entity_get_display() procedural function is deprecated in
     // drupal:8.8.0 and above.
     if (version_compare(\Drupal::VERSION, '8.8', '<')) {
-      $display = entity_get_display('entity_test', 'entity_test', 'default');
+      $display = \Drupal::service('entity_display.repository')->getViewDisplay('entity_test', 'entity_test', 'default');
     }
     else {
       $display = \Drupal::service('entity_display.repository')
