Skip to content

Commit 92da0f0

Browse files
committed
update all tests with invalid project identifiers
1 parent d0b720f commit 92da0f0

File tree

5 files changed

+20
-80
lines changed

5 files changed

+20
-80
lines changed

tests/Unit/Api/IssueCategory/ListByProjectTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Redmine\Tests\Unit\Api\IssueCategory;
44

55
use PHPUnit\Framework\Attributes\CoversClass;
6-
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\Attributes\DataProviderExternal;
77
use PHPUnit\Framework\TestCase;
88
use Redmine\Api\IssueCategory;
99
use Redmine\Client\Client;
1010
use Redmine\Exception\InvalidParameterException;
1111
use Redmine\Exception\UnexpectedResponseException;
1212
use Redmine\Tests\Fixtures\MockClient;
13-
use stdClass;
13+
use Redmine\Tests\Fixtures\TestDataProvider;
1414

1515
#[CoversClass(IssueCategory::class)]
1616
class ListByProjectTest extends TestCase
@@ -71,9 +71,9 @@ public function testListByProjectWithParametersReturnsResponse()
7171
}
7272

7373
/**
74-
* @dataProvider getInvalidProjectIdentifiers
74+
* @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers
7575
*/
76-
#[DataProvider('getInvalidProjectIdentifiers')]
76+
#[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')]
7777
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
7878
{
7979
$api = new IssueCategory(MockClient::create());
@@ -84,18 +84,6 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj
8484
$api->listByProject($projectIdentifier);
8585
}
8686

87-
public static function getInvalidProjectIdentifiers(): array
88-
{
89-
return [
90-
'null' => [null],
91-
'true' => [true],
92-
'false' => [false],
93-
'float' => [0.0],
94-
'array' => [[]],
95-
'object' => [new stdClass()],
96-
];
97-
}
98-
9987
public function testListByProjectThrowsException()
10088
{
10189
// Create the used mock objects

tests/Unit/Api/Membership/ListByProjectTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Redmine\Tests\Unit\Api\Membership;
44

55
use PHPUnit\Framework\Attributes\CoversClass;
6-
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\Attributes\DataProviderExternal;
77
use PHPUnit\Framework\TestCase;
88
use Redmine\Api\Membership;
99
use Redmine\Client\Client;
1010
use Redmine\Exception\InvalidParameterException;
1111
use Redmine\Exception\UnexpectedResponseException;
1212
use Redmine\Tests\Fixtures\MockClient;
13-
use stdClass;
13+
use Redmine\Tests\Fixtures\TestDataProvider;
1414

1515
#[CoversClass(Membership::class)]
1616
class ListByProjectTest extends TestCase
@@ -69,9 +69,9 @@ public function testListByProjectWithParametersReturnsResponse()
6969
}
7070

7171
/**
72-
* @dataProvider getInvalidProjectIdentifiers
72+
* @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers
7373
*/
74-
#[DataProvider('getInvalidProjectIdentifiers')]
74+
#[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')]
7575
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
7676
{
7777
$api = new Membership(MockClient::create());
@@ -82,18 +82,6 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj
8282
$api->listByProject($projectIdentifier);
8383
}
8484

85-
public static function getInvalidProjectIdentifiers(): array
86-
{
87-
return [
88-
'null' => [null],
89-
'true' => [true],
90-
'false' => [false],
91-
'float' => [0.0],
92-
'array' => [[]],
93-
'object' => [new stdClass()],
94-
];
95-
}
96-
9785
public function testListByProjectThrowsException()
9886
{
9987
// Create the used mock objects

tests/Unit/Api/News/ListByProjectTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Redmine\Tests\Unit\Api\News;
44

55
use PHPUnit\Framework\Attributes\CoversClass;
6-
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\Attributes\DataProviderExternal;
77
use PHPUnit\Framework\TestCase;
88
use Redmine\Api\News;
99
use Redmine\Client\Client;
1010
use Redmine\Exception\InvalidParameterException;
1111
use Redmine\Exception\UnexpectedResponseException;
1212
use Redmine\Tests\Fixtures\MockClient;
13-
use stdClass;
13+
use Redmine\Tests\Fixtures\TestDataProvider;
1414

1515
#[CoversClass(News::class)]
1616
class ListByProjectTest extends TestCase
@@ -71,9 +71,9 @@ public function testListByProjectWithParametersReturnsResponse()
7171
}
7272

7373
/**
74-
* @dataProvider getInvalidProjectIdentifiers
74+
* @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers
7575
*/
76-
#[DataProvider('getInvalidProjectIdentifiers')]
76+
#[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')]
7777
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
7878
{
7979
$api = new News(MockClient::create());
@@ -84,18 +84,6 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj
8484
$api->listByProject($projectIdentifier);
8585
}
8686

87-
public static function getInvalidProjectIdentifiers(): array
88-
{
89-
return [
90-
'null' => [null],
91-
'true' => [true],
92-
'false' => [false],
93-
'float' => [0.0],
94-
'array' => [[]],
95-
'object' => [new stdClass()],
96-
];
97-
}
98-
9987
public function testListByProjectThrowsException()
10088
{
10189
// Create the used mock objects

tests/Unit/Api/Version/ListByProjectTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Redmine\Tests\Unit\Api\Version;
44

55
use PHPUnit\Framework\Attributes\CoversClass;
6-
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\Attributes\DataProviderExternal;
77
use PHPUnit\Framework\TestCase;
88
use Redmine\Api\Version;
99
use Redmine\Client\Client;
1010
use Redmine\Exception\InvalidParameterException;
1111
use Redmine\Exception\UnexpectedResponseException;
1212
use Redmine\Tests\Fixtures\MockClient;
13-
use stdClass;
13+
use Redmine\Tests\Fixtures\TestDataProvider;
1414

1515
#[CoversClass(Version::class)]
1616
class ListByProjectTest extends TestCase
@@ -72,9 +72,9 @@ public function testListByProjectWithParametersReturnsResponse()
7272
}
7373

7474
/**
75-
* @dataProvider getInvalidProjectIdentifiers
75+
* @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers
7676
*/
77-
#[DataProvider('getInvalidProjectIdentifiers')]
77+
#[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')]
7878
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
7979
{
8080
$api = new Version(MockClient::create());
@@ -85,18 +85,6 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj
8585
$api->listByProject($projectIdentifier);
8686
}
8787

88-
public static function getInvalidProjectIdentifiers(): array
89-
{
90-
return [
91-
'null' => [null],
92-
'true' => [true],
93-
'false' => [false],
94-
'float' => [0.0],
95-
'array' => [[]],
96-
'object' => [new stdClass()],
97-
];
98-
}
99-
10088
public function testListByProjectThrowsException()
10189
{
10290
// Create the used mock objects

tests/Unit/Api/Wiki/ListByProjectTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Redmine\Tests\Unit\Api\Wiki;
44

55
use PHPUnit\Framework\Attributes\CoversClass;
6-
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\Attributes\DataProviderExternal;
77
use PHPUnit\Framework\TestCase;
88
use Redmine\Api\Wiki;
99
use Redmine\Client\Client;
1010
use Redmine\Exception\InvalidParameterException;
1111
use Redmine\Exception\UnexpectedResponseException;
1212
use Redmine\Tests\Fixtures\MockClient;
13-
use stdClass;
13+
use Redmine\Tests\Fixtures\TestDataProvider;
1414

1515
#[CoversClass(Wiki::class)]
1616
class ListByProjectTest extends TestCase
@@ -72,9 +72,9 @@ public function testListByProjectWithParametersReturnsResponse()
7272
}
7373

7474
/**
75-
* @dataProvider getInvalidProjectIdentifiers
75+
* @dataProvider Redmine\Tests\Fixtures\TestDataProvider::getInvalidProjectIdentifiers
7676
*/
77-
#[DataProvider('getInvalidProjectIdentifiers')]
77+
#[DataProviderExternal(TestDataProvider::class, 'getInvalidProjectIdentifiers')]
7878
public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier)
7979
{
8080
$api = new Wiki(MockClient::create());
@@ -85,18 +85,6 @@ public function testListByProjectWithWrongProjectIdentifierThrowsException($proj
8585
$api->listByProject($projectIdentifier);
8686
}
8787

88-
public static function getInvalidProjectIdentifiers(): array
89-
{
90-
return [
91-
'null' => [null],
92-
'true' => [true],
93-
'false' => [false],
94-
'float' => [0.0],
95-
'array' => [[]],
96-
'object' => [new stdClass()],
97-
];
98-
}
99-
10088
public function testListByProjectThrowsException()
10189
{
10290
// Create the used mock objects

0 commit comments

Comments
 (0)