Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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

Comment on lines +417 to +422
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this has arisen since we now have a caller (in the TestCase).

-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
Expand Down
84 changes: 84 additions & 0 deletions tests/Unit/Value/CSSStringTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

declare(strict_types=1);

namespace Sabberworm\CSS\Tests\Unit\Value;

use PHPUnit\Framework\TestCase;
use Sabberworm\CSS\Value\CSSString;
use Sabberworm\CSS\Value\PrimitiveValue;
use Sabberworm\CSS\Value\Value;

/**
* @covers \Sabberworm\CSS\Value\CSSString
* @covers \Sabberworm\CSS\Value\PrimitiveValue
* @covers \Sabberworm\CSS\Value\Value
*/
final class CSSStringTest extends TestCase
{
/**
* @test
*/
public function isPrimitiveValue(): void
{
$subject = new CSSString('');

self::assertInstanceOf(PrimitiveValue::class, $subject);
}

/**
* @test
*/
public function isValue(): void
{
$subject = new CSSString('');

self::assertInstanceOf(Value::class, $subject);
}

/**
* @test
*/
public function getStringReturnsStringProvidedToConstructor(): void
{
$string = 'coffee';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

$subject = new CSSString($string);

self::assertSame($string, $subject->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());
}
}