Skip to content

Commit 32b7fac

Browse files
authored
[TASK] Add more stub tests for getArrayRepresentation() (#1448)
Part of #1440
1 parent b74a000 commit 32b7fac

15 files changed

Lines changed: 241 additions & 0 deletions

tests/Unit/CSSList/AtRuleBlockListTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,16 @@ public function isRootListAlwaysReturnsFalse(): void
144144

145145
self::assertFalse($subject->isRootList());
146146
}
147+
148+
/**
149+
* @test
150+
*/
151+
public function getArrayRepresentationThrowsException(): void
152+
{
153+
$this->expectException(\BadMethodCallException::class);
154+
155+
$subject = new AtRuleBlockList('media');
156+
157+
$subject->getArrayRepresentation();
158+
}
147159
}

tests/Unit/CSSList/CSSBlockListTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,16 @@ public function getAllValuesWithSearchInFunctionArgumentsReturnsValuesInFunction
471471

472472
self::assertSame([$value1, $value2], $result);
473473
}
474+
475+
/**
476+
* @test
477+
*/
478+
public function getArrayRepresentationThrowsException(): void
479+
{
480+
$this->expectException(\BadMethodCallException::class);
481+
482+
$subject = new ConcreteCSSBlockList();
483+
484+
$subject->getArrayRepresentation();
485+
}
474486
}

tests/Unit/CSSList/DocumentTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,16 @@ public function isRootListAlwaysReturnsTrue(): void
6363

6464
self::assertTrue($subject->isRootList());
6565
}
66+
67+
/**
68+
* @test
69+
*/
70+
public function getArrayRepresentationThrowsException(): void
71+
{
72+
$this->expectException(\BadMethodCallException::class);
73+
74+
$subject = new Document();
75+
76+
$subject->getArrayRepresentation();
77+
}
6678
}

tests/Unit/CSSList/KeyFrameTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,16 @@ public function getVendorKeyFrameByDefaultReturnsKeyframes(): void
108108

109109
self::assertSame('keyframes', $subject->getVendorKeyFrame());
110110
}
111+
112+
/**
113+
* @test
114+
*/
115+
public function getArrayRepresentationThrowsException(): void
116+
{
117+
$this->expectException(\BadMethodCallException::class);
118+
119+
$subject = new KeyFrame();
120+
121+
$subject->getArrayRepresentation();
122+
}
111123
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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\KeyframeSelector;
9+
10+
/**
11+
* @covers \Sabberworm\CSS\Property\KeyframeSelector
12+
* @covers \Sabberworm\CSS\Property\Selector
13+
*/
14+
final class KeyframeSelectorTest extends TestCase
15+
{
16+
/**
17+
* @test
18+
*/
19+
public function getArrayRepresentationThrowsException(): void
20+
{
21+
$this->expectException(\BadMethodCallException::class);
22+
23+
$subject = new KeyframeSelector('a');
24+
25+
$subject->getArrayRepresentation();
26+
}
27+
}

tests/Unit/RuleSet/AtRuleSetTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,14 @@ public function implementsCSSListItem(): void
3030
{
3131
self::assertInstanceOf(CSSListItem::class, $this->subject);
3232
}
33+
34+
/**
35+
* @test
36+
*/
37+
public function getArrayRepresentationThrowsException(): void
38+
{
39+
$this->expectException(\BadMethodCallException::class);
40+
41+
$this->subject->getArrayRepresentation();
42+
}
3343
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit\Value;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\Value\CSSFunction;
9+
10+
/**
11+
* @covers \Sabberworm\CSS\Value\CSSFunction
12+
* @covers \Sabberworm\CSS\Value\Value
13+
* @covers \Sabberworm\CSS\Value\ValueList
14+
*/
15+
final class CSSFunctionTest extends TestCase
16+
{
17+
/**
18+
* @test
19+
*/
20+
public function getArrayRepresentationThrowsException(): void
21+
{
22+
$this->expectException(\BadMethodCallException::class);
23+
24+
$subject = new CSSFunction('filter', []);
25+
26+
$subject->getArrayRepresentation();
27+
}
28+
}

tests/Unit/Value/CSSStringTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,16 @@ public function getLineNumberReturnsLineNumberProvidedToConstructor(): void
8080

8181
self::assertSame($lineNumber, $subject->getLineNumber());
8282
}
83+
84+
/**
85+
* @test
86+
*/
87+
public function getArrayRepresentationThrowsException(): void
88+
{
89+
$this->expectException(\BadMethodCallException::class);
90+
91+
$subject = new CSSString('');
92+
93+
$subject->getArrayRepresentation();
94+
}
8395
}

tests/Unit/Value/CalcFunctionTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,16 @@ private function parse(string $css): CalcFunction
198198
self::assertInstanceOf(CalcFunction::class, $function);
199199
return $function;
200200
}
201+
202+
/**
203+
* @test
204+
*/
205+
public function getArrayRepresentationThrowsException(): void
206+
{
207+
$this->expectException(\BadMethodCallException::class);
208+
209+
$subject = new CalcFunction('calc', []);
210+
211+
$subject->getArrayRepresentation();
212+
}
201213
}

tests/Unit/Value/CalcRuleValueListTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,16 @@ public function separatorAlwaysIsComma(): void
5656

5757
self::assertSame(',', $subject->getListSeparator());
5858
}
59+
60+
/**
61+
* @test
62+
*/
63+
public function getArrayRepresentationThrowsException(): void
64+
{
65+
$this->expectException(\BadMethodCallException::class);
66+
67+
$subject = new CalcRuleValueList();
68+
69+
$subject->getArrayRepresentation();
70+
}
5971
}

0 commit comments

Comments
 (0)