66
77use PHPUnit \Framework \Attributes \CoversClass ;
88use PHPUnit \Framework \Attributes \DataProvider ;
9+ use PHPUnit \Framework \Attributes \DataProviderExternal ;
910use PHPUnit \Framework \TestCase ;
1011use Redmine \Api \IssueCategory ;
1112use Redmine \Exception \InvalidParameterException ;
1213use Redmine \Http \HttpClient ;
1314use Redmine \Tests \Fixtures \AssertingHttpClient ;
14- use stdClass ;
15+ use Redmine \ Tests \ Fixtures \ TestDataProvider ;
1516
1617#[CoversClass(IssueCategory::class)]
1718class ListNamesByProjectTest extends TestCase
@@ -112,9 +113,9 @@ public function testListNamesByProjectCallsHttpClientOnlyOnce()
112113 }
113114
114115 /**
115- * @dataProvider getInvalidProjectIdentifiers
116+ * @dataProvider Redmine\Tests\Fixtures\TestDataProvider:: getInvalidProjectIdentifiers
116117 */
117- #[DataProvider( 'getInvalidProjectIdentifiers ' )]
118+ #[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers ' )]
118119 public function testListNamesByProjectWithWrongProjectIdentifierThrowsException ($ projectIdentifier )
119120 {
120121 $ api = new IssueCategory ($ this ->createMock (HttpClient::class));
@@ -124,16 +125,4 @@ public function testListNamesByProjectWithWrongProjectIdentifierThrowsException(
124125
125126 $ api ->listNamesByProject ($ projectIdentifier );
126127 }
127-
128- public static function getInvalidProjectIdentifiers (): array
129- {
130- return [
131- 'null ' => [null ],
132- 'true ' => [true ],
133- 'false ' => [false ],
134- 'float ' => [0.0 ],
135- 'array ' => [[]],
136- 'object ' => [new stdClass ()],
137- ];
138- }
139128}
0 commit comments