chore: moves to coding stlye

This commit is contained in:
nuno maduro
2026-07-19 03:41:57 +01:00
parent cd0e921158
commit 1c11595504
10 changed files with 17 additions and 23 deletions
+1 -2
View File
@@ -23,8 +23,7 @@ return RectorConfig::configure()
__DIR__.'/tests',
])
->withSets([
PestSetList::PEST_CODE_QUALITY,
PestSetList::PEST_CHAIN,
PestSetList::CODING_STYLE,
])
->withSkip([
__DIR__.'/src/Plugins/Parallel/Paratest/WrapperRunner.php',
+4 -2
View File
@@ -1,12 +1,14 @@
<?php
declare(strict_types=1);
use Pest\Plugin;
trait PluginTrait
{
public function assertPluginTraitGotRegistered(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}
@@ -14,7 +16,7 @@ trait SecondPluginTrait
{
public function assertSecondPluginTraitGotRegistered(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ afterAll(function () use ($file): void {
test('deletes file after all', function () use ($file): void {
file_put_contents($file, 'foo');
$this->assertFileExists($file);
expect($file)->toBeFile();
register_shutdown_function(function (): void {
// $this->assertFileDoesNotExist($file);
});
+3 -8
View File
@@ -10,17 +10,12 @@ beforeEach(function (): void {
});
it('throws exception if dataset does not exist', function (): void {
$this->expectException(DatasetDoesNotExist::class);
$this->expectExceptionMessage("A dataset with the name `first` does not exist. You can create it using `dataset('first', ['a', 'b']);`.");
DatasetsRepository::resolve(['first'], __FILE__);
expect(fn () => DatasetsRepository::resolve(['first'], __FILE__))->toThrow(DatasetDoesNotExist::class, "A dataset with the name `first` does not exist. You can create it using `dataset('first', ['a', 'b']);`.");
});
it('throws exception if dataset already exist', function (): void {
DatasetsRepository::set('second', [[]], __DIR__);
$this->expectException(DatasetAlreadyExists::class);
$this->expectExceptionMessage('A dataset with the name `second` already exists in scope ['.__DIR__.'].');
DatasetsRepository::set('second', [[]], __DIR__);
expect(fn () => DatasetsRepository::set('second', [[]], __DIR__))->toThrow(DatasetAlreadyExists::class, 'A dataset with the name `second` already exists in scope ['.__DIR__.'].');
});
it('sets closures', function (): void {
@@ -38,7 +33,7 @@ it('sets arrays', function (): void {
});
it('gets bound to test case object', function ($value): void {
$this->assertTrue(true);
expect(true)->toBeTrue();
})->with([['a'], ['b']]);
test('it truncates the description', function (): void {
+3 -5
View File
@@ -1,9 +1,7 @@
<?php
it('gives access the the underlying expectException', function (): void {
$this->expectException(InvalidArgumentException::class);
throw new InvalidArgumentException;
expect(fn () => throw new InvalidArgumentException)->toThrow(InvalidArgumentException::class);
});
it('catch exceptions', function (): void {
@@ -27,7 +25,7 @@ it('can just define the code', function (): void {
})->throws(1);
it('not catch exceptions if given condition is false', function (): void {
$this->assertTrue(true);
expect(true)->toBeTrue();
})->throwsIf(false, Exception::class);
it('catch exceptions if given condition is true', function (): void {
@@ -59,7 +57,7 @@ it('can just define the code if given condition is 1', function (): void {
})->throwsIf(1, 1);
it('not catch exceptions if given condition is true', function (): void {
$this->assertTrue(true);
expect(true)->toBeTrue();
})->throwsUnless(true, Exception::class);
it('catch exceptions if given condition is false', function (): void {
+1 -1
View File
@@ -3,7 +3,7 @@
declare(strict_types=1);
test('a test', function (): void {
$this->assertArrayHasKey('key', ['key' => 'foo']);
expect(['key' => 'foo'])->toHaveKey('key');
});
test('higher order message test')->expect(true)->toBeTrue();
+1 -1
View File
@@ -11,6 +11,6 @@ class ExampleTest extends Base\ExampleTest
#[\Override]
public function test_example(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}
@@ -7,7 +7,7 @@ class MyCustomClassTest extends TestCase
{
public function assertTrueIsTrue(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}
@@ -10,6 +10,6 @@ class CustomTestCaseInSubFolder extends TestCase
{
public function assertCustomInSubFolderTrue(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}
@@ -14,7 +14,7 @@ abstract class MyCustomClass extends TestCase
{
public function assertTrueIsTrue(): void
{
$this->assertTrue(true);
expect(true)->toBeTrue();
}
}