From a31c99de32d0a1840ccd071602ccc4a957302543 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 9 Oct 2023 14:55:34 +0200 Subject: [PATCH] fix tests --- .../{ListTest.php => ListByProjectTest.php} | 24 +++++++++---------- tests/Unit/Api/IssueCategoryTest.php | 2 +- .../{ListTest.php => ListByIssueIdTest.php} | 16 ++++++------- tests/Unit/Api/IssueRelationTest.php | 2 +- .../{ListTest.php => ListByProjectTest.php} | 24 +++++++++---------- tests/Unit/Api/MembershipTest.php | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) rename tests/Unit/Api/IssueCategory/{ListTest.php => ListByProjectTest.php} (77%) rename tests/Unit/Api/IssueRelation/{ListTest.php => ListByIssueIdTest.php} (79%) rename tests/Unit/Api/Membership/{ListTest.php => ListByProjectTest.php} (77%) diff --git a/tests/Unit/Api/IssueCategory/ListTest.php b/tests/Unit/Api/IssueCategory/ListByProjectTest.php similarity index 77% rename from tests/Unit/Api/IssueCategory/ListTest.php rename to tests/Unit/Api/IssueCategory/ListByProjectTest.php index fae49397..d91d962a 100644 --- a/tests/Unit/Api/IssueCategory/ListTest.php +++ b/tests/Unit/Api/IssueCategory/ListByProjectTest.php @@ -10,14 +10,14 @@ use stdClass; /** - * Tests for IssueCategory::list() + * Tests for IssueCategory::listByProject() */ -class ListTest extends TestCase +class ListByProjectTest extends TestCase { /** - * @covers \Redmine\Api\IssueCategory::list + * @covers \Redmine\Api\IssueCategory::listByProject */ - public function testListWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse() { // Test values $projectId = 5; @@ -43,13 +43,13 @@ public function testListWithoutParametersReturnsResponse() $api = new IssueCategory($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list($projectId)); + $this->assertSame($expectedReturn, $api->listByProject($projectId)); } /** - * @covers \Redmine\Api\IssueCategory::list + * @covers \Redmine\Api\IssueCategory::listByProject */ - public function testListWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse() { // Test values $projectId = 'project-slug'; @@ -79,22 +79,22 @@ public function testListWithParametersReturnsResponse() $api = new IssueCategory($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list($projectId, $parameters)); + $this->assertSame($expectedReturn, $api->listByProject($projectId, $parameters)); } /** - * @covers \Redmine\Api\IssueCategory::list + * @covers \Redmine\Api\IssueCategory::listByProject * * @dataProvider getInvalidProjectIdentifiers */ - public function testListWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new IssueCategory(MockClient::create()); $this->expectException(InvalidParameterException::class); - $this->expectExceptionMessage('Redmine\Api\IssueCategory::list(): Argument #1 ($projectIdentifier) must be of type int or string'); + $this->expectExceptionMessage('Redmine\Api\IssueCategory::listByProject(): Argument #1 ($projectIdentifier) must be of type int or string'); - $api->list($projectIdentifier); + $api->listByProject($projectIdentifier); } public static function getInvalidProjectIdentifiers(): array diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index 5780e21c..affdd957 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -28,7 +28,7 @@ public function testAllTriggersDeprecationWarning() set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - '`Redmine\Api\IssueCategory::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueCategory::list()` instead.', + '`Redmine\Api\IssueCategory::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueCategory::listByProject()` instead.', $errstr ); diff --git a/tests/Unit/Api/IssueRelation/ListTest.php b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php similarity index 79% rename from tests/Unit/Api/IssueRelation/ListTest.php rename to tests/Unit/Api/IssueRelation/ListByIssueIdTest.php index d06694ea..9ba3ce19 100644 --- a/tests/Unit/Api/IssueRelation/ListTest.php +++ b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php @@ -7,14 +7,14 @@ use Redmine\Client\Client; /** - * Tests for IssueRelation::list() + * Tests for IssueRelation::listByIssueId() */ -class ListTest extends TestCase +class ListByIssueIdTest extends TestCase { /** - * @covers \Redmine\Api\IssueRelation::list + * @covers \Redmine\Api\IssueRelation::listByIssueId */ - public function testListWithoutParametersReturnsResponse() + public function testListByIssueIdWithoutParametersReturnsResponse() { // Test values $response = '["API Response"]'; @@ -39,13 +39,13 @@ public function testListWithoutParametersReturnsResponse() $api = new IssueRelation($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list(5)); + $this->assertSame($expectedReturn, $api->listByIssueId(5)); } /** - * @covers \Redmine\Api\IssuePriority::list + * @covers \Redmine\Api\IssueRelation::listByIssueId */ - public function testListWithParametersReturnsResponse() + public function testListByIssueIdWithParametersReturnsResponse() { // Test values $parameters = ['not-used']; @@ -74,6 +74,6 @@ public function testListWithParametersReturnsResponse() $api = new IssueRelation($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list(5, $parameters)); + $this->assertSame($expectedReturn, $api->listByIssueId(5, $parameters)); } } diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index 9b975d0b..f2236b79 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -27,7 +27,7 @@ public function testAllTriggersDeprecationWarning() set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - '`Redmine\Api\IssueRelation::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueRelation::list()` instead.', + '`Redmine\Api\IssueRelation::all()` is deprecated since v2.4.0, use `Redmine\Api\IssueRelation::listByIssueId()` instead.', $errstr ); diff --git a/tests/Unit/Api/Membership/ListTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php similarity index 77% rename from tests/Unit/Api/Membership/ListTest.php rename to tests/Unit/Api/Membership/ListByProjectTest.php index d405dd60..1d0df356 100644 --- a/tests/Unit/Api/Membership/ListTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -10,14 +10,14 @@ use stdClass; /** - * Tests for Membership::list() + * Tests for Membership::listByProject() */ -class ListTest extends TestCase +class ListByProjectTest extends TestCase { /** - * @covers \Redmine\Api\Membership::list + * @covers \Redmine\Api\Membership::listByProject */ - public function testListWithoutParametersReturnsResponse() + public function testListByProjectWithoutParametersReturnsResponse() { // Test values $response = '["API Response"]'; @@ -42,13 +42,13 @@ public function testListWithoutParametersReturnsResponse() $api = new Membership($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list(5)); + $this->assertSame($expectedReturn, $api->listByProject(5)); } /** - * @covers \Redmine\Api\Membership::list + * @covers \Redmine\Api\Membership::listByProject */ - public function testListWithParametersReturnsResponse() + public function testListByProjectWithParametersReturnsResponse() { // Test values $parameters = ['not-used']; @@ -77,22 +77,22 @@ public function testListWithParametersReturnsResponse() $api = new Membership($client); // Perform the tests - $this->assertSame($expectedReturn, $api->list('project-slug', $parameters)); + $this->assertSame($expectedReturn, $api->listByProject('project-slug', $parameters)); } /** - * @covers \Redmine\Api\Membership::list + * @covers \Redmine\Api\Membership::listByProject * * @dataProvider getInvalidProjectIdentifiers */ - public function testListWithWrongProjectIdentifierThrowsException($projectIdentifier) + public function testListByProjectWithWrongProjectIdentifierThrowsException($projectIdentifier) { $api = new Membership(MockClient::create()); $this->expectException(InvalidParameterException::class); - $this->expectExceptionMessage('Redmine\Api\Membership::list(): Argument #1 ($projectIdentifier) must be of type int or string'); + $this->expectExceptionMessage('Redmine\Api\Membership::listByProject(): Argument #1 ($projectIdentifier) must be of type int or string'); - $api->list($projectIdentifier); + $api->listByProject($projectIdentifier); } public static function getInvalidProjectIdentifiers(): array diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index 7b5e6651..a27035a2 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -29,7 +29,7 @@ public function testAllTriggersDeprecationWarning() set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - '`Redmine\Api\Membership::all()` is deprecated since v2.4.0, use `Redmine\Api\Membership::list()` instead.', + '`Redmine\Api\Membership::all()` is deprecated since v2.4.0, use `Redmine\Api\Membership::listByProject()` instead.', $errstr );