Skip to content

Commit

Permalink
Fixing the test
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Dec 4, 2018
1 parent a4fdd00 commit bc5ff72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/Http/Controllers/LogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ public function download($date)
*/
public function delete(Request $request)
{
if ( ! $request->ajax())
abort(405, 'Method Not Allowed');
abort_unless($request->ajax(), 405, 'Method Not Allowed');

$date = $request->get('date');

Expand Down
12 changes: 4 additions & 8 deletions tests/RoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,10 @@ public function it_must_throw_log_not_found_exception_on_show()
/** @test */
public function it_must_throw_log_not_found_exception_on_delete()
{
try {
$response = $this->call('DELETE', route('log-viewer::logs.delete', ['0000-00-00']), [], [], [], ['HTTP_X-Requested-With' => 'XMLHttpRequest']);
$response->assertExactJson(['message' => 'Server Error']);
}
catch(\Exception $exception) {
static::assertInstanceOf(\Arcanedev\LogViewer\Exceptions\FilesystemException::class, $exception);
static::assertStringStartsWith('The log(s) could not be located at : ', $exception->getMessage());
}
$response = $this->call('DELETE', route('log-viewer::logs.delete', ['0000-00-00']), [], [], [], ['HTTP_X-Requested-With' => 'XMLHttpRequest']);

static::assertInstanceOf(\Arcanedev\LogViewer\Exceptions\FilesystemException::class, $response->exception);
static::assertStringStartsWith('The log(s) could not be located at : ', $response->exception->getMessage());
}

/** @test */
Expand Down

0 comments on commit bc5ff72

Please sign in to comment.