Skip to content

Commit

Permalink
Add line-breaks on test methods calls
Browse files Browse the repository at this point in the history
  • Loading branch information
yourwebmaker committed Apr 9, 2014
1 parent c73d0e4 commit 5e9899c
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/Acme/BlogBundle/Tests/Controller/PageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public function testHeadRoute()
$pages = LoadPageData::$pages;
$page = array_pop($pages);

$this->client->request('HEAD', sprintf('/api/v1/pages/%d.json', $page->getId()), array('ACCEPT' => 'application/json'));
$this->client->request(
'HEAD',
sprintf('/api/v1/pages/%d.json', $page->getId()),
array('ACCEPT' => 'application/json')
);
$response = $this->client->getResponse();
$this->assertJsonResponse($response, 200, false);
}
Expand All @@ -60,7 +64,8 @@ public function testJsonNewPageAction()
$this->assertEquals(
'{"children":{"title":[],"body":[]}}',
$this->client->getResponse()->getContent(),
$this->client->getResponse()->getContent());
$this->client->getResponse()->getContent()
);
}

public function testJsonPostPageAction()
Expand Down Expand Up @@ -98,8 +103,16 @@ public function testJsonPutPageActionShouldModify()
$pages = LoadPageData::$pages;
$page = array_pop($pages);

$this->client->request('GET', sprintf('/api/v1/pages/%d.json', $page->getId()), array('ACCEPT' => 'application/json'));
$this->assertEquals(200, $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent());
$this->client->request(
'GET',
sprintf('/api/v1/pages/%d.json',
$page->getId()), array('ACCEPT' => 'application/json')
);
$this->assertEquals(
200,
$this->client->getResponse()->getStatusCode(),
$this->client->getResponse()->getContent()
);

$this->client->request(
'PUT',
Expand All @@ -125,7 +138,11 @@ public function testJsonPutPageActionShouldCreate()
$id = 0;
$this->client->request('GET', sprintf('/api/v1/pages/%d.json', $id), array('ACCEPT' => 'application/json'));

$this->assertEquals(404, $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent());
$this->assertEquals(
404,
$this->client->getResponse()->getStatusCode(),
$this->client->getResponse()->getContent()
);

$this->client->request(
'PUT',
Expand Down Expand Up @@ -165,7 +182,12 @@ public function testJsonPatchPageAction()
);
}

protected function assertJsonResponse($response, $statusCode = 200, $checkValidJson = true, $contentType = 'application/json')
protected function assertJsonResponse(
$response,
$statusCode = 200,
$checkValidJson = true,
$contentType = 'application/json'
)
{
$this->assertEquals(
$statusCode, $response->getStatusCode(),
Expand All @@ -183,4 +205,4 @@ protected function assertJsonResponse($response, $statusCode = 200, $checkValidJ
);
}
}
}
}

0 comments on commit 5e9899c

Please sign in to comment.