Tripal
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest Class Reference
Inheritance diagram for Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest:
Inheritance graph
[legend]
Collaboration diagram for Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest:
Collaboration graph
[legend]

Public Member Functions

 testExclusiveLockBasics ()
 
 testSharedLockBasics ()
 
 testNotAcquireWhenShared ()
 
 testAcquireWithoutState ()
 
 testAcquireSharedWithoutState ()
 
 testAcquireSharedNoMainLock ()
 
 testAcquireSharedExistingExclusiveLock ()
 
 testAcquireSharedExistingMainLock ()
 
 testAcquireSharedExtendTimeout ()
 
 testAcquireSharedDetails ()
 
 testNoReleaseOther ()
 
 testNoReleaseOnShared ()
 
 testNoReleaseSharedOnExclusive ()
 
 testReleaseAllOwn ()
 
 testGetCurrentExpirationDelay ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $sharedLocker
 
 $internalLocker
 
 $state
 

Detailed Description

Tests for PersistentDatabaseSharedLockBackend.

Note: we use PersistentDatabaseLockBackend instead of DatabaseLockBackend in these tests when we need another type of lock backend because DatabaseLockBackend registers shutdown function releaseAll() which will raise an error when an unexpected error occurs during tests, silencing the real problem. It's because at shutdown, the semaphore table in the test schema is already removed when releaseAll() is called leading to the error:

PHPUnit\Framework\Exception: PDOException: SQLSTATE[42P01]:
Undefined table: 7 ERROR: relation "test########semaphore" does not exist
LINE 1: DELETE FROM "test########semaphore"
^ in core/lib/Drupal/Core/Database/StatementWrapper.php:116

@coversDefaultClass \Drupal\tripal_biodb\Lock\PersistentDatabaseSharedLockBackend

@group Tripal @group Tripal BioDb @group Tripal BioDb Lock

Member Function Documentation

◆ setUp()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::setUp ( )
protected

Tests setup method.

◆ testAcquireSharedDetails()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedDetails ( )

Tests acquireShared can extend a timeout.

@covers ::acquireShared @covers ::getOwnerPid @covers ::getStartTime

◆ testAcquireSharedExistingExclusiveLock()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedExistingExclusiveLock ( )

Tests acquireShared can not use an existing exclusive lock as main lock.

@covers ::acquireShared @covers ::lockMayBeAvailable

◆ testAcquireSharedExistingMainLock()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedExistingMainLock ( )

Tests acquireShared can use an existing main shared lock.

@covers ::acquireShared @covers ::lockMayBeAvailable

◆ testAcquireSharedExtendTimeout()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedExtendTimeout ( )

Tests acquireShared can extend a timeout.

@covers ::acquireShared

◆ testAcquireSharedNoMainLock()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedNoMainLock ( )

Tests acquireShared can allocate a main shared lock.

@covers ::acquireShared

◆ testAcquireSharedWithoutState()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireSharedWithoutState ( )

Tests acquireShared will stop if it could not use state API.

@covers ::acquireShared

◆ testAcquireWithoutState()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testAcquireWithoutState ( )

Tests acquire will continue even if it could not use state API to store infos.

@covers ::acquire

◆ testExclusiveLockBasics()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testExclusiveLockBasics ( )

Tests exclusive lock.

@covers ::acquire

◆ testGetCurrentExpirationDelay()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testGetCurrentExpirationDelay ( )

Tests expiration delay.

@covers ::getCurrentExpirationDelay

◆ testNoReleaseOnShared()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testNoReleaseOnShared ( )

Tests no exclusive release on shared locks.

@covers ::release @covers ::lockMayBeAvailable

◆ testNoReleaseOther()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testNoReleaseOther ( )

Tests no release other locks.

@covers ::release @covers ::lockMayBeAvailable

◆ testNoReleaseSharedOnExclusive()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testNoReleaseSharedOnExclusive ( )

Tests no releaseShared on exclusive locks.

@covers ::releaseShared @covers ::lockMayBeAvailable

◆ testNotAcquireWhenShared()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testNotAcquireWhenShared ( )

Tests exclusive acquire denies a shared lock.

@covers ::acquire

◆ testReleaseAllOwn()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testReleaseAllOwn ( )

Tests releaseAll only release all owned locks.

@covers ::releaseAll @covers ::lockMayBeAvailable @covers ::cleanUnusedSharedLocks

◆ testSharedLockBasics()

Drupal\Tests\tripal_biodb\Unit\Lock\PersistentDatabaseSharedLockBackendTest::testSharedLockBasics ( )

Tests shared lock.

@covers ::acquire


The documentation for this class was generated from the following file: