From 4be6d5ce35bace1dcec6880f5136364dd111d4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Mon, 13 May 2024 15:35:25 +0200 Subject: [PATCH] Test: Add test for current phpunit fixers --- tests/Integration/CodingStandardTest.php | 1 + .../Fixtures/PhpUnit.correct.php.inc | 31 +++++++++++++++++++ .../Fixtures/PhpUnit.wrong.php.inc | 31 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 tests/Integration/Fixtures/PhpUnit.correct.php.inc create mode 100644 tests/Integration/Fixtures/PhpUnit.wrong.php.inc diff --git a/tests/Integration/CodingStandardTest.php b/tests/Integration/CodingStandardTest.php index f0c8ac6..4c92ccb 100644 --- a/tests/Integration/CodingStandardTest.php +++ b/tests/Integration/CodingStandardTest.php @@ -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'], ]; } diff --git a/tests/Integration/Fixtures/PhpUnit.correct.php.inc b/tests/Integration/Fixtures/PhpUnit.correct.php.inc new file mode 100644 index 0000000..bc52d30 --- /dev/null +++ b/tests/Integration/Fixtures/PhpUnit.correct.php.inc @@ -0,0 +1,31 @@ +assertTrue($data); + + // PhpUnitDedicateAssertFixer + $this->assertStringContainsString('o', 'foo'); + + $this->assertSame(1, 2); + // PhpUnitTestCaseStaticMethodCallsFixer + $this->assertSame(1, 2); + // PhpUnitTestCaseStaticMethodCallsFixer + $this->assertSame(1, 2); + } +} diff --git a/tests/Integration/Fixtures/PhpUnit.wrong.php.inc b/tests/Integration/Fixtures/PhpUnit.wrong.php.inc new file mode 100644 index 0000000..510e4bb --- /dev/null +++ b/tests/Integration/Fixtures/PhpUnit.wrong.php.inc @@ -0,0 +1,31 @@ +assertSame(true, $data); + + // PhpUnitDedicateAssertFixer + $this->assertTrue(str_contains('foo', 'o')); + + $this->assertSame(1, 2); + // PhpUnitTestCaseStaticMethodCallsFixer + self::assertSame(1, 2); + // PhpUnitTestCaseStaticMethodCallsFixer + static::assertSame(1, 2); + } +}