Skip to content

Commit

Permalink
Tests/SetSniffPropertyTest: use named data within data sets
Browse files Browse the repository at this point in the history
This commit adds the parameter name for each item in the data set in an effort to make it more straight forward to update and add tests as it will be more obvious what each key in the data set signifies.

Includes minor array normalization.
Includes making the data type in the docblock more specific.
  • Loading branch information
jrfnl committed Jan 14, 2024
1 parent ecbdc37 commit 08a4b8b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/Core/Ruleset/SetSniffPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testSniffPropertiesGetSetWhenAllowed($name)
*
* @see self::testSniffPropertiesGetSetWhenAllowed()
*
* @return array
* @return array<string, array<string>>
*/
public static function dataSniffPropertiesGetSetWhenAllowed()
{
Expand Down Expand Up @@ -313,34 +313,40 @@ public function testDirectCallWithOldArrayFormatSetsProperty($propertyValue)
*
* @see self::testDirectCallWithOldArrayFormatSetsProperty()
*
* @return array
* @return array<string, array<string, mixed>>
*/
public static function dataDirectCallWithOldArrayFormatSetsProperty()
{
return [
'Property value is not an array (boolean)' => [false],
'Property value is not an array (string)' => ['a string'],
'Property value is an empty array' => [[]],
'Property value is not an array (boolean)' => [
'propertyValue' => false,
],
'Property value is not an array (string)' => [
'propertyValue' => 'a string',
],
'Property value is an empty array' => [
'propertyValue' => [],
],
'Property value is an array without keys' => [
[
'propertyValue' => [
'value',
false,
],
],
'Property value is an array without the "scope" or "value" keys' => [
[
'propertyValue' => [
'key1' => 'value',
'key2' => false,
],
],
'Property value is an array without the "scope" key' => [
[
'propertyValue' => [
'key1' => 'value',
'value' => true,
],
],
'Property value is an array without the "value" key' => [
[
'propertyValue' => [
'scope' => 'value',
'key2' => 1234,
],
Expand Down

0 comments on commit 08a4b8b

Please sign in to comment.