Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jeckel committed Jan 29, 2017
1 parent 1c651bf commit 851a334
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Coverage Status](https://coveralls.io/repos/github/jeckel/ScrumCapacity/badge.svg?branch=develop)](https://coveralls.io/github/jeckel/ScrumCapacity?branch=develop) [![Build Status](https://travis-ci.org/jeckel/ScrumCapacity.svg?branch=develop)](https://travis-ci.org/jeckel/ScrumCapacity) [![Twitter](https://img.shields.io/badge/Twitter-%40jeckel4-blue.svg)](https://twitter.com/intent/user?screen_name=jeckel4)
[![Coverage Status](https://coveralls.io/repos/github/jeckel/ScrumCapacity/badge.svg?branch=develop)](https://coveralls.io/github/jeckel/ScrumCapacity?branch=develop) [![Build Status](https://travis-ci.org/jeckel/ScrumCapacity.svg?branch=develop)](https://travis-ci.org/jeckel/ScrumCapacity) [![Twitter](https://img.shields.io/badge/Twitter-%40jeckel4-blue.svg)](https://twitter.com/intent/user?screen_name=jeckel4) [![Code Climate](https://codeclimate.com/github/jeckel/ScrumCapacity/badges/gpa.svg)](https://codeclimate.com/github/jeckel/ScrumCapacity)

# ScrumCapacity

Expand Down
7 changes: 6 additions & 1 deletion src/Controller/SprintController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public function putSprint(ServerRequestInterface $request, ResponseInterface $re
$sprint->setName($body['name']);
}
$sprint->save();
return $response->withJson($sprint->toArray());
return $response->withJson($this->getSingleSprintResponse($sprint)->jsonSerialize());
// return $response->withJson($sprint->toArray());
}

/**
Expand All @@ -115,6 +116,10 @@ public function deleteSprint(ServerRequestInterface $request, ResponseInterface
return $response->withJson([]);
}

/**
* @param Sprint $sprint
* @return SingleDocument
*/
protected function getSingleSprintResponse(Sprint $sprint)
{
return new SingleDocument([
Expand Down
40 changes: 21 additions & 19 deletions tests/functional/SprintEndPointCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
*/
class SprintEndPointCest
{
public function testGetSprint(\FunctionalTester $I)
{
$data = [
'name' => 'Sprint #256',
'sprint_id' => 256,
'nb_days' => 8,
'created_at' => '2017-01-14 20:00:00',
'updated_at' => '2017-01-14 23:00:00',
'deleted_at' => null
];
$I->haveInDatabase('sprint', $data);

$response = $I->runApp('GET', '/sprint/256');
$I->assertEquals(200, $response->getStatusCode());

$expected = file_get_contents(__DIR__ . '/Fixtures/Sprint256.json');

$I->assertJsonAreEquals($expected, (string) $response->getBody());
}


public function testPostSprint(\FunctionalTester $I)
{
$data = [
Expand All @@ -30,25 +51,6 @@ public function testPostSprint(\FunctionalTester $I)
$I->assertJsonAreEquals(json_encode($expected), (string) $response->getBody());
}

public function testGetSprint(\FunctionalTester $I)
{
$data = [
'name' => 'Sprint #256',
'sprint_id' => 256,
'nb_days' => 8,
'created_at' => '2017-01-14 20:00:00',
'updated_at' => '2017-01-14 23:00:00',
'deleted_at' => null
];
$I->haveInDatabase('sprint', $data);

$response = $I->runApp('GET', '/sprint/256');
$I->assertEquals(200, $response->getStatusCode());

$expected = file_get_contents(__DIR__ . '/Fixtures/Sprint256.json');

$I->assertJsonAreEquals($expected, (string) $response->getBody());
}

public function testGetNotFoundSprint(\FunctionalTester $I)
{
Expand Down

0 comments on commit 851a334

Please sign in to comment.