Skip to content

Commit

Permalink
Now the labels are manageable with issues, adding or removing dynami…
Browse files Browse the repository at this point in the history
…cally
  • Loading branch information
benatespina committed Sep 28, 2015
1 parent 41751e5 commit d8c5d79
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 119 deletions.
316 changes: 204 additions & 112 deletions Bundle/IssueBundle/Behat/issue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,133 @@ Feature: Manage issue
]
"""

Scenario: Getting all the issues filter by label=12
Given I am authenticating with "access-token-0" token
When I send a GET request to "/api/issues?label=12"
Then the response code should be 200
And the response should contain json:
"""
[
{
"id": "2",
"assignee": {
"id": "0",
"username": "user",
"email": "user@kreta.com",
"first_name": "Kreta",
"last_name": "User",
"photo": null
},
"children": [],
"created_at": "2014-10-21T00:00:00+0200",
"description": "Description",
"labels": [
{
"id": "12",
"name": "mongodb"
}
],
"numeric_id": 3,
"parent": null,
"priority": {
"id": "2",
"name": "High"
},
"resolution": null,
"reporter": {
"id": "0",
"username": "user",
"email": "user@kreta.com",
"first_name": "Kreta",
"last_name": "User",
"photo": null
},
"status": {
"type": "normal",
"name": "Resolved",
"id": "2",
"color": "#f1c40f"
},
"title": "Test issue 3",
"type": {
"id": "1",
"name": "Epic"
},
"_links": {
"self": {
"href": "http://kreta.test:8000/api/issues/2"
},
"project": {
"href": "http://kreta.test:8000/api/projects/0"
},
"issues": {
"href": "http://kreta.test:8000/api/issues"
}
}
},
{
"id": "5",
"assignee": {
"id": "0",
"username": "user",
"email": "user@kreta.com",
"first_name": "Kreta",
"last_name": "User",
"photo": null
},
"children": [],
"created_at": "2014-10-21T00:00:00+0200",
"description": "Description",
"labels": [
{
"id": "12",
"name": "mongodb"
}
],
"numeric_id": 4,
"parent": null,
"priority": {
"id": "3",
"name": "Blocker"
},
"resolution": null,
"reporter": {
"id": "1",
"username": "user2",
"email": "user2@kreta.com",
"first_name": "Kreta",
"last_name": "User2",
"photo": {
"id": "2",
"name": "http://kreta.test:8000/media/image/user-2.jpg"
}
},
"status": {
"type": "normal",
"name": "Closed",
"id": "3",
"color": "#c0392b"
},
"title": "Test issue 4",
"type": {
"id": "0",
"name": "Bug"
},
"_links": {
"self": {
"href": "http://kreta.test:8000/api/issues/5"
},
"project": {
"href": "http://kreta.test:8000/api/projects/0"
},
"issues": {
"href": "http://kreta.test:8000/api/issues"
}
}
}
]
"""

Scenario: Getting all the issues filter by title=issue 4
Given I am authenticating with "access-token-0" token
When I send a GET request to "/api/issues?q=issue 4"
Expand Down Expand Up @@ -2492,7 +2619,70 @@ Feature: Manage issue
{
"id": "2",
"name": "javascript"
}
],
"numeric_id": 1,
"parent": null,
"priority": {
"id": "1",
"name": "Medium"
},
"resolution": null,
"reporter": {
"id": "0",
"username": "user",
"email": "user@kreta.com",
"first_name": "Kreta",
"last_name": "User",
"photo": null
},
"status": {
"type": "normal",
"name": "Open",
"id": "0",
"color": "#27ae60"
},
"title": "Test issue 1",
"type": {
"id": "2",
"name": "New feature"
},
"_links": {
"self": {
"href": "http://kreta.test:8000/api/issues/0"
},
"project": {
"href": "http://kreta.test:8000/api/projects/0"
},
"issues": {
"href": "http://kreta.test:8000/api/issues"
}
}
}
]
"""

Scenario: Getting all the issues with offset 2
Given I am authenticating with "access-token-0" token
When I send a GET request to "/api/issues?offset=2"
Then the response code should be 200
And the response should contain json:
"""
[
{
"id": "0",
"assignee": {
"id": "0",
"username": "user",
"email": "user@kreta.com",
"first_name": "Kreta",
"last_name": "User",
"photo": null
},
"children": [],
"created_at": "2014-12-15T00:00:00+0100",
"description": "Description",
"labels": [
{
"id": "3",
"name": "bdd"
Expand Down Expand Up @@ -2616,17 +2806,7 @@ Feature: Manage issue
"href": "http://kreta.test:8000/api/issues"
}
}
}
]
"""

Scenario: Getting all the issues with offset 2
Given I am authenticating with "access-token-0" token
When I send a GET request to "/api/issues?offset=2"
Then the response code should be 200
And the response should contain json:
"""
[
},
{
"id": "4",
"assignee": {
Expand Down Expand Up @@ -3571,28 +3751,7 @@ Feature: Manage issue
"children": [],
"created_at": "2014-12-15T00:00:00+0100",
"description": "The description",
"labels": [
{
"id": "0",
"name": "backbone.js"
},
{
"id": "2",
"name": "javascript"
},
{
"id": "3",
"name": "bdd"
},
{
"id": "6",
"name": "symfony"
},
{
"id": "8",
"name": "css3"
}
],
"labels": [],
"numeric_id": 1,
"priority": {
"id": "0",
Expand Down Expand Up @@ -3664,28 +3823,7 @@ Feature: Manage issue
},
"created_at": "2014-12-15T00:00:00+0100",
"description": "The description",
"labels": [
{
"id": "0",
"name": "backbone.js"
},
{
"id": "2",
"name": "javascript"
},
{
"id": "3",
"name": "bdd"
},
{
"id": "6",
"name": "symfony"
},
{
"id": "8",
"name": "css3"
}
],
"labels": [],
"numeric_id": 1,
"priority": {
"id": "0",
Expand Down Expand Up @@ -3872,28 +4010,7 @@ Feature: Manage issue
},
"created_at": "2014-10-21T00:00:00+0200",
"description": "The description",
"labels": [
{
"id": "0",
"name": "backbone.js"
},
{
"id": "11",
"name": "mysql"
},
{
"id": "12",
"name": "mongodb"
},
{
"id": "2",
"name": "javascript"
},
{
"id": "3",
"name": "bdd"
}
],
"labels": [],
"numeric_id": 3,
"priority": {
"id": "0",
Expand Down Expand Up @@ -3964,28 +4081,7 @@ Feature: Manage issue
},
"created_at": "2014-10-21T00:00:00+0200",
"description": "The description",
"labels": [
{
"id": "1",
"name": "php"
},
{
"id": "10",
"name": "compass"
},
{
"id": "4",
"name": "behat"
},
{
"id": "5",
"name": "phpspec"
},
{
"id": "7",
"name": "html5"
}
],
"labels": [],
"numeric_id": 1,
"priority": {
"id": "4",
Expand Down Expand Up @@ -4035,7 +4131,15 @@ Feature: Manage issue
"priority": "0",
"description": "The description",
"assignee": "1",
"project": "0"
"project": "0",
"labels": [
{
"name": "backbone.js"
},
{
"name": "javascript"
}
]
}
"""
Then the response code should be 200
Expand Down Expand Up @@ -4064,18 +4168,6 @@ Feature: Manage issue
{
"id": "2",
"name": "javascript"
},
{
"id": "3",
"name": "bdd"
},
{
"id": "6",
"name": "symfony"
},
{
"id": "8",
"name": "css3"
}
],
"numeric_id": 1,
Expand Down
4 changes: 3 additions & 1 deletion Bundle/IssueBundle/Controller/IssueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class IssueController extends Controller
* @QueryParam(name="priority", requirements="(.*)", strict=true, nullable=true, description="Priority filter")
* @QueryParam(name="status", requirements="(.*)", strict=true, nullable=true, description="Status filter")
* @QueryParam(name="type", requirements="(.*)", strict=true, nullable=true, description="Type filter")
* @QueryParam(name="label", requirements="(.*)", strict=true, nullable=true, description="Label filter")
* @QueryParam(name="q", requirements="(.*)", strict=true, nullable=true, description="Title filter")
* @QueryParam(name="limit", requirements="\d+", default="9999", description="Amount of issues to be returned")
* @QueryParam(name="offset", requirements="\d+", default="0", description="Offset in pages")
Expand All @@ -62,7 +63,8 @@ public function getIssuesAction(ParamFetcher $paramFetcher)
'w.id' => $paramFetcher->get('watcher'),
'pr.id' => $paramFetcher->get('priority'),
's.id' => $paramFetcher->get('status'),
't.id' => $paramFetcher->get('type')
't.id' => $paramFetcher->get('type'),
'l.id' => $paramFetcher->get('label')
],
[$paramFetcher->get('sort') => 'ASC'],
$paramFetcher->get('limit'),
Expand Down

0 comments on commit d8c5d79

Please sign in to comment.