Security update for Core, with self-updated composer
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Lock / LockTest.php
index 0bd761fed23f124b623d2b39b6bf29305516378a..8e1a50d5d0ae6092695b301d9d433a5d32e46290 100644 (file)
@@ -47,6 +47,21 @@ class LockTest extends KernelTestBase {
     $this->assertTrue($success, 'Could acquire second lock a second time within the same request.');
 
     $this->lock->release('lock_b');
+
+    // Test acquiring an releasing a lock with a long key (over 255 chars).
+    $long_key = 'long_key:BZoMiSf9IIPULsJ98po18TxJ6T4usd3MZrLE0d3qMgG6iAgDlOi1G3oMap7zI5df84l7LtJBg4bOj6XvpO6vDRmP5h5QbA0Bj9rVFiPIPAIQZ9qFvJqTALiK1OR3GpOkWQ4vgEA4LkY0UfznrWBeuK7IWZfv1um6DLosnVXd1z1cJjvbEUqYGJj92rwHfhYihLm8IO9t3P2gAvEkH5Mhc8GBoiTsIDnP01Te1kxGFHO3RuvJIxPnHmZtSdBggmuVN7x9';
+
+    $success = $this->lock->acquire($long_key);
+    $this->assertTrue($success, 'Could acquire long key lock.');
+
+    // This function is not part of the backend, but the default database
+    // backend implement it, we can here use it safely.
+    $is_free = $this->lock->lockMayBeAvailable($long_key);
+    $this->assertFalse($is_free, 'Long key lock is unavailable.');
+
+    $this->lock->release($long_key);
+    $is_free = $this->lock->lockMayBeAvailable($long_key);
+    $this->assertTrue($is_free, 'Long key lock has been released.');
   }
 
   /**