Skip to content

Commit d0e636e

Browse files
committed
[TASK] Add the first tests for Selector
Part of #757
1 parent 9192d95 commit d0e636e

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\FunctionalDeprecated\Selector;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\Property\Selector;
9+
10+
/**
11+
* @covers \Sabberworm\CSS\Property\Selector
12+
*/
13+
final class SelectorTest extends TestCase
14+
{
15+
/**
16+
* @test
17+
*/
18+
public function toStringReturnsPatternPassedToConstructor(): void
19+
{
20+
$pattern = 'a';
21+
$subject = new Selector($pattern);
22+
23+
self::assertSame($pattern, (string) $subject);
24+
}
25+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit\Property;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\Property\Selector;
9+
10+
/**
11+
* @covers \Sabberworm\CSS\Property\Selector
12+
*/
13+
final class SelectorTest extends TestCase
14+
{
15+
/**
16+
* @test
17+
*/
18+
public function getSelectorByDefaultReturnsPatternProvidedToConstructor(): void
19+
{
20+
$pattern = 'a';
21+
$subject = new Selector($pattern);
22+
23+
self::assertSame($pattern, $subject->getSelector());
24+
}
25+
26+
/**
27+
* @test
28+
*/
29+
public function setSelectorOverwritesPatternProvidedToConstructor(): void
30+
{
31+
$subject = new Selector('a');
32+
33+
$pattern = 'input';
34+
$subject->setSelector($pattern);
35+
36+
self::assertSame($pattern, $subject->getSelector());
37+
}
38+
}

0 commit comments

Comments
 (0)