Skip to content

Commit 67578e6

Browse files
authored
Merge pull request #292 from oliverklee/bugfix/rule-value-list-constructor
Fix parent constructor calls in `CalcRuleValueList`
2 parents 6c84059 + ba30c03 commit 67578e6

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@ parameters:
2020
count: 1
2121
path: ../src/Value/CalcFunction.php
2222

23-
-
24-
message: "#^Method Sabberworm\\\\CSS\\\\Value\\\\RuleValueList\\:\\:__construct\\(\\) invoked with 3 parameters, 0\\-2 required\\.$#"
25-
count: 1
26-
path: ../src/Value/CalcRuleValueList.php
27-

src/Value/CalcRuleValueList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CalcRuleValueList extends RuleValueList
1111
*/
1212
public function __construct($iLineNo = 0)
1313
{
14-
parent::__construct([], ',', $iLineNo);
14+
parent::__construct(',', $iLineNo);
1515
}
1616

1717
/**

tests/Value/CalcRuleValueListTest.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace Sabberworm\CSS\Tests\Value;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Sabberworm\CSS\Value\CalcRuleValueList;
7+
use Sabberworm\CSS\Value\RuleValueList;
8+
9+
/**
10+
* @covers \Sabberworm\CSS\Value\CalcRuleValueList
11+
*/
12+
class CalcRuleValueListTest extends TestCase
13+
{
14+
/**
15+
* @test
16+
*/
17+
public function isRuleValueList()
18+
{
19+
$subject = new CalcRuleValueList();
20+
21+
self::assertInstanceOf(RuleValueList::class, $subject);
22+
}
23+
24+
/**
25+
* @test
26+
*/
27+
public function getLineNumberByDefaultReturnsZero()
28+
{
29+
$subject = new CalcRuleValueList();
30+
31+
self::assertSame(0, $subject->getLineNo());
32+
}
33+
34+
/**
35+
* @test
36+
*/
37+
public function getLineNoReturnsLineNumberProvidedToConstructor()
38+
{
39+
$lineNumber = 42;
40+
41+
$subject = new CalcRuleValueList($lineNumber);
42+
43+
self::assertSame($lineNumber, $subject->getLineNo());
44+
}
45+
46+
/**
47+
* @test
48+
*/
49+
public function separatorAlwaysIsComma()
50+
{
51+
$subject = new CalcRuleValueList();
52+
53+
self::assertSame(',', $subject->getListSeparator());
54+
}
55+
}

0 commit comments

Comments
 (0)