diff --git a/phpunit.xml b/phpunit.xml index 05218b7c1dd..862fa9baa29 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,6 +15,7 @@ tests/end-to-end/baseline tests/end-to-end/cli + tests/end-to-end/data-provider tests/end-to-end/event tests/end-to-end/execution-order tests/end-to-end/extension diff --git a/tests/_files/DataProviderWithStringKeysTest.php b/tests/_files/DataProviderWithStringKeysTest.php new file mode 100644 index 00000000000..4328f243296 --- /dev/null +++ b/tests/_files/DataProviderWithStringKeysTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture; + +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; + +final class DataProviderWithStringKeysTest extends TestCase +{ + public static function providerMethod(): array + { + return [ + '0 + 0 = 0' => [0, 0, 0], + '0 + 1 = 1' => [0, 1, 1], + '1 + 1 = 3' => [1, 1, 3], + '1 + 0 = 1' => [1, 0, 1], + ]; + } + + #[DataProvider('providerMethod')] + public function testAdd($a, $b, $c): void + { + $this->assertEquals($c, $a + $b); + } +} diff --git a/tests/_files/failure.phpt b/tests/_files/failure.phpt new file mode 100644 index 00000000000..2d76d87f7ab --- /dev/null +++ b/tests/_files/failure.phpt @@ -0,0 +1,7 @@ +--TEST-- +failure +--FILE-- +run($_SERVER['argv']); + +print file_get_contents($logfile); + +unlink($logfile); +--EXPECTF-- + + + + + + + + + PHPUnit\TestFixture\DataProviderTest::testAdd with data set #2%A +Failed asserting that 2 matches expected 3. +%A +%sDataProviderTest.php:%d + + + + + + + + + + PHPUnit\TestFixture\DataProviderWithStringKeysTest::testAdd with data set "1 + 1 = 3"%A +Failed asserting that 2 matches expected 3. +%A +%sDataProviderWithStringKeysTest.php:%d + + + + + + + failure.phptFailed asserting that two strings are equal.%A +--- Expected ++++ Actual +@@ @@ +-'success' ++'failure' +%A +%s:%d + + + diff --git a/tests/end-to-end/generic/dataprovider-log-xml.phpt b/tests/end-to-end/generic/dataprovider-log-xml.phpt deleted file mode 100644 index b96ffb0cc8a..00000000000 --- a/tests/end-to-end/generic/dataprovider-log-xml.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -phpunit --log-junit php://stdout ../../_files/DataProviderTest.php ---FILE-- -run($_SERVER['argv']); - -print file_get_contents($logfile); - -unlink($logfile); ---EXPECTF-- - - - - - - - - PHPUnit\TestFixture\DataProviderTest::testAdd with data set #2%A -Failed asserting that 2 matches expected 3. -%A -%s:%i - - - - -