diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 3f311ad1..0de2d16a 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -414,6 +414,12 @@ parameters: count: 1 path: ../src/RuleSet/RuleSet.php + - + message: '#^Parameters should have "string" types as the only types passed to this method$#' + identifier: typePerfect.narrowPublicClassMethodParamType + count: 1 + path: ../src/Value/CSSString.php + - message: '#^Loose comparison via "\!\=" is not allowed\.$#' identifier: notEqual.notAllowed diff --git a/tests/Unit/Value/CSSStringTest.php b/tests/Unit/Value/CSSStringTest.php new file mode 100644 index 00000000..e88f3554 --- /dev/null +++ b/tests/Unit/Value/CSSStringTest.php @@ -0,0 +1,84 @@ +getString()); + } + + /** + * @test + */ + public function setStringSetsString(): void + { + $subject = new CSSString(''); + $string = 'coffee'; + + $subject->setString($string); + + self::assertSame($string, $subject->getString()); + } + + /** + * @test + */ + public function getLineNoByDefaultReturnsZero(): void + { + $subject = new CSSString(''); + + self::assertSame(0, $subject->getLineNo()); + } + + /** + * @test + */ + public function getLineNoReturnsLineNumberProvidedToConstructor(): void + { + $lineNumber = 42; + + $subject = new CSSString('', $lineNumber); + + self::assertSame($lineNumber, $subject->getLineNo()); + } +}