Skip to content

Commit 08387d5

Browse files
committed
DataProvider: parses INI files using INI_SCANNER_TYPED mode (BC break)
1 parent 8b22550 commit 08387d5

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Framework/DataProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function load(string $file, string $query = ''): array
3434
throw new \Exception("Data provider '$file' did not return array or Traversable.");
3535
}
3636
} else {
37-
$data = @parse_ini_file($file, process_sections: true); // @ is escalated to exception
37+
$data = @parse_ini_file($file, true, INI_SCANNER_TYPED); // @ is escalated to exception
3838
if ($data === false) {
3939
throw new \Exception("Cannot parse data provider file '$file'.");
4040
}

tests/Framework/DataProvider.load.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ test('', function () {
2424

2525
test('', function () {
2626
$expect = [
27-
'bar 1.2.3' => ['a' => '1'],
28-
'bar' => ['b' => '2'],
27+
'bar 1.2.3' => ['a' => 1],
28+
'bar' => ['b' => 2],
2929
];
3030

3131
Assert::same($expect, DataProvider::load('fixtures/dataprovider.query.ini', ' = bar'));

tests/Framework/TestCase.dataProvider.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ Assert::same([
104104
$test = new MyTest;
105105
$test->runTest('testFileDataProvider');
106106
Assert::same([
107-
['MyTest::testFileDataProvider', ['1', 'b']],
108-
['MyTest::testFileDataProvider', ['a', '2']],
107+
['MyTest::testFileDataProvider', [1, 'b']],
108+
['MyTest::testFileDataProvider', ['a', 2]],
109109
], $test->order);
110110

111111

tests/Framework/fixtures/dataprovider.query.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
'foo 1.2.3 yyy' => [],
55
'foo 2.2.3' => [],
66
'foo 3 xxx' => [],
7-
'bar 1.2.3' => ['a' => '1'],
8-
'bar' => ['b' => '2'],
7+
'bar 1.2.3' => ['a' => 1],
8+
'bar' => ['b' => 2],
99
];

0 commit comments

Comments
 (0)