firefly-iii/tests/acceptance/Controllers/AttachmentControllerTest.php
2016-01-20 10:47:29 +01:00

93 lines
2.5 KiB
PHP

<?php
/**
* AttachmentControllerTest.php
* Copyright (C) 2016 Sander Dorigo
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:27.
*/
class AttachmentControllerTest extends TestCase
{
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::delete
*/
public function testDelete()
{
$this->be($this->user());
$response = $this->call('GET', '/attachment/delete/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::destroy
*/
public function testDestroy()
{
$this->be($this->user());
$args = [
'_token' => Session::token(),
];
$this->session(['attachments.delete.url' => 'http://localhost']);
$response = $this->call('POST', '/attachment/destroy/2', $args);
$this->assertEquals(302, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::download
*/
public function testDownload()
{
$this->be($this->user());
$response = $this->call('GET', '/attachment/download/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::edit
*/
public function testEdit()
{
$this->be($this->user());
$response = $this->call('GET', '/attachment/edit/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::preview
*/
public function testPreview()
{
$this->be($this->user());
$response = $this->call('GET', '/attachment/preview/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::update
*/
public function testUpdate()
{
$this->session(['attachments.edit.url' => 'http://localhost']);
$args = [
'title' => 'New title',
'description' => 'New descr',
'notes' => 'New notes',
'_token' => Session::token(),
];
$this->be($this->user());
$response = $this->call('POST', '/attachment/update/1', $args);
$this->assertEquals(302, $response->status());
$this->assertSessionHas('success');
}
}