diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f70ed70..1640c12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: - '8.2' - '8.3' - '8.4' + - '8.5' steps: - uses: actions/checkout@v4 @@ -78,6 +79,7 @@ jobs: - '8.2' - '8.3' - '8.4' + - '8.5' steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2557553..00e344c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## Unreleased + +- Explicitly nullable params in test helpers. +- Test last insert IDs with omitted and null names. +- Upgrade PHPStan to 1.0. +- Add PHP 8.5 to Github workflow. + ## 2.0.0 Initial release. diff --git a/composer.json b/composer.json index 4623bb8..0186a8f 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "require-dev": { "pds/skeleton": "^1.0", "phpunit/phpunit": "~9.0", - "phpstan/phpstan": "^0.12.82" + "phpstan/phpstan": "^1.0" }, "autoload": { "psr-4": { diff --git a/tests/FakeConnection.php b/tests/FakeConnection.php index 6214fae..f4c4cfd 100644 --- a/tests/FakeConnection.php +++ b/tests/FakeConnection.php @@ -41,7 +41,7 @@ public function perform(string $statement, array $values = []) : PDOStatement return new PDOStatement(); } - public function lastInsertId(string $name = null) : string + public function lastInsertId(?string $name = null) : string { return "{$name}-1"; } diff --git a/tests/InsertTest.php b/tests/InsertTest.php index 0c54c60..972da27 100644 --- a/tests/InsertTest.php +++ b/tests/InsertTest.php @@ -16,4 +16,18 @@ public function testGetLastInsertId() $actual = $query->getLastInsertId('foo'); $this->assertSame('foo-1', $actual); } + + public function testGetLastInsertId_withoutName() + { + $query = $this->newQuery(); + $actual = $query->getLastInsertId(); + $this->assertSame('-1', $actual); + } + + public function testGetLastInsertId_withNullName() + { + $query = $this->newQuery(); + $actual = $query->getLastInsertId(null); + $this->assertSame('-1', $actual); + } } diff --git a/tests/QueryTestCase.php b/tests/QueryTestCase.php index c8bb14d..d065e7e 100644 --- a/tests/QueryTestCase.php +++ b/tests/QueryTestCase.php @@ -19,7 +19,7 @@ protected function getQueryClass() return substr(get_class($this), 0, -4); } - protected function newQuery(string $arg = null) + protected function newQuery(?string $arg = null) { if ($arg === null) { $arg = new FakeConnection('fake');