Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix test #68

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
- master
- '*.x'
pull_request:
paths:
- "!*.md"

permissions:
contents: read
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: test
on:
workflow_dispatch:
pull_request:
paths:
- "!*.md"
push:
branches:
- master
Expand Down
5 changes: 2 additions & 3 deletions tests/FileLockResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,8 @@ private function touch($content = '')
private function prepareLockPath(): array
{
$dir = dirname(__DIR__).'/.locks';
if (! is_dir($dir)) {
mkdir($dir, 0777);
}
rmdir($dir);
mkdir($dir, 0777);

return [$dir, fn () => rmdir($dir)];
}
Expand Down
7 changes: 7 additions & 0 deletions tests/RedisSequenceResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

class RedisSequenceResolverTest extends TestCase
{
public function setUp(): void
{
if (! extension_loaded('swoole')) {
$this->markTestSkipped('Redis extension is not installed');
}
}

public function test_invalid_redis_connect(): void
{
$redis = $this->createMock(\Redis::class);
Expand Down
6 changes: 3 additions & 3 deletions tests/SonyflakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ public function test_get_start_time_stamp(): void
public function testget_current_millisecond(): void
{
$snowflake = new Sonyflake(9990);
$now = floor(microtime(true) * 1000) | 0;
$time = $snowflake->getCurrentMillisecond();
$first = $snowflake->getCurrentMillisecond();
$second = $snowflake->getCurrentMillisecond();

$this->assertTrue($now - $time >= 0);
$this->assertTrue($second - $first >= 0);
}
}
4 changes: 4 additions & 0 deletions tests/SwooleSequenceResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function setUp(): void
if (version_compare(PHP_VERSION, '8.3') >= 0) {
$this->markTestSkipped('Swoole does not yet support PHP 8.3');
}

if (! extension_loaded('swoole')) {
$this->markTestSkipped('Swoole extension is not installed');
}
}

public function test_basic(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function test_time(): void
}
$a++;

$this->assertEquals($s1, $s2);
$this->assertTrue($s1 != $s2);
}
}
}
Loading