Skip to content

Commit

Permalink
test: ensure tests pass on lowest dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed May 26, 2024
1 parent 7105b1e commit 5203b82
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion tests/UuidBinaryOrderedTimeTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Ramsey\Uuid\Uuid;

use function hex2bin;
use function method_exists;

class UuidBinaryOrderedTimeTypeTest extends TestCase
{
Expand Down Expand Up @@ -47,7 +48,14 @@ private function getType(): Type

public function testGetName(): void
{
$this->assertSame('uuid_binary_ordered_time', $this->getType()::lookupName($this->getType()));
$type = $this->getType();

if (method_exists($type, 'lookupName')) {
$this->assertSame('uuid_binary_ordered_time', $type::lookupName($type));
} else {
/** @phpstan-ignore method.notFound */
$this->assertSame('uuid_binary_ordered_time', $type->getName());
}
}

public function testUuidConvertsToDatabaseValue(): void
Expand Down
9 changes: 8 additions & 1 deletion tests/UuidBinaryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ public function testReturnValueIfUuid7ForPHPValue(): void

public function testGetName(): void
{
$this->assertSame('uuid_binary', $this->getType()::lookupName($this->getType()));
$type = $this->getType();

if (method_exists($type, 'lookupName')) {
$this->assertSame('uuid_binary', $type::lookupName($type));
} else {
/** @phpstan-ignore method.notFound */
$this->assertSame('uuid_binary', $type->getName());
}
}

public function testGetGuidTypeDeclarationSQL(): void
Expand Down
11 changes: 10 additions & 1 deletion tests/UuidTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;

use function method_exists;

class UuidTypeTest extends TestCase
{
protected function setUp(): void
Expand Down Expand Up @@ -127,7 +129,14 @@ public function testReturnValueIfUuidForPHPValue(): void

public function testGetName(): void
{
$this->assertSame('uuid', $this->getType()::lookupName($this->getType()));
$type = $this->getType();

if (method_exists($type, 'lookupName')) {
$this->assertSame('uuid', $type::lookupName($type));
} else {
/** @phpstan-ignore method.notFound */
$this->assertSame('uuid', $type->getName());
}
}

public function testGetGuidTypeDeclarationSQL(): void
Expand Down

0 comments on commit 5203b82

Please sign in to comment.