From 97786ea3000d1e34b4cc1f1546221b76abc620f4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 10 Oct 2023 13:32:30 +0200 Subject: [PATCH] test for correct requested url --- tests/Unit/Api/CustomField/ListTest.php | 8 ++------ tests/Unit/Api/Group/ListTest.php | 11 ++--------- tests/Unit/Api/Issue/ListTest.php | 11 ++--------- tests/Unit/Api/IssueCategory/ListByProjectTest.php | 11 ++--------- tests/Unit/Api/IssuePriority/ListTest.php | 8 ++------ tests/Unit/Api/IssueRelation/ListByIssueIdTest.php | 11 ++--------- tests/Unit/Api/IssueStatus/ListTest.php | 11 ++--------- tests/Unit/Api/Membership/ListByProjectTest.php | 11 ++--------- tests/Unit/Api/News/ListByProjectTest.php | 8 ++------ tests/Unit/Api/News/ListTest.php | 11 ++--------- tests/Unit/Api/Project/ListTest.php | 7 +------ tests/Unit/Api/Query/ListTest.php | 11 ++--------- tests/Unit/Api/Role/ListTest.php | 11 ++--------- tests/Unit/Api/TimeEntry/ListTest.php | 9 +-------- tests/Unit/Api/TimeEntryActivity/ListTest.php | 11 ++--------- tests/Unit/Api/Tracker/ListTest.php | 11 ++--------- 16 files changed, 30 insertions(+), 131 deletions(-) diff --git a/tests/Unit/Api/CustomField/ListTest.php b/tests/Unit/Api/CustomField/ListTest.php index e36108dd..bf67684a 100644 --- a/tests/Unit/Api/CustomField/ListTest.php +++ b/tests/Unit/Api/CustomField/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/custom_fields.json') - ) + ->with('/custom_fields.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,9 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringContains('not-used') - ) + ->with('/custom_fields.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Group/ListTest.php b/tests/Unit/Api/Group/ListTest.php index e0defcc9..5e8cfdaa 100644 --- a/tests/Unit/Api/Group/ListTest.php +++ b/tests/Unit/Api/Group/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/groups.json') - ) + ->with('/groups.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListeWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/groups.json'), - $this->stringContains('not-used') - ) - ) + ->with('/groups.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Issue/ListTest.php b/tests/Unit/Api/Issue/ListTest.php index bf35e7be..94c23cbe 100644 --- a/tests/Unit/Api/Issue/ListTest.php +++ b/tests/Unit/Api/Issue/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/issues.json') - ) + ->with('/issues.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/issues.json'), - $this->stringContains('not-used') - ) - ) + ->with('/issues.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/IssueCategory/ListByProjectTest.php b/tests/Unit/Api/IssueCategory/ListByProjectTest.php index b31d48ec..563a392b 100644 --- a/tests/Unit/Api/IssueCategory/ListByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListByProjectTest.php @@ -25,9 +25,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/projects/5/issue_categories.json') - ) + ->with('/projects/5/issue_categories.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -55,12 +53,7 @@ public function testListByProjectWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/projects/project-slug/issue_categories.json'), - $this->stringContains('not-used') - ) - ) + ->with('/projects/project-slug/issue_categories.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/IssuePriority/ListTest.php b/tests/Unit/Api/IssuePriority/ListTest.php index 7e6832bf..855f9074 100644 --- a/tests/Unit/Api/IssuePriority/ListTest.php +++ b/tests/Unit/Api/IssuePriority/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/enumerations/issue_priorities.json') - ) + ->with('/enumerations/issue_priorities.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,9 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringContains('not-used') - ) + ->with('/enumerations/issue_priorities.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php index e107af1b..c05c4866 100644 --- a/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php +++ b/tests/Unit/Api/IssueRelation/ListByIssueIdTest.php @@ -21,9 +21,7 @@ public function testListByIssueIdWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/issues/5/relations.json') - ) + ->with('/issues/5/relations.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListByIssueIdWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/issues/5/relations.json'), - $this->stringContains('not-used') - ) - ) + ->with('/issues/5/relations.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/IssueStatus/ListTest.php b/tests/Unit/Api/IssueStatus/ListTest.php index 06284400..801d2b3c 100644 --- a/tests/Unit/Api/IssueStatus/ListTest.php +++ b/tests/Unit/Api/IssueStatus/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/issue_statuses.json') - ) + ->with('/issue_statuses.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/issue_statuses.json'), - $this->stringContains('not-used') - ) - ) + ->with('/issue_statuses.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Membership/ListByProjectTest.php b/tests/Unit/Api/Membership/ListByProjectTest.php index 1f3e268e..55b4b49a 100644 --- a/tests/Unit/Api/Membership/ListByProjectTest.php +++ b/tests/Unit/Api/Membership/ListByProjectTest.php @@ -24,9 +24,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/projects/5/memberships.json') - ) + ->with('/projects/5/memberships.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -53,12 +51,7 @@ public function testListByProjectWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/projects/project-slug/memberships.json'), - $this->stringContains('not-used') - ) - ) + ->with('/projects/project-slug/memberships.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/News/ListByProjectTest.php b/tests/Unit/Api/News/ListByProjectTest.php index fcede07c..1b42ce5c 100644 --- a/tests/Unit/Api/News/ListByProjectTest.php +++ b/tests/Unit/Api/News/ListByProjectTest.php @@ -25,9 +25,7 @@ public function testListByProjectWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/projects/5/news.json') - ) + ->with('/projects/5/news.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -55,9 +53,7 @@ public function testListByProjectWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringContains('not-used') - ) + ->with('/projects/5/news.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/News/ListTest.php b/tests/Unit/Api/News/ListTest.php index 776d3c35..80e2ef38 100644 --- a/tests/Unit/Api/News/ListTest.php +++ b/tests/Unit/Api/News/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/news.json') - ) + ->with('/news.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/news.json'), - $this->stringContains('not-used') - ) - ) + ->with('/news.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Project/ListTest.php b/tests/Unit/Api/Project/ListTest.php index 3f25b3c8..ede326d0 100644 --- a/tests/Unit/Api/Project/ListTest.php +++ b/tests/Unit/Api/Project/ListTest.php @@ -48,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/projects.json'), - $this->stringContains('not-used') - ) - ) + ->with('/projects.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Query/ListTest.php b/tests/Unit/Api/Query/ListTest.php index bbc69cbc..01e46773 100644 --- a/tests/Unit/Api/Query/ListTest.php +++ b/tests/Unit/Api/Query/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/queries.json') - ) + ->with('/queries.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->any()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/queries.json'), - $this->stringContains('not-used') - ) - ) + ->with('/queries.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Role/ListTest.php b/tests/Unit/Api/Role/ListTest.php index edd5effc..d274a1b2 100644 --- a/tests/Unit/Api/Role/ListTest.php +++ b/tests/Unit/Api/Role/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/roles.json') - ) + ->with('/roles.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/roles.json'), - $this->stringContains('not-used') - ) - ) + ->with('/roles.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/TimeEntry/ListTest.php b/tests/Unit/Api/TimeEntry/ListTest.php index 64010a9e..126dcca4 100644 --- a/tests/Unit/Api/TimeEntry/ListTest.php +++ b/tests/Unit/Api/TimeEntry/ListTest.php @@ -52,14 +52,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/time_entries.json?'), - $this->stringContains('project_id=5'), - $this->stringContains('user_id=10'), - $this->stringContains('limit=2') - ) - ) + ->with('/time_entries.json?limit=2&offset=0&project_id=5&user_id=10') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/TimeEntryActivity/ListTest.php b/tests/Unit/Api/TimeEntryActivity/ListTest.php index cb39d780..d296ca0c 100644 --- a/tests/Unit/Api/TimeEntryActivity/ListTest.php +++ b/tests/Unit/Api/TimeEntryActivity/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/enumerations/time_entry_activities.json') - ) + ->with('/enumerations/time_entry_activities.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/enumerations/time_entry_activities.json'), - $this->stringContains('not-used') - ) - ) + ->with('/enumerations/time_entry_activities.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') diff --git a/tests/Unit/Api/Tracker/ListTest.php b/tests/Unit/Api/Tracker/ListTest.php index 5e09a8cd..66ed63ed 100644 --- a/tests/Unit/Api/Tracker/ListTest.php +++ b/tests/Unit/Api/Tracker/ListTest.php @@ -21,9 +21,7 @@ public function testListWithoutParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->stringStartsWith('/trackers.json') - ) + ->with('/trackers.json') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody') @@ -50,12 +48,7 @@ public function testListWithParametersReturnsResponse() $client = $this->createMock(Client::class); $client->expects($this->once()) ->method('requestGet') - ->with( - $this->logicalAnd( - $this->stringStartsWith('/trackers.json'), - $this->stringContains('not-used') - ) - ) + ->with('/trackers.json?limit=25&offset=0&0=not-used') ->willReturn(true); $client->expects($this->exactly(1)) ->method('getLastResponseBody')