diff --git a/.gitattributes b/.gitattributes
index b7404a3..9365305 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,7 @@
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
-/phpunit.xml.dist export-ignore
+/testo.php export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml
deleted file mode 100644
index 3b86822..0000000
--- a/.github/workflows/phpunit.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-on:
- pull_request: null
- push:
- branches:
- - '*.*'
-
-name: phpunit
-
-jobs:
- phpunit:
- uses: spiral/gh-actions/.github/workflows/phpunit.yml@master
- with:
- os: >-
- ['ubuntu-latest']
- stability: >-
- ['prefer-lowest', 'prefer-stable']
diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml
index eea1d20..901c593 100644
--- a/.github/workflows/psalm.yml
+++ b/.github/workflows/psalm.yml
@@ -2,7 +2,7 @@ on:
pull_request: null
push:
branches:
- - '*.*'
+ - '1.x'
name: static analysis
diff --git a/.github/workflows/testo.yml b/.github/workflows/testo.yml
new file mode 100644
index 0000000..174bb5a
--- /dev/null
+++ b/.github/workflows/testo.yml
@@ -0,0 +1,16 @@
+on:
+ pull_request: null
+ push:
+ branches:
+ - '1.x'
+
+name: testo
+
+jobs:
+ testo:
+ uses: spiral/gh-actions/.github/workflows/testo.yml@master
+ with:
+ os: >-
+ ['ubuntu-latest']
+ dependencies: >-
+ ['lowest', 'highest']
diff --git a/.gitignore b/.gitignore
index 1a6ed30..78d21b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
.idea
.php_cs
.php_cs.cache
-.phpunit.result.cache
build
composer.lock
coverage
diff --git a/README.md b/README.md
index 1e078c5..e868ff4 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ processes connected to the RoadRunner server.
Make sure that your server is configured with following PHP version and extensions:
-- PHP 8.1+
+- PHP 8.2+
### Installation
diff --git a/composer.json b/composer.json
index 02bff03..1a8b7da 100644
--- a/composer.json
+++ b/composer.json
@@ -44,15 +44,16 @@
}
],
"require": {
- "php": "^8.1",
+ "php": "^8.2",
"ramsey/uuid": "^4.7",
"roadrunner-php/roadrunner-api-dto": "^1.0",
"spiral/goridge": "^4.0"
},
"require-dev": {
- "mockery/mockery": "^1.5",
- "phpunit/phpunit": "^10.0",
- "vimeo/psalm": "^5.9"
+ "mockery/mockery": "^1.6",
+ "testo/bridge-mockery": "^0.1.2",
+ "testo/testo": "^0.10.55",
+ "vimeo/psalm": "^6 || ^7"
},
"autoload": {
"psr-4": {
@@ -65,7 +66,7 @@
}
},
"scripts": {
- "test": "vendor/bin/phpunit",
+ "test": "vendor/bin/testo",
"psalm": "vendor/bin/psalm --config=psalm.xml ./src --show-info=true"
},
"config": {
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index 6b82af7..0000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- tests
-
-
-
-
- ./src
-
-
-
-
-
-
-
-
-
-
-
diff --git a/psalm.xml b/psalm.xml
index 7e98f69..e1f086b 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -13,4 +13,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/testo.php b/testo.php
new file mode 100644
index 0000000..1d387a7
--- /dev/null
+++ b/testo.php
@@ -0,0 +1,20 @@
+rpc = m::mock(RPCInterface::class);
$this->rpc->shouldReceive('withCodec')
@@ -34,9 +39,7 @@ protected function setUp(): void
$this->lock = new Lock($this->rpc, $this->idGenerator);
}
- /**
- * @dataProvider lockTypeDataProvider
- */
+ #[DataProvider('lockTypeDataProvider')]
public function testLock(
string $method,
string $callMethod,
@@ -69,15 +72,13 @@ public function testLock(
$result = $this->lock->$method(resource: 'resource', id: $id, ttl: $ttl, waitTTL: $wait);
if ($expectedResult) {
- $this->assertSame(($id === null ? 'some-id' : $id), $result);
+ Assert::same($result, ($id === null ? 'some-id' : $id));
} else {
- $this->assertFalse($result);
+ Assert::false($result);
}
}
- /**
- * @dataProvider resultDataProvider
- */
+ #[DataProvider('resultDataProvider')]
public function testRelease(bool $result): void
{
$this->rpc->shouldReceive('call')
@@ -90,12 +91,10 @@ public function testRelease(bool $result): void
})
->andReturn(new Response(['ok' => $result]));
- $this->assertSame($result, $this->lock->release('resource', 'some-id'));
+ Assert::same($this->lock->release('resource', 'some-id'), $result);
}
- /**
- * @dataProvider resultDataProvider
- */
+ #[DataProvider('resultDataProvider')]
public function testForceRelease(bool $result): void
{
$this->rpc->shouldReceive('call')
@@ -108,12 +107,10 @@ public function testForceRelease(bool $result): void
})
->andReturn(new Response(['ok' => $result]));
- $this->assertSame($result, $this->lock->forceRelease('resource'));
+ Assert::same($this->lock->forceRelease('resource'), $result);
}
- /**
- * @dataProvider resultDataProvider
- */
+ #[DataProvider('resultDataProvider')]
public function testExists(bool $result): void
{
$this->rpc->shouldReceive('call')
@@ -126,12 +123,10 @@ public function testExists(bool $result): void
})
->andReturn(new Response(['ok' => $result]));
- $this->assertSame($result, $this->lock->exists('resource'));
+ Assert::same($this->lock->exists('resource'), $result);
}
- /**
- * @dataProvider updateTTLDataProvider
- */
+ #[DataProvider('updateTTLDataProvider')]
public function testUpdateTTL($ttl, int $expectedTtl, bool $result): void
{
$this->rpc->shouldReceive('call')
@@ -145,12 +140,10 @@ public function testUpdateTTL($ttl, int $expectedTtl, bool $result): void
})
->andReturn(new Response(['ok' => $result]));
- $this->assertSame($result, $this->lock->updateTTL('resource', 'some-id', $ttl));
+ Assert::same($this->lock->updateTTL('resource', 'some-id', $ttl), $result);
}
- /**
- * @dataProvider resultDataProvider
- */
+ #[DataProvider('resultDataProvider')]
public function testExistsWithId(bool $result): void
{
$this->rpc->shouldReceive('call')
@@ -163,7 +156,7 @@ public function testExistsWithId(bool $result): void
})
->andReturn(new Response(['ok' => $result]));
- $this->assertSame($result, $this->lock->exists('resource', 'some-id'));
+ Assert::same($this->lock->exists('resource', 'some-id'), $result);
}
public static function lockTypeDataProvider(): \Generator
@@ -220,33 +213,33 @@ public static function resultDataProvider(): \Traversable
yield [false];
}
+ #[ExpectException(\LogicException::class)]
public function testLockNegativeTtl(): void
{
- self::expectException(\LogicException::class);
$this->lock->lock('resource', 'uuid', -300);
}
+ #[ExpectException(\LogicException::class)]
public function testLockNegativeWaitTtl(): void
{
- self::expectException(\LogicException::class);
$this->lock->lock('resource', 'uuid', 0, -300);
}
+ #[ExpectException(\LogicException::class)]
public function testLockReadNegativeTtl(): void
{
- self::expectException(\LogicException::class);
$this->lock->lock('resource', 'uuid', -300);
}
+ #[ExpectException(\LogicException::class)]
public function testLockReadNegativeWaitTtl(): void
{
- self::expectException(\LogicException::class);
$this->lock->lockRead('resource', 'uuid', 0, -300);
}
+ #[ExpectException(\LogicException::class)]
public function testUpdateNegativeWaitTtl(): void
{
- self::expectException(\LogicException::class);
$this->lock->updateTTL('resource', 'uuid', -300);
}
}
diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php
deleted file mode 100644
index 08e12bb..0000000
--- a/tests/src/TestCase.php
+++ /dev/null
@@ -1,10 +0,0 @@
-