From 6e2f2f1c1e98ecd86aa89c6547beb742d7385d18 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 11 May 2023 13:02:04 +0200 Subject: A few additional PHPStan rules (#5388) A subset of https://github.com/phpstan/phpstan-strict-rules --- tests/cli/i18n/I18nCompletionValidatorTest.php | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'tests/cli/i18n/I18nCompletionValidatorTest.php') diff --git a/tests/cli/i18n/I18nCompletionValidatorTest.php b/tests/cli/i18n/I18nCompletionValidatorTest.php index 1a361823d..3c6fc99eb 100644 --- a/tests/cli/i18n/I18nCompletionValidatorTest.php +++ b/tests/cli/i18n/I18nCompletionValidatorTest.php @@ -16,23 +16,23 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { public function testDisplayReport(): void { $validator = new I18nCompletionValidator([], []); - $this->assertEquals("There is no data.\n", $validator->displayReport()); + self::assertEquals("There is no data.\n", $validator->displayReport()); $reflectionTotalEntries = new ReflectionProperty(I18nCompletionValidator::class, 'totalEntries'); $reflectionTotalEntries->setAccessible(true); $reflectionTotalEntries->setValue($validator, 100); - $this->assertEquals("Translation is 0.0% complete.\n", $validator->displayReport()); + self::assertEquals("Translation is 0.0% complete.\n", $validator->displayReport()); $reflectionPassEntries = new ReflectionProperty(I18nCompletionValidator::class, 'passEntries'); $reflectionPassEntries->setAccessible(true); $reflectionPassEntries->setValue($validator, 25); - $this->assertEquals("Translation is 25.0% complete.\n", $validator->displayReport()); + self::assertEquals("Translation is 25.0% complete.\n", $validator->displayReport()); $reflectionPassEntries->setValue($validator, 100); - $this->assertEquals("Translation is 100.0% complete.\n", $validator->displayReport()); + self::assertEquals("Translation is 100.0% complete.\n", $validator->displayReport()); $reflectionPassEntries->setValue($validator, 200); @@ -43,8 +43,8 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { public function testValidateWhenNoData(): void { $validator = new I18nCompletionValidator([], []); - $this->assertTrue($validator->validate()); - $this->assertEquals('', $validator->displayResult()); + self::assertTrue($validator->validate()); + self::assertEquals('', $validator->displayResult()); } public function testValidateWhenKeyIsMissing(): void { @@ -57,12 +57,12 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { ], ], []); - $this->assertFalse($validator->validate()); - $this->assertEquals("Missing key file1.l1.l2.k1\nMissing key file2.l1.l2.k1\n", $validator->displayResult()); + self::assertFalse($validator->validate()); + self::assertEquals("Missing key file1.l1.l2.k1\nMissing key file2.l1.l2.k1\n", $validator->displayResult()); } public function testValidateWhenKeyIsIgnored(): void { - $this->value->expects($this->exactly(2)) + $this->value->expects(self::exactly(2)) ->method('isIgnore') ->willReturn(true); @@ -82,15 +82,15 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { ], ]); - $this->assertTrue($validator->validate()); - $this->assertEquals('', $validator->displayResult()); + self::assertTrue($validator->validate()); + self::assertEquals('', $validator->displayResult()); } public function testValidateWhenValueIsEqual(): void { - $this->value->expects($this->exactly(2)) + $this->value->expects(self::exactly(2)) ->method('isIgnore') ->willReturn(false); - $this->value->expects($this->exactly(2)) + $this->value->expects(self::exactly(2)) ->method('equal') ->willReturn(true); @@ -110,15 +110,15 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { ], ]); - $this->assertFalse($validator->validate()); - $this->assertEquals("Untranslated key file1.l1.l2.k1 - \nUntranslated key file2.l1.l2.k1 - \n", $validator->displayResult()); + self::assertFalse($validator->validate()); + self::assertEquals("Untranslated key file1.l1.l2.k1 - \nUntranslated key file2.l1.l2.k1 - \n", $validator->displayResult()); } public function testValidateWhenValueIsDifferent(): void { - $this->value->expects($this->exactly(2)) + $this->value->expects(self::exactly(2)) ->method('isIgnore') ->willReturn(false); - $this->value->expects($this->exactly(2)) + $this->value->expects(self::exactly(2)) ->method('equal') ->willReturn(false); @@ -138,7 +138,7 @@ class I18nCompletionValidatorTest extends PHPUnit\Framework\TestCase { ], ]); - $this->assertTrue($validator->validate()); - $this->assertEquals('', $validator->displayResult()); + self::assertTrue($validator->validate()); + self::assertEquals('', $validator->displayResult()); } } -- cgit v1.2.3