Skip to content

Commit 7a6cb9a

Browse files
committed
fixup! fixup! feat(snowflake): Use string as type for snowflake ids
1 parent 8374417 commit 7a6cb9a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/phpunit-32bits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 #v2.35.4
5050
with:
5151
php-version: ${{ matrix.php-versions }}
52-
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite, apcu, ldap
52+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite, apcu, ldap, gmp
5353
coverage: none
5454
ini-file: development
5555
ini-values:

tests/lib/DB/SnowflakeTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,17 @@ public function testLayout(bool $isCLIExpected, bool $is32BitsSystem, int $timeD
6565
$this->assertEquals(42, $sequence);
6666
}
6767

68-
public function testSetStartTimeStamp(): void {
69-
$generator = new SnowflakeGenerator(21, 22, $this->createMock(NextcloudSequenceResolver::class), true);
68+
#[TestWith(data: [true])]
69+
#[TestWith(data: [false])]
70+
public function testSetStartTimeStamp(bool $is32BitsSystem): void {
71+
$generator = $this->getMockBuilder(SnowflakeGenerator::class)
72+
->setConstructorArgs([21, 22, $this->createMock(NextcloudSequenceResolver::class), true])
73+
->onlyMethods(['is32BitsSystem'])
74+
->getMock();
75+
76+
$generator->method('is32BitsSystem')
77+
->willReturn($is32BitsSystem);
7078
$generator->setStartTimeStamp(strtotime('2025-01-01'));
79+
$this->assertEquals('1735689600000', $generator->getStartTimeStamp());
7180
}
7281
}

0 commit comments

Comments
 (0)