Skip to content

Commit

Permalink
Add "Exception" support into DataTables controller
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Sep 12, 2018
1 parent ca57030 commit f9e845c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Tests/Controller/DataTablesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,31 @@ public function testEditActionWithStatus404() {
$this->assertEquals("Record not found", $res["notify"]);
}

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

// Create a client.
$client = static::createClient();

// Make a GET request.
$client->request("GET", "/datatables/employee/edit/55/age/value");
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertEquals("application/json", $client->getResponse()->headers->get("Content-Type"));

// Check the JSON response.
$res = json_decode($client->getResponse()->getContent(), true);

$this->assertArrayHasKey("status", $res);
$this->assertArrayHasKey("notify", $res);

$this->assertEquals(500, $res["status"]);
$this->assertEquals("Failed editing", $res["notify"]);
}

/**
* Tests the editAction() method.
*
Expand Down

0 comments on commit f9e845c

Please sign in to comment.