Skip to content

Commit eacdba1

Browse files
authored
delete unstable tests and skip redis tests if the redis extension is not installed (#78)
1 parent 6e10ab2 commit eacdba1

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

tests/BatchSnowflakeIDTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ public function test_batch_for_same_instance_with_default_driver(): void
3535
$this->assertCount($count, $ids);
3636
}
3737

38-
public function test_batch_for_diff_instance_with_default_driver(): void
39-
{
40-
$ids = [];
41-
$count = 100_000; // 100k
42-
43-
for ($i = 0; $i < $count; $i++) {
44-
$ids[(new Snowflake())->id()] = 1;
45-
}
46-
47-
// This pattern will result in generating duplicate IDs.
48-
$this->assertGreaterThan(90000, count($ids));
49-
}
50-
5138
/**
5239
* @throws Throwable
5340
*/

tests/FileLockResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class FileLockResolverTest extends TestCase
1919
{
2020
private FileLockResolver $fileLocker;
21+
2122
/** @var callable */
2223
private $defer;
2324

tests/RedisSequenceResolverTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717

1818
class RedisSequenceResolverTest extends TestCase
1919
{
20+
public function setUp(): void
21+
{
22+
if (! extension_loaded('redis')) {
23+
$this->markTestSkipped('Redis extension is not installed');
24+
}
25+
}
26+
2027
public function test_invalid_redis_connect(): void
2128
{
2229
$redis = $this->createMock(\Redis::class);
@@ -57,10 +64,6 @@ public function test_set_cache_prefix(): void
5764
*/
5865
public function test_real_redis(): void
5966
{
60-
if (! extension_loaded('redis')) {
61-
$this->markTestSkipped('Redis extension is not installed.');
62-
}
63-
6467
if (! ($host = getenv('REDIS_HOST')) || ! ($port = getenv('REDIS_PORT'))) {
6568
$this->markTestSkipped('Redis host or port is not set, skip real redis test.');
6669
}

0 commit comments

Comments
 (0)