diff --git a/.gitignore b/.gitignore index 5bf75e5..e2e7e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/.idea/ +/.phpunit.result.cache /composer.lock /vendor/ -.idea/ diff --git a/composer.json b/composer.json index 5b8d0a9..514e43c 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,8 @@ "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.5", - "phpbench/phpbench": "^0.15", + "phpunit/phpunit": "^8.5", + "phpbench/phpbench": "^0.17", "symfony/phpunit-bridge": "^5.1" } } diff --git a/tests/UlidTest.php b/tests/UlidTest.php index 64cc641..e05b433 100644 --- a/tests/UlidTest.php +++ b/tests/UlidTest.php @@ -12,6 +12,7 @@ namespace Ulid\Tests; use PHPUnit\Framework\TestCase; +use Ulid\Exception\InvalidUlidStringException; use Ulid\Ulid; /** @@ -79,21 +80,19 @@ public function testCreatesFromLowercaseString(): void $this->assertEquals('01an4z07by79ka1307sr9x4mv3', (string) Ulid::fromString('01an4z07by79ka1307sr9x4mv3', true)); } - /** - * @expectedException \Ulid\Exception\InvalidUlidStringException - * @expectedExceptionMessage Invalid ULID string (wrong length): - */ public function testCreatesFromStringWithInvalidUlid(): void { + $this->expectException(InvalidUlidStringException::class); + $this->expectExceptionMessage('Invalid ULID string (wrong length):'); + Ulid::fromString('not-a-valid-ulid'); } - /** - * @expectedException \Ulid\Exception\InvalidUlidStringException - * @expectedExceptionMessage Invalid ULID string (wrong length): - */ public function testCreatesFromStringWithTrailingNewLine(): void { + $this->expectException(InvalidUlidStringException::class); + $this->expectExceptionMessage('Invalid ULID string (wrong length):'); + Ulid::fromString("01AN4Z07BY79KA1307SR9X4MV3\n"); } @@ -109,11 +108,12 @@ public function invalidAlphabetDataProvider(): array /** * @dataProvider invalidAlphabetDataProvider - * @expectedException \Ulid\Exception\InvalidUlidStringException - * @expectedExceptionMessage Invalid ULID string (wrong characters): */ public function testCreatesFromStringWithInvalidAlphabet($ulid): void { + $this->expectException(InvalidUlidStringException::class); + $this->expectExceptionMessage('Invalid ULID string (wrong characters):'); + Ulid::fromString($ulid); }