Skip to content

Commit

Permalink
test for correct requested url
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Oct 10, 2023
1 parent 590c415 commit 97786ea
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 131 deletions.
8 changes: 2 additions & 6 deletions tests/Unit/Api/CustomField/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Group/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Issue/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/IssueCategory/ListByProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
8 changes: 2 additions & 6 deletions tests/Unit/Api/IssuePriority/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/IssueRelation/ListByIssueIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/IssueStatus/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Membership/ListByProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
8 changes: 2 additions & 6 deletions tests/Unit/Api/News/ListByProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/News/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
7 changes: 1 addition & 6 deletions tests/Unit/Api/Project/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Query/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Role/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
9 changes: 1 addition & 8 deletions tests/Unit/Api/TimeEntry/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/TimeEntryActivity/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/Api/Tracker/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit 97786ea

Please sign in to comment.