File tree Expand file tree Collapse file tree 4 files changed +53
-4
lines changed
_files/Metadata/Attribute/tests Expand file tree Collapse file tree 4 files changed +53
-4
lines changed Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ public static function testDoxOnMethod(string $text): TestDox
413
413
return new TestDox (self ::METHOD_LEVEL , $ text );
414
414
}
415
415
416
- public static function testWith (array $ data ): TestWith
416
+ public static function testWith (mixed $ data ): TestWith
417
417
{
418
418
return new TestWith (self ::METHOD_LEVEL , $ data );
419
419
}
Original file line number Diff line number Diff line change 16
16
*/
17
17
final class TestWith extends Metadata
18
18
{
19
- private readonly array $ data ;
19
+ private readonly mixed $ data ;
20
20
21
21
/**
22
22
* @psalm-param 0|1 $level
23
23
*/
24
- protected function __construct (int $ level , array $ data )
24
+ protected function __construct (int $ level , mixed $ data )
25
25
{
26
26
parent ::__construct ($ level );
27
27
@@ -36,7 +36,7 @@ public function isTestWith(): bool
36
36
return true ;
37
37
}
38
38
39
- public function data (): array
39
+ public function data (): mixed
40
40
{
41
41
return $ this ->data ;
42
42
}
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+ /*
3
+ * This file is part of PHPUnit.
4
+ *
5
+ * (c) Sebastian Bergmann <[email protected] >
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ namespace PHPUnit \TestFixture \Metadata \Attribute ;
11
+
12
+ use PHPUnit \Framework \Attributes \TestWithJson ;
13
+ use PHPUnit \Framework \TestCase ;
14
+
15
+ final class TestWithInvalidValueTest extends TestCase
16
+ {
17
+ #[TestWithJson('false ' )]
18
+ public function testOne ($ one , $ two ): void
19
+ {
20
+ $ this ->assertTrue (true );
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ The right events are emitted in the right order for a test that uses a TestWithJson attribute which provides an invalid value
3
+ --FILE--
4
+ <?php declare (strict_types=1 );
5
+ $ _SERVER ['argv ' ][] = '--do-not-cache-result ' ;
6
+ $ _SERVER ['argv ' ][] = '--no-configuration ' ;
7
+ $ _SERVER ['argv ' ][] = '--debug ' ;
8
+ $ _SERVER ['argv ' ][] = __DIR__ . '/../../_files/Metadata/Attribute/tests/TestWithInvalidValueTest.php ' ;
9
+
10
+ require __DIR__ . '/../../bootstrap.php ' ;
11
+
12
+ (new PHPUnit \TextUI \Application )->run ($ _SERVER ['argv ' ]);
13
+ --EXPECTF --
14
+ PHPUnit Started (PHPUnit %s using %s)
15
+ Test Runner Configured
16
+ Test Triggered PHPUnit Error (PHPUnit \TestFixture \Metadata \Attribute \TestWithInvalidValueTest::testOne)
17
+ The data provider specified for PHPUnit \TestFixture \Metadata \Attribute \TestWithInvalidValueTest::testOne is invalid
18
+ Data set #0 is invalid
19
+ Test Runner Triggered Warning (No tests found in class "PHPUnit\TestFixture\Metadata\Attribute\TestWithInvalidValueTest " .)
20
+ Test Suite Loaded (0 tests)
21
+ Event Facade Sealed
22
+ Test Runner Started
23
+ Test Suite Sorted
24
+ Test Runner Execution Started (0 tests)
25
+ Test Runner Execution Finished
26
+ Test Runner Finished
27
+ PHPUnit Finished (Shell Exit Code: 2 )
You can’t perform that action at this time.
0 commit comments