Skip to content

Commit

Permalink
Tests/GetClassPropertiesTest: : minor improvements
Browse files Browse the repository at this point in the history
* Add parameter names as indexes in the data sets in data providers.
* Improve type specificity in the docblocks.
  • Loading branch information
jrfnl committed Jan 2, 2024
1 parent b43fb8e commit 5630c3b
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions tests/Core/File/GetClassPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class GetClassPropertiesTest extends AbstractMethodUnitTest
/**
* Test receiving an expected exception when a non class token is passed.
*
* @param string $testMarker The comment which prefaces the target token in the test file.
* @param array $tokenType The type of token to look for after the marker.
* @param string $testMarker The comment which prefaces the target token in the test file.
* @param int|string $tokenType The type of token to look for after the marker.
*
* @dataProvider dataNotAClassException
*
Expand All @@ -45,22 +45,22 @@ public function testNotAClassException($testMarker, $tokenType)
*
* @see testNotAClassException() For the array format.
*
* @return array
* @return array<string, array<string, string|int>>
*/
public function dataNotAClassException()
{
return [
'interface' => [
'/* testNotAClass */',
\T_INTERFACE,
'testMarker' => '/* testNotAClass */',
'tokenType' => \T_INTERFACE,
],
'anon-class' => [
'/* testAnonClass */',
\T_ANON_CLASS,
'testMarker' => '/* testAnonClass */',
'tokenType' => \T_ANON_CLASS,
],
'enum' => [
'/* testEnum */',
\T_ENUM,
'testMarker' => '/* testEnum */',
'tokenType' => \T_ENUM,
],
];

Expand All @@ -70,8 +70,8 @@ public function dataNotAClassException()
/**
* Test retrieving the properties for a class declaration.
*
* @param string $testMarker The comment which prefaces the target token in the test file.
* @param array $expected Expected function output.
* @param string $testMarker The comment which prefaces the target token in the test file.
* @param array<string, bool> $expected Expected function output.
*
* @dataProvider dataGetClassProperties
*
Expand All @@ -91,94 +91,94 @@ public function testGetClassProperties($testMarker, $expected)
*
* @see testGetClassProperties() For the array format.
*
* @return array
* @return array<string, array<string, string|array<string, bool|int>>>
*/
public function dataGetClassProperties()
{
return [
'no-properties' => [
'/* testClassWithoutProperties */',
[
'testMarker' => '/* testClassWithoutProperties */',
'expected' => [
'is_abstract' => false,
'is_final' => false,
'is_readonly' => false,
],
],
'abstract' => [
'/* testAbstractClass */',
[
'testMarker' => '/* testAbstractClass */',
'expected' => [
'is_abstract' => true,
'is_final' => false,
'is_readonly' => false,
],
],
'final' => [
'/* testFinalClass */',
[
'testMarker' => '/* testFinalClass */',
'expected' => [
'is_abstract' => false,
'is_final' => true,
'is_readonly' => false,
],
],
'readonly' => [
'/* testReadonlyClass */',
[
'testMarker' => '/* testReadonlyClass */',
'expected' => [
'is_abstract' => false,
'is_final' => false,
'is_readonly' => true,
],
],
'final-readonly' => [
'/* testFinalReadonlyClass */',
[
'testMarker' => '/* testFinalReadonlyClass */',
'expected' => [
'is_abstract' => false,
'is_final' => true,
'is_readonly' => true,
],
],
'readonly-final' => [
'/* testReadonlyFinalClass */',
[
'testMarker' => '/* testReadonlyFinalClass */',
'expected' => [
'is_abstract' => false,
'is_final' => true,
'is_readonly' => true,
],
],
'abstract-readonly' => [
'/* testAbstractReadonlyClass */',
[
'testMarker' => '/* testAbstractReadonlyClass */',
'expected' => [
'is_abstract' => true,
'is_final' => false,
'is_readonly' => true,
],
],
'readonly-abstract' => [
'/* testReadonlyAbstractClass */',
[
'testMarker' => '/* testReadonlyAbstractClass */',
'expected' => [
'is_abstract' => true,
'is_final' => false,
'is_readonly' => true,
],
],
'comments-and-new-lines' => [
'/* testWithCommentsAndNewLines */',
[
'testMarker' => '/* testWithCommentsAndNewLines */',
'expected' => [
'is_abstract' => true,
'is_final' => false,
'is_readonly' => false,
],
],
'no-properties-with-docblock' => [
'/* testWithDocblockWithoutProperties */',
[
'testMarker' => '/* testWithDocblockWithoutProperties */',
'expected' => [
'is_abstract' => false,
'is_final' => false,
'is_readonly' => false,
],
],
'abstract-final-parse-error' => [
'/* testParseErrorAbstractFinal */',
[
'testMarker' => '/* testParseErrorAbstractFinal */',
'expected' => [
'is_abstract' => true,
'is_final' => true,
'is_readonly' => false,
Expand Down

0 comments on commit 5630c3b

Please sign in to comment.