diff --git a/tests/end-to-end/_files/attribute-based-filtering/phpunit.xml b/tests/end-to-end/_files/attribute-based-filtering/phpunit.xml index 7f0012487d6..0025e227829 100644 --- a/tests/end-to-end/_files/attribute-based-filtering/phpunit.xml +++ b/tests/end-to-end/_files/attribute-based-filtering/phpunit.xml @@ -1,7 +1,7 @@ + bootstrap="src/autoload.php"> tests diff --git a/tests/end-to-end/_files/attribute-based-filtering/src/autoload.php b/tests/end-to-end/_files/attribute-based-filtering/src/autoload.php new file mode 100644 index 00000000000..72277ab24b3 --- /dev/null +++ b/tests/end-to-end/_files/attribute-based-filtering/src/autoload.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +require __DIR__ . '/f.php'; + +require __DIR__ . '/Foo.php'; diff --git a/tests/end-to-end/_files/attribute-based-filtering/src/f.php b/tests/end-to-end/_files/attribute-based-filtering/src/f.php new file mode 100644 index 00000000000..0c98490d30e --- /dev/null +++ b/tests/end-to-end/_files/attribute-based-filtering/src/f.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\AttributeBasedFiltering; + +function f(): bool +{ + return true; +} diff --git a/tests/end-to-end/_files/attribute-based-filtering/tests/CoversTest.php b/tests/end-to-end/_files/attribute-based-filtering/tests/CoversClassTest.php similarity index 91% rename from tests/end-to-end/_files/attribute-based-filtering/tests/CoversTest.php rename to tests/end-to-end/_files/attribute-based-filtering/tests/CoversClassTest.php index e5595432ebd..6a5ecf417b5 100644 --- a/tests/end-to-end/_files/attribute-based-filtering/tests/CoversTest.php +++ b/tests/end-to-end/_files/attribute-based-filtering/tests/CoversClassTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; #[CoversClass(Foo::class)] -final class CoversTest extends TestCase +final class CoversClassTest extends TestCase { public function testOne(): void { diff --git a/tests/end-to-end/_files/attribute-based-filtering/tests/CoversFunctionTest.php b/tests/end-to-end/_files/attribute-based-filtering/tests/CoversFunctionTest.php new file mode 100644 index 00000000000..db81b6e2853 --- /dev/null +++ b/tests/end-to-end/_files/attribute-based-filtering/tests/CoversFunctionTest.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\AttributeBasedFiltering; + +use PHPUnit\Framework\Attributes\CoversFunction; +use PHPUnit\Framework\TestCase; + +#[CoversFunction('PHPUnit\TestFixture\AttributeBasedFiltering\f')] +final class CoversFunctionTest extends TestCase +{ + public function testOne(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/attribute-based-filtering/tests/UsesFunctionTest.php b/tests/end-to-end/_files/attribute-based-filtering/tests/UsesFunctionTest.php new file mode 100644 index 00000000000..aad32abfea7 --- /dev/null +++ b/tests/end-to-end/_files/attribute-based-filtering/tests/UsesFunctionTest.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\AttributeBasedFiltering; + +use PHPUnit\Framework\Attributes\UsesFunction; +use PHPUnit\Framework\TestCase; + +#[UsesFunction('PHPUnit\TestFixture\AttributeBasedFiltering\f')] +final class UsesFunctionTest extends TestCase +{ + public function testOne(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/cli/group/covers-csv.phpt b/tests/end-to-end/cli/group/covers-class-csv.phpt similarity index 85% rename from tests/end-to-end/cli/group/covers-csv.phpt rename to tests/end-to-end/cli/group/covers-class-csv.phpt index 4ff5a6b21f4..ebaaeea1e6c 100644 --- a/tests/end-to-end/cli/group/covers-csv.phpt +++ b/tests/end-to-end/cli/group/covers-class-csv.phpt @@ -17,18 +17,18 @@ PHPUnit Started (PHPUnit %s using %s) Test Runner Triggered Warning (Using comma-separated values with --covers is deprecated and will no longer work in PHPUnit 12. You can use --covers multiple times instead.) Test Runner Configured Event Facade Sealed -Test Suite Loaded (3 tests) +Test Suite Loaded (5 tests) Test Runner Started Test Suite Sorted Test Suite Filtered (1 test) Test Runner Execution Started (1 test) Test Suite Started (CLI Arguments, 1 test) -Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest, 1 test) -Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest, 1 test) Test Suite Finished (CLI Arguments, 1 test) Test Runner Execution Finished Test Runner Finished diff --git a/tests/end-to-end/cli/group/covers.phpt b/tests/end-to-end/cli/group/covers-class.phpt similarity index 83% rename from tests/end-to-end/cli/group/covers.phpt rename to tests/end-to-end/cli/group/covers-class.phpt index 404040369ca..a573705ec4a 100644 --- a/tests/end-to-end/cli/group/covers.phpt +++ b/tests/end-to-end/cli/group/covers-class.phpt @@ -16,18 +16,18 @@ require_once __DIR__ . '/../../../bootstrap.php'; PHPUnit Started (PHPUnit %s using %s) Test Runner Configured Event Facade Sealed -Test Suite Loaded (3 tests) +Test Suite Loaded (5 tests) Test Runner Started Test Suite Sorted Test Suite Filtered (1 test) Test Runner Execution Started (1 test) Test Suite Started (CLI Arguments, 1 test) -Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest, 1 test) -Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest::testOne) -Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversTest, 1 test) +Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest::testOne) +Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversClassTest, 1 test) Test Suite Finished (CLI Arguments, 1 test) Test Runner Execution Finished Test Runner Finished diff --git a/tests/end-to-end/cli/group/covers-function.phpt b/tests/end-to-end/cli/group/covers-function.phpt new file mode 100644 index 00000000000..44b894c98b2 --- /dev/null +++ b/tests/end-to-end/cli/group/covers-function.phpt @@ -0,0 +1,34 @@ +--TEST-- +phpunit --covers PHPUnit\TestFixture\AttributeBasedFiltering\f +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (5 tests) +Test Runner Started +Test Suite Sorted +Test Suite Filtered (1 test) +Test Runner Execution Started (1 test) +Test Suite Started (CLI Arguments, 1 test) +Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest::testOne) +Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest::testOne) +Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest::testOne) +Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest::testOne) +Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\CoversFunctionTest, 1 test) +Test Suite Finished (CLI Arguments, 1 test) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/cli/group/requires-php-extension.phpt b/tests/end-to-end/cli/group/requires-php-extension.phpt index 4f120f50264..4d2e66f33c2 100644 --- a/tests/end-to-end/cli/group/requires-php-extension.phpt +++ b/tests/end-to-end/cli/group/requires-php-extension.phpt @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../../bootstrap.php'; PHPUnit Started (PHPUnit %s using %s) Test Runner Configured Event Facade Sealed -Test Suite Loaded (3 tests) +Test Suite Loaded (5 tests) Test Runner Started Test Suite Sorted Test Suite Filtered (1 test) diff --git a/tests/end-to-end/cli/group/uses-csv.phpt b/tests/end-to-end/cli/group/uses-class-csv.phpt similarity index 98% rename from tests/end-to-end/cli/group/uses-csv.phpt rename to tests/end-to-end/cli/group/uses-class-csv.phpt index ce67c008c45..8527c270d3f 100644 --- a/tests/end-to-end/cli/group/uses-csv.phpt +++ b/tests/end-to-end/cli/group/uses-class-csv.phpt @@ -17,7 +17,7 @@ PHPUnit Started (PHPUnit %s using %s) Test Runner Triggered Warning (Using comma-separated values with --uses is deprecated and will no longer work in PHPUnit 12. You can use --uses multiple times instead.) Test Runner Configured Event Facade Sealed -Test Suite Loaded (3 tests) +Test Suite Loaded (5 tests) Test Runner Started Test Suite Sorted Test Suite Filtered (1 test) diff --git a/tests/end-to-end/cli/group/uses.phpt b/tests/end-to-end/cli/group/uses-class.phpt similarity index 98% rename from tests/end-to-end/cli/group/uses.phpt rename to tests/end-to-end/cli/group/uses-class.phpt index 83b4a57761a..a2631cdf3b0 100644 --- a/tests/end-to-end/cli/group/uses.phpt +++ b/tests/end-to-end/cli/group/uses-class.phpt @@ -16,7 +16,7 @@ require_once __DIR__ . '/../../../bootstrap.php'; PHPUnit Started (PHPUnit %s using %s) Test Runner Configured Event Facade Sealed -Test Suite Loaded (3 tests) +Test Suite Loaded (5 tests) Test Runner Started Test Suite Sorted Test Suite Filtered (1 test) diff --git a/tests/end-to-end/cli/group/uses-function.phpt b/tests/end-to-end/cli/group/uses-function.phpt new file mode 100644 index 00000000000..2b71c3956bb --- /dev/null +++ b/tests/end-to-end/cli/group/uses-function.phpt @@ -0,0 +1,34 @@ +--TEST-- +phpunit --covers PHPUnit\TestFixture\AttributeBasedFiltering\f +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (5 tests) +Test Runner Started +Test Suite Sorted +Test Suite Filtered (1 test) +Test Runner Execution Started (1 test) +Test Suite Started (CLI Arguments, 1 test) +Test Suite Started (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest, 1 test) +Test Preparation Started (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest::testOne) +Test Prepared (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest::testOne) +Test Passed (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest::testOne) +Test Finished (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest::testOne) +Test Suite Finished (PHPUnit\TestFixture\AttributeBasedFiltering\UsesFunctionTest, 1 test) +Test Suite Finished (CLI Arguments, 1 test) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0)