Tripal
Loading...
Searching...
No Matches
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 ()
 
 tearDown ()
 
- Protected Member Functions inherited from Drupal\Tests\tripal\Kernel\TripalTestKernelBase
 prepareEnvironment (array $functionality)
 

Protected Attributes

 $sharedLocker
 
 $internalLocker
 
 $state
 
bool $warning_thrown = FALSE
 
string $warning_message = ''
 
- Protected Attributes inherited from Drupal\Tests\tripal\Kernel\TripalTestKernelBase
 $messenger = NULL
 
 $logger = NULL
 
 $fileretriever = NULL
 
 $publish_manager = NULL
 

Additional Inherited Members

- Static Protected Attributes inherited from Drupal\Tests\tripal\Kernel\TripalTestKernelBase
static $modules = ['tripal']
 

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

@covers ::acquire @covers ::acquireShared @covers ::lockMayBeAvailable @covers ::getOwnerPid @covers ::getStartTime @covers ::release @covers ::releaseShared @covers ::releaseAll @covers ::cleanUnusedSharedLocks @covers ::getCurrentExpirationDelay

Member Function Documentation

◆ setUp()

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

Tests setup method.

Reimplemented from Drupal\Tests\tripal\Kernel\TripalTestKernelBase.

◆ tearDown()

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

Tears down the test environment.

Returns
void No return value.

◆ testAcquireSharedDetails()

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

Tests acquireShared can extend a timeout.

◆ testAcquireSharedExistingExclusiveLock()

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

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

◆ testAcquireSharedExistingMainLock()

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

Tests acquireShared can use an existing main shared lock.

◆ testAcquireSharedExtendTimeout()

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

Tests acquireShared can extend a timeout.

◆ testAcquireSharedNoMainLock()

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

Tests acquireShared can allocate a main shared lock.

◆ testAcquireSharedWithoutState()

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

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

◆ testAcquireWithoutState()

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

Tests acquire will continue even if it could not use state API for storage.

◆ testExclusiveLockBasics()

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

Tests exclusive lock.

◆ testGetCurrentExpirationDelay()

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

Tests expiration delay.

◆ testNoReleaseOnShared()

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

Tests no exclusive release on shared locks.

◆ testNoReleaseOther()

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

Tests no release other locks.

◆ testNoReleaseSharedOnExclusive()

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

Tests no releaseShared on exclusive locks.

◆ testNotAcquireWhenShared()

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

Tests exclusive acquire denies a shared lock.

◆ testReleaseAllOwn()

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

Tests releaseAll only release all owned locks.

◆ testSharedLockBasics()

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

Tests shared lock.


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