Skip to content

Commit 47bac60

Browse files
authored
Merge pull request MyIntervals#327 from oliverklee/task/types/tests
Add and clean up the type annotations for the tests
2 parents 7de0f36 + d397e0e commit 47bac60

File tree

3 files changed

+67
-14
lines changed

3 files changed

+67
-14
lines changed

tests/OutputFormatTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Sabberworm\CSS\Tests;
44

55
use PHPUnit\Framework\TestCase;
6+
use Sabberworm\CSS\CSSList\Document;
67
use Sabberworm\CSS\OutputFormat;
78
use Sabberworm\CSS\Parser;
89

@@ -31,8 +32,14 @@ class OutputFormatTest extends TestCase
3132
3233
EOT;
3334

35+
/**
36+
* @var Parser
37+
*/
3438
private $oParser;
3539

40+
/**
41+
* @var Document
42+
*/
3643
private $oDocument;
3744

3845
protected function setUp()

tests/ParserTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,12 @@ public function missingPropertyValueLenient()
931931
}
932932

933933
/**
934-
* Parse structure for file.
934+
* Parses structure for file.
935935
*
936-
* @param string $sFileName Filename.
937-
* @param Settings|null $oSettings Settings.
936+
* @param string $sFileName
937+
* @param Settings|null $oSettings
938938
*
939-
* @return Document Parsed document.
939+
* @return Document parsed document
940940
*/
941941
private function parsedStructureForFile($sFileName, $oSettings = null)
942942
{
@@ -1005,8 +1005,6 @@ public function lineNumbersParsing()
10051005

10061006
/**
10071007
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
1008-
* Credit: This test by @sabberworm (from
1009-
* https://github.com/sabberworm/PHP-CSS-Parser/pull/105#issuecomment-229643910 )
10101008
*
10111009
* @test
10121010
*/

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
class DeclarationBlockTest extends TestCase
1414
{
1515
/**
16+
* @param string $sCss
17+
* @param string $sExpected
18+
*
1619
* @dataProvider expandBorderShorthandProvider
1720
*
1821
* @test
19-
* */
22+
*/
2023
public function expandBorderShorthand($sCss, $sExpected)
2124
{
2225
$oParser = new Parser($sCss);
@@ -27,6 +30,9 @@ public function expandBorderShorthand($sCss, $sExpected)
2730
self::assertSame(trim((string)$oDoc), $sExpected);
2831
}
2932

33+
/**
34+
* @return array<int, array<int, string>>
35+
*/
3036
public function expandBorderShorthandProvider()
3137
{
3238
return [
@@ -40,10 +46,13 @@ public function expandBorderShorthandProvider()
4046
}
4147

4248
/**
49+
* @param string $sCss
50+
* @param string $sExpected
51+
*
4352
* @dataProvider expandFontShorthandProvider
4453
*
4554
* @test
46-
* */
55+
*/
4756
public function expandFontShorthand($sCss, $sExpected)
4857
{
4958
$oParser = new Parser($sCss);
@@ -54,6 +63,9 @@ public function expandFontShorthand($sCss, $sExpected)
5463
self::assertSame(trim((string)$oDoc), $sExpected);
5564
}
5665

66+
/**
67+
* @return array<int, array<int, string>>
68+
*/
5769
public function expandFontShorthandProvider()
5870
{
5971
return [
@@ -90,10 +102,13 @@ public function expandFontShorthandProvider()
90102
}
91103

92104
/**
105+
* @param string $sCss
106+
* @param string $sExpected
107+
*
93108
* @dataProvider expandBackgroundShorthandProvider
94109
*
95110
* @test
96-
* */
111+
*/
97112
public function expandBackgroundShorthand($sCss, $sExpected)
98113
{
99114
$oParser = new Parser($sCss);
@@ -104,6 +119,9 @@ public function expandBackgroundShorthand($sCss, $sExpected)
104119
self::assertSame(trim((string)$oDoc), $sExpected);
105120
}
106121

122+
/**
123+
* @return array<int, array<int, string>>
124+
*/
107125
public function expandBackgroundShorthandProvider()
108126
{
109127
return [
@@ -137,10 +155,13 @@ public function expandBackgroundShorthandProvider()
137155
}
138156

139157
/**
158+
* @param string $sCss
159+
* @param string $sExpected
160+
*
140161
* @dataProvider expandDimensionsShorthandProvider
141162
*
142163
* @test
143-
* */
164+
*/
144165
public function expandDimensionsShorthand($sCss, $sExpected)
145166
{
146167
$oParser = new Parser($sCss);
@@ -151,6 +172,9 @@ public function expandDimensionsShorthand($sCss, $sExpected)
151172
self::assertSame(trim((string)$oDoc), $sExpected);
152173
}
153174

175+
/**
176+
* @return array<int, array<int, string>>
177+
*/
154178
public function expandDimensionsShorthandProvider()
155179
{
156180
return [
@@ -169,10 +193,13 @@ public function expandDimensionsShorthandProvider()
169193
}
170194

171195
/**
196+
* @param string $sCss
197+
* @param string $sExpected
198+
*
172199
* @dataProvider createBorderShorthandProvider
173200
*
174201
* @test
175-
* */
202+
*/
176203
public function createBorderShorthand($sCss, $sExpected)
177204
{
178205
$oParser = new Parser($sCss);
@@ -183,6 +210,9 @@ public function createBorderShorthand($sCss, $sExpected)
183210
self::assertSame(trim((string)$oDoc), $sExpected);
184211
}
185212

213+
/**
214+
* @return array<int, array<int, string>>
215+
*/
186216
public function createBorderShorthandProvider()
187217
{
188218
return [
@@ -194,10 +224,13 @@ public function createBorderShorthandProvider()
194224
}
195225

196226
/**
227+
* @param string $sCss
228+
* @param string $sExpected
229+
*
197230
* @dataProvider createFontShorthandProvider
198231
*
199232
* @test
200-
* */
233+
*/
201234
public function createFontShorthand($sCss, $sExpected)
202235
{
203236
$oParser = new Parser($sCss);
@@ -208,6 +241,9 @@ public function createFontShorthand($sCss, $sExpected)
208241
self::assertSame(trim((string)$oDoc), $sExpected);
209242
}
210243

244+
/**
245+
* @return array<int, array<int, string>>
246+
*/
211247
public function createFontShorthandProvider()
212248
{
213249
return [
@@ -231,10 +267,13 @@ public function createFontShorthandProvider()
231267
}
232268

233269
/**
270+
* @param string $sCss
271+
* @param string $sExpected
272+
*
234273
* @dataProvider createDimensionsShorthandProvider
235274
*
236275
* @test
237-
* */
276+
*/
238277
public function createDimensionsShorthand($sCss, $sExpected)
239278
{
240279
$oParser = new Parser($sCss);
@@ -245,6 +284,9 @@ public function createDimensionsShorthand($sCss, $sExpected)
245284
self::assertSame(trim((string)$oDoc), $sExpected);
246285
}
247286

287+
/**
288+
* @return array<int, array<int, string>>
289+
*/
248290
public function createDimensionsShorthandProvider()
249291
{
250292
return [
@@ -263,10 +305,13 @@ public function createDimensionsShorthandProvider()
263305
}
264306

265307
/**
308+
* @param string $sCss
309+
* @param string $sExpected
310+
*
266311
* @dataProvider createBackgroundShorthandProvider
267312
*
268313
* @test
269-
* */
314+
*/
270315
public function createBackgroundShorthand($sCss, $sExpected)
271316
{
272317
$oParser = new Parser($sCss);
@@ -277,6 +322,9 @@ public function createBackgroundShorthand($sCss, $sExpected)
277322
self::assertSame(trim((string)$oDoc), $sExpected);
278323
}
279324

325+
/**
326+
* @return array<int, array<int, string>>
327+
*/
280328
public function createBackgroundShorthandProvider()
281329
{
282330
return [

0 commit comments

Comments
 (0)