Skip to content

Add and clean up the type annotations for the tests #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2021
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
7 changes: 7 additions & 0 deletions tests/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sabberworm\CSS\Tests;

use PHPUnit\Framework\TestCase;
use Sabberworm\CSS\CSSList\Document;
use Sabberworm\CSS\OutputFormat;
use Sabberworm\CSS\Parser;

Expand Down Expand Up @@ -31,8 +32,14 @@ class OutputFormatTest extends TestCase

EOT;

/**
* @var Parser
*/
private $oParser;

/**
* @var Document
*/
private $oDocument;

protected function setUp()
Expand Down
10 changes: 4 additions & 6 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,12 @@ public function missingPropertyValueLenient()
}

/**
* Parse structure for file.
* Parses structure for file.
*
* @param string $sFileName Filename.
* @param Settings|null $oSettings Settings.
* @param string $sFileName
* @param Settings|null $oSettings
*
* @return Document Parsed document.
* @return Document parsed document
*/
private function parsedStructureForFile($sFileName, $oSettings = null)
{
Expand Down Expand Up @@ -1005,8 +1005,6 @@ public function lineNumbersParsing()

/**
* @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
* Credit: This test by @sabberworm (from
* https://github.com/sabberworm/PHP-CSS-Parser/pull/105#issuecomment-229643910 )
*
* @test
*/
Expand Down
64 changes: 56 additions & 8 deletions tests/RuleSet/DeclarationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
class DeclarationBlockTest extends TestCase
{
/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider expandBorderShorthandProvider
*
* @test
* */
*/
public function expandBorderShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -27,6 +30,9 @@ public function expandBorderShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function expandBorderShorthandProvider()
{
return [
Expand All @@ -40,10 +46,13 @@ public function expandBorderShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider expandFontShorthandProvider
*
* @test
* */
*/
public function expandFontShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -54,6 +63,9 @@ public function expandFontShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function expandFontShorthandProvider()
{
return [
Expand Down Expand Up @@ -90,10 +102,13 @@ public function expandFontShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider expandBackgroundShorthandProvider
*
* @test
* */
*/
public function expandBackgroundShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -104,6 +119,9 @@ public function expandBackgroundShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function expandBackgroundShorthandProvider()
{
return [
Expand Down Expand Up @@ -137,10 +155,13 @@ public function expandBackgroundShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider expandDimensionsShorthandProvider
*
* @test
* */
*/
public function expandDimensionsShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -151,6 +172,9 @@ public function expandDimensionsShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function expandDimensionsShorthandProvider()
{
return [
Expand All @@ -169,10 +193,13 @@ public function expandDimensionsShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider createBorderShorthandProvider
*
* @test
* */
*/
public function createBorderShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -183,6 +210,9 @@ public function createBorderShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function createBorderShorthandProvider()
{
return [
Expand All @@ -194,10 +224,13 @@ public function createBorderShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider createFontShorthandProvider
*
* @test
* */
*/
public function createFontShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -208,6 +241,9 @@ public function createFontShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function createFontShorthandProvider()
{
return [
Expand All @@ -231,10 +267,13 @@ public function createFontShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider createDimensionsShorthandProvider
*
* @test
* */
*/
public function createDimensionsShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -245,6 +284,9 @@ public function createDimensionsShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function createDimensionsShorthandProvider()
{
return [
Expand All @@ -263,10 +305,13 @@ public function createDimensionsShorthandProvider()
}

/**
* @param string $sCss
* @param string $sExpected
*
* @dataProvider createBackgroundShorthandProvider
*
* @test
* */
*/
public function createBackgroundShorthand($sCss, $sExpected)
{
$oParser = new Parser($sCss);
Expand All @@ -277,6 +322,9 @@ public function createBackgroundShorthand($sCss, $sExpected)
self::assertSame(trim((string)$oDoc), $sExpected);
}

/**
* @return array<int, array<int, string>>
*/
public function createBackgroundShorthandProvider()
{
return [
Expand Down