Skip to content

Commit e216b64

Browse files
committed
Improve tests
1 parent 5948b78 commit e216b64

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/Integration/Locker/PostgresAdvisoryLockerTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,11 @@ public function testItCanReleaseAllLocksInConnection(): void
400400
PostgresLockId::fromKeyValue('test'),
401401
PostgresAdvisoryLockScopeEnum::Session,
402402
);
403+
$locker->acquireLock(
404+
$dbConnection,
405+
PostgresLockId::fromKeyValue('test'),
406+
PostgresAdvisoryLockScopeEnum::Session,
407+
);
403408
$locker->acquireLock(
404409
$dbConnection,
405410
PostgresLockId::fromKeyValue('test2'),
@@ -421,7 +426,7 @@ public function testItCanReleaseAllLocksInConnectionIfNoLocksWereAcquired(): voi
421426
$this->assertPgAdvisoryLocksCount(0);
422427
}
423428

424-
public function testItCanReleaseAllLocksInConnectionButKeepsOtherLocks(): void
429+
public function testItCanReleaseAllLocksInConnectionButKeepsOtherConnectionLocks(): void
425430
{
426431
$locker = $this->initLocker();
427432
$dbConnection1 = $this->initPostgresPdoConnection();
@@ -597,7 +602,7 @@ public function testItCannotReleaseAllLocksAcquiredWithinTransaction(): void
597602
$this->assertPgAdvisoryLockExistsInConnection($dbConnection, $postgresLockId2);
598603
}
599604

600-
public function testItCannotReleaseAllLocksWithTransactionScope(): void
605+
public function testItCannotReleaseLockWithTransactionScope(): void
601606
{
602607
$locker = $this->initLocker();
603608
$dbConnection = $this->initPostgresPdoConnection();
@@ -616,8 +621,9 @@ public function testItCannotReleaseAllLocksWithTransactionScope(): void
616621
);
617622

618623
try {
619-
$locker->releaseAllLocks(
624+
$locker->releaseLock(
620625
$dbConnection,
626+
$postgresLockId2,
621627
PostgresAdvisoryLockScopeEnum::Transaction,
622628
);
623629
} catch (\InvalidArgumentException $exception) {
@@ -628,7 +634,7 @@ public function testItCannotReleaseAllLocksWithTransactionScope(): void
628634
}
629635
}
630636

631-
public function testItCannotReleaseLocksWithTransactionScope(): void
637+
public function testItCannotReleaseAllLocksWithTransactionScope(): void
632638
{
633639
$locker = $this->initLocker();
634640
$dbConnection = $this->initPostgresPdoConnection();
@@ -647,9 +653,8 @@ public function testItCannotReleaseLocksWithTransactionScope(): void
647653
);
648654

649655
try {
650-
$locker->releaseLock(
656+
$locker->releaseAllLocks(
651657
$dbConnection,
652-
$postgresLockId2,
653658
PostgresAdvisoryLockScopeEnum::Transaction,
654659
);
655660
} catch (\InvalidArgumentException $exception) {

0 commit comments

Comments
 (0)