File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 17
17
18
18
final class PostgresLockId
19
19
{
20
- private const DB_INT_VALUE_MIN = 0 ;
21
- private const DB_INT_VALUE_MAX = 9223372036854775807 ;
22
- private const DB_INT32_VALUE_MAX = 2147483647 ;
20
+ private const DB_INT64_VALUE_MIN = 0 ;
21
+ private const DB_INT64_VALUE_MAX = 9223372036854775807 ;
23
22
24
23
public function __construct (
25
24
public readonly int $ id ,
26
25
public readonly string $ humanReadableValue = '' ,
27
26
) {
28
- if ($ id < self ::DB_INT_VALUE_MIN ) {
27
+ if ($ id < self ::DB_INT64_VALUE_MIN ) {
29
28
throw new InvalidArgumentException ('Out of bound exception (id is too small) ' );
30
29
}
31
- if ($ id > self ::DB_INT_VALUE_MAX ) {
30
+ if ($ id > self ::DB_INT64_VALUE_MAX ) {
32
31
throw new InvalidArgumentException ('Out of bound exception (id is too big) ' );
33
32
}
34
33
}
Original file line number Diff line number Diff line change 21
21
22
22
final class PostgresAdvisoryLockerTest extends AbstractIntegrationTestCase
23
23
{
24
- private const MIN_DB_INT_VALUE = 0 ;
25
- private const MAX_DB_INT_VALUE = 9223372036854775807 ;
24
+ private const DB_INT64_VALUE_MIN = 0 ;
25
+ private const DB_INT64_VALUE_MAX = 9223372036854775807 ;
26
26
27
27
public function test_it_can_acquire_lock (): void
28
28
{
@@ -41,7 +41,7 @@ public function test_it_can_acquire_lock_with_smallest_lock_id(): void
41
41
{
42
42
$ locker = $ this ->initLocker ();
43
43
$ dbConnection = $ this ->initPostgresPdoConnection ();
44
- $ postgresLockId = new PostgresLockId (self ::MIN_DB_INT_VALUE );
44
+ $ postgresLockId = new PostgresLockId (self ::DB_INT64_VALUE_MIN );
45
45
46
46
$ isLockAcquired = $ locker ->acquireLock ($ dbConnection , $ postgresLockId );
47
47
@@ -54,7 +54,7 @@ public function test_it_can_acquire_lock_with_biggest_lock_id(): void
54
54
{
55
55
$ locker = $ this ->initLocker ();
56
56
$ dbConnection = $ this ->initPostgresPdoConnection ();
57
- $ postgresLockId = new PostgresLockId (self ::MAX_DB_INT_VALUE );
57
+ $ postgresLockId = new PostgresLockId (self ::DB_INT64_VALUE_MAX );
58
58
59
59
$ isLockAcquired = $ locker ->acquireLock ($ dbConnection , $ postgresLockId );
60
60
Original file line number Diff line number Diff line change 19
19
20
20
final class PostgresLockIdTest extends AbstractUnitTestCase
21
21
{
22
- private const MIN_DB_INT_VALUE = 0 ;
23
- private const MAX_DB_INT_VALUE = 9223372036854775807 ;
22
+ private const DB_INT64_VALUE_MIN = 0 ;
23
+ private const DB_INT64_VALUE_MAX = 9223372036854775807 ;
24
24
25
25
public function test_it_can_create_postgres_lock_id_with_min_id (): void
26
26
{
27
- $ lockId = new PostgresLockId (self ::MIN_DB_INT_VALUE );
27
+ $ lockId = new PostgresLockId (self ::DB_INT64_VALUE_MIN );
28
28
29
- $ this ->assertSame (self ::MIN_DB_INT_VALUE , $ lockId ->id );
29
+ $ this ->assertSame (self ::DB_INT64_VALUE_MIN , $ lockId ->id );
30
30
}
31
31
32
32
public function test_it_can_create_postgres_lock_id_with_max_id (): void
33
33
{
34
- $ lockId = new PostgresLockId (self ::MAX_DB_INT_VALUE );
34
+ $ lockId = new PostgresLockId (self ::DB_INT64_VALUE_MAX );
35
35
36
- $ this ->assertSame (self ::MAX_DB_INT_VALUE , $ lockId ->id );
36
+ $ this ->assertSame (self ::DB_INT64_VALUE_MAX , $ lockId ->id );
37
37
}
38
38
39
39
public function test_it_can_create_postgres_lock_id_from_lock_id (): void
You can’t perform that action at this time.
0 commit comments