From 9def2430108d867615145e612419f64f7dc8f194 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 15 Nov 2021 13:23:58 +0900 Subject: [PATCH 1/2] chore: add PHPUnitSetList::PHPUNIT_80 and remove skip of AssertFalseStrposToContainsRector --- rector.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rector.php b/rector.php index 829ec303e0f4..92636b0bfdd5 100644 --- a/rector.php +++ b/rector.php @@ -42,7 +42,6 @@ use Rector\Php71\Rector\FuncCall\CountOnNullRector; use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; -use Rector\PHPUnit\Rector\MethodCall\AssertFalseStrposToContainsRector; use Rector\PHPUnit\Rector\MethodCall\AssertIssetToSpecificMethodRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -57,6 +56,7 @@ $containerConfigurator->import(SetList::DEAD_CODE); $containerConfigurator->import(LevelSetList::UP_TO_PHP_73); $containerConfigurator->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD); + $containerConfigurator->import(PHPUnitSetList::PHPUNIT_80); $parameters = $containerConfigurator->parameters(); @@ -122,9 +122,6 @@ __DIR__ . '/tests/system/Entity/EntityTest.php', __DIR__ . '/tests/system/Session/SessionTest.php', ], - - // assertContains() to string can't be used in PHPUnit 9.1 - AssertFalseStrposToContainsRector::class, ]); // auto import fully qualified class names From 3cf95b599a59a1569378aa20fe944e096bc6ca4a Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 15 Nov 2021 13:25:13 +0900 Subject: [PATCH 2/2] test: refactor: vendor/bin/rector process tests/system/ --- tests/system/HTTP/ResponseTest.php | 4 ++-- tests/system/View/ViewTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index 64eab48dc0fa..b4eba4c547c9 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -327,7 +327,7 @@ public function testJSONWithArray() $response->setJSON($body); $this->assertSame($expected, $response->getJSON()); - $this->assertNotFalse(strpos($response->getHeaderLine('content-type'), 'application/json')); + $this->assertStringContainsString('application/json', $response->getHeaderLine('content-type')); } public function testJSONGetFromNormalBody() @@ -364,7 +364,7 @@ public function testXMLWithArray() $response->setXML($body); $this->assertSame($expected, $response->getXML()); - $this->assertNotFalse(strpos($response->getHeaderLine('content-type'), 'application/xml')); + $this->assertStringContainsString('application/xml', $response->getHeaderLine('content-type')); } public function testXMLGetFromNormalBody() diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index 435c4d8f9578..d740e17a4c34 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -316,8 +316,8 @@ public function testRenderLayoutWithInclude() $content = $view->render('extend_include'); - $this->assertNotFalse(strpos($content, '

Open

')); - $this->assertNotFalse(strpos($content, '

Hello World

')); + $this->assertStringContainsString('

Open

', $content); + $this->assertStringContainsString('

Hello World

', $content); $this->assertSame(2, substr_count($content, 'Hello World')); }