Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpunit.xml export-ignore
testo.php export-ignore
monorepo-builder.php export-ignore
16 changes: 0 additions & 16 deletions .github/workflows/phpunit.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/testo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:
branches:
- 2.x
pull_request: ~

name: testo

permissions:
contents: read

jobs:
testo:
uses: spiral/gh-actions/.github/workflows/testo.yml@master
with:
os: >-
['ubuntu-latest']
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Thumbs.db
*.exe

# Other
.phpunit.result.cache
.phpunit.cache/
.php_cs.cache
clover.xml
.env
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
],
"require": {
"php": ">=8.1",
"php": ">=8.2",
"roadrunner-php/roadrunner-api-dto": "^1.4",
"spiral/roadrunner": "^2023.2 || ^2024.1 || ^2025.1",
"spiral/goridge": "^4.0",
Expand All @@ -48,9 +48,10 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^10.0",
"spiral/code-style": "^2.3.1",
"vimeo/psalm": ">=5.8"
"testo/bridge-mockery": "^0.1.2",
"testo/testo": "^0.10.55",
"vimeo/psalm": "^6 || ^7"
},
"autoload-dev": {
"psr-4": {
Expand All @@ -60,7 +61,7 @@
"scripts": {
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php-cs-fixer fix -v",
"tests": "phpunit",
"test": "testo",
"psalm": "psalm --no-cache"
},
"config": {
Expand Down
18 changes: 0 additions & 18 deletions phpunit.xml

This file was deleted.

23 changes: 23 additions & 0 deletions testo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\SuiteConfig;
use Testo\Bridge\Mockery\MockeryPlugin;

\ini_set('error_reporting', '-1');
\ini_set('memory_limit', '-1');

return new ApplicationConfig(
src: ['src'],
suites: [
new SuiteConfig(
name: 'Unit',
location: ['tests'],
),
],
plugins: [
new MockeryPlugin(),
],
);
56 changes: 27 additions & 29 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace Spiral\RoadRunner\Services\Tests;

use Testo\Test;
use Testo\Assert;
use Testo\Expect;
use Testo\Lifecycle\BeforeTest;
use Google\Protobuf\Any;
use Mockery as m;
use Spiral\Goridge\RPC\Codec\ProtobufCodec;
Expand All @@ -17,7 +21,8 @@
use Spiral\RoadRunner\Services\Exception\ServiceException;
use Spiral\RoadRunner\Services\Manager;

final class ManagerTest extends TestCase
#[Test]
final class ManagerTest
{
private Manager $manager;
private m\LegacyMockInterface|m\MockInterface|RPCInterface $rpc;
Expand All @@ -35,13 +40,12 @@ public function testListServices(): void

$result = $this->manager->list();

$this->assertSame(['foo', 'bar', 'baz'], $result);
Assert::same($result, ['foo', 'bar', 'baz']);
}

public function testListServicesWithErrorsShouldThrowAnException(): void
{
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Something went wrong');
Expect::exception(ServiceException::class)->withMessageContaining('Something went wrong');

$this->rpc
->shouldReceive('call')
Expand Down Expand Up @@ -71,25 +75,22 @@ public function testServiceShouldBeCreated(): void
})
->andReturn(new Response(['ok' => true]));

$this->assertTrue(
$this->manager->create(
'foo',
'bar',
5,
7,
true,
['FOO' => 'bar', 'BAZ' => 'foo'],
50,
true,
10,
),
);
Assert::true($this->manager->create(
'foo',
'bar',
5,
7,
true,
['FOO' => 'bar', 'BAZ' => 'foo'],
50,
true,
10,
));
}

public function testServiceCreateWithErrorsShouldThrowAnException(): void
{
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Something went wrong');
Expect::exception(ServiceException::class)->withMessageContaining('Something went wrong');

$this->rpc
->shouldReceive('call')
Expand All @@ -111,13 +112,12 @@ public function testServiceShouldBeRestarted(): void
})
->andReturn(new Response(['ok' => true]));

$this->assertTrue($this->manager->restart('foo'));
Assert::true($this->manager->restart('foo'));
}

public function testServiceRestartWithErrorsShouldThrowAnException(): void
{
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Something went wrong');
Expect::exception(ServiceException::class)->withMessageContaining('Something went wrong');

$this->rpc
->shouldReceive('call')
Expand All @@ -139,13 +139,12 @@ public function testServiceShouldBeTerminated(): void
})
->andReturn(new Response(['ok' => true]));

$this->assertTrue($this->manager->terminate('foo'));
Assert::true($this->manager->terminate('foo'));
}

public function testServiceTerminateWithErrorsShouldThrowAnException(): void
{
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Something went wrong');
Expect::exception(ServiceException::class)->withMessageContaining('Something went wrong');

$this->rpc
->shouldReceive('call')
Expand Down Expand Up @@ -187,7 +186,7 @@ public function testServiceStatusesShouldBeReturned(): void

$status = $this->manager->statuses('foo');

$this->assertSame([
Assert::same($status, [
[
'cpu_percent' => 59.5,
'pid' => 33,
Expand All @@ -201,13 +200,12 @@ public function testServiceStatusesShouldBeReturned(): void
],
],
],
], $status);
]);
}

#[BeforeTest]
protected function setUp(): void
{
parent::setUp();

$this->rpc = m::mock(RPCInterface::class);

$this->rpc
Expand Down
9 changes: 0 additions & 9 deletions tests/TestCase.php

This file was deleted.

Loading