Skip to content

Commit

Permalink
Improve Document controller unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Jun 17, 2020
1 parent db10992 commit b8fe06a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Tests/Controller/DocumentControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,26 @@ public function testDeleteAction() {
$this->assertEquals("/document/index/1", $client->getResponse()->headers->get("location"));
}

/**
* Tests the deleteAction() method.
*
* @return void
*/
public function testDeleteActionWithForeignKeyConstraintViolationException() {

$client = $this->client;

$client->request("GET", "/document/delete/1");
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$this->assertEquals("/document/index", $client->getResponse()->headers->get("location"));
}

/**
* Tests the downloadAction() method.
*
* @return void
*/
public function testDownloadActionWithDirectory() {
public function testDownloadAction() {

$client = $this->client;

Expand Down Expand Up @@ -107,7 +121,7 @@ public function testIndexActionWithParameters() {
// Check the JSON response.
$res = json_decode($client->getResponse()->getContent(), true);

$this->assertCount(9, $res["data"]);
$this->assertCount(8, $res["data"]);

//$this->assertArrayHasKey("DT_RowId", $res["data"][0]);
//$this->assertArrayHasKey("DT_RowClass", $res["data"][0]);
Expand All @@ -121,7 +135,6 @@ public function testIndexActionWithParameters() {
$this->assertContains("Pictures", $res["data"][5]["name"]);
$this->assertContains("Public", $res["data"][6]["name"]);
$this->assertContains("Templates", $res["data"][7]["name"]);
$this->assertContains("Videos", $res["data"][8]["name"]);
}

/**
Expand Down

0 comments on commit b8fe06a

Please sign in to comment.