Skip to content

Commit

Permalink
Test: Add test for current phpunit fixers
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 13, 2024
1 parent 1f5d5a5 commit b657f1d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Integration/CodingStandardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function provideFilesToFix(): array
__DIR__ . '/Fixtures/NewPhpFeatures.correct.php.inc',
],
'PhpDoc' => [__DIR__ . '/Fixtures/PhpDoc.wrong.php.inc', __DIR__ . '/Fixtures/PhpDoc.correct.php.inc'],
'PhpUnit' => [__DIR__ . '/Fixtures/PhpUnit.wrong.php.inc', __DIR__ . '/Fixtures/PhpUnit.correct.php.inc'],
];
}

Expand Down
31 changes: 31 additions & 0 deletions tests/Integration/Fixtures/PhpUnit.correct.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php declare(strict_types=1);

namespace Lmc\CodingStandard\Integration\Fixtures;

use PHPUnit\Framework\TestCase;

class PhpUnit extends TestCase
{
// PhpUnitSetUpTearDownVisibilityFixer
protected function setUp(): void
{
parent::setUp();
}

public function testShouldDoSomething(): void
{
$data = true;

// PhpUnitConstructFixer
$this->assertTrue($data);

// PhpUnitDedicateAssertFixer
$this->assertStringContainsString('o', 'foo');

$this->assertSame(1, 2);
// PhpUnitTestCaseStaticMethodCallsFixer
$this->assertSame(1, 2);
// PhpUnitTestCaseStaticMethodCallsFixer
$this->assertSame(1, 2);
}
}
31 changes: 31 additions & 0 deletions tests/Integration/Fixtures/PhpUnit.wrong.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php declare(strict_types=1);

namespace Lmc\CodingStandard\Integration\Fixtures;

use PHPUnit\Framework\TestCase;

class PhpUnit extends TestCase
{
// PhpUnitSetUpTearDownVisibilityFixer
public function setUp(): void
{
parent::setUp();
}

public function testShouldDoSomething(): void
{
$data = true;

// PhpUnitConstructFixer
$this->assertSame(true, $data);

// PhpUnitDedicateAssertFixer
$this->assertTrue(str_contains('foo', 'o'));

$this->assertSame(1, 2);
// PhpUnitTestCaseStaticMethodCallsFixer
self::assertSame(1, 2);
// PhpUnitTestCaseStaticMethodCallsFixer
static::assertSame(1, 2);
}
}

0 comments on commit b657f1d

Please sign in to comment.