Skip to content

Commit 145b8ca

Browse files
committed
Tests/BackfillExplicitOctalNotationTest: use named data sets
With non-named data sets, when a test fails, PHPUnit will display the number of the test which failed. With tests which have a _lot_ of data sets, this makes it _interesting_ (and time-consuming) to debug those, as one now has to figure out which of the data sets in the data provider corresponds to that number. Using named data sets makes debugging failing tests more straight forward as PHPUnit will display the data set name instead of the number. Using named data sets also documents what exactly each data set is testing. Includes making the data type in the docblock more specific.
1 parent 118aa7f commit 145b8ca

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/Core/Tokenizer/BackfillExplicitOctalNotationTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,66 +47,66 @@ public function testExplicitOctalNotation($marker, $value, $nextToken, $nextCont
4747
*
4848
* @see testExplicitOctalNotation()
4949
*
50-
* @return array
50+
* @return array<string, array<string, int|string>>
5151
*/
5252
public static function dataExplicitOctalNotation()
5353
{
5454
return [
55-
[
55+
'Explicit octal' => [
5656
'marker' => '/* testExplicitOctal */',
5757
'value' => '0o137041',
5858
'nextToken' => T_SEMICOLON,
5959
'nextContent' => ';',
6060
],
61-
[
61+
'Explicit octal - capitalized O' => [
6262
'marker' => '/* testExplicitOctalCapitalised */',
6363
'value' => '0O137041',
6464
'nextToken' => T_SEMICOLON,
6565
'nextContent' => ';',
6666
],
67-
[
67+
'Explicit octal - with numeric literal separator' => [
6868
'marker' => '/* testExplicitOctalWithNumericSeparator */',
6969
'value' => '0o137_041',
7070
'nextToken' => T_SEMICOLON,
7171
'nextContent' => ';',
7272
],
73-
[
73+
'Invalid explicit octal - numeric literal separator directly after "0o"' => [
7474
'marker' => '/* testInvalid1 */',
7575
'value' => '0',
7676
'nextToken' => T_STRING,
7777
'nextContent' => 'o_137',
7878
],
79-
[
79+
'Invalid explicit octal - numeric literal separator directly after "0O" (capitalized O)' => [
8080
'marker' => '/* testInvalid2 */',
8181
'value' => '0',
8282
'nextToken' => T_STRING,
8383
'nextContent' => 'O_41',
8484
],
85-
[
85+
'Invalid explicit octal - number out of octal range' => [
8686
'marker' => '/* testInvalid3 */',
8787
'value' => '0',
8888
'nextToken' => T_STRING,
8989
'nextContent' => 'o91',
9090
],
91-
[
91+
'Invalid explicit octal - part of the number out of octal range' => [
9292
'marker' => '/* testInvalid4 */',
9393
'value' => '0O2',
9494
'nextToken' => T_LNUMBER,
9595
'nextContent' => '82',
9696
],
97-
[
97+
'Invalid explicit octal - part of the number out of octal range with numeric literal separator after' => [
9898
'marker' => '/* testInvalid5 */',
9999
'value' => '0o2',
100100
'nextToken' => T_LNUMBER,
101101
'nextContent' => '8_2',
102102
],
103-
[
103+
'Invalid explicit octal - part of the number out of octal range with numeric literal separator before' => [
104104
'marker' => '/* testInvalid6 */',
105105
'value' => '0o2',
106106
'nextToken' => T_STRING,
107107
'nextContent' => '_82',
108108
],
109-
[
109+
'Invalid explicit octal - explicit notation without number' => [
110110
'marker' => '/* testInvalid7 */',
111111
'value' => '0',
112112
'nextToken' => T_STRING,

0 commit comments

Comments
 (0)