firefly-iii/tests/acceptance/Controllers/AttachmentControllerTest.php
2016-02-04 07:30:48 +01:00

91 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
* @covers FireflyIII\Http\Controllers\AttachmentController::__construct
*/
public function testDelete()
{
$this->be($this->user());
$this->call('GET', '/attachment/delete/1');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::destroy
*/
public function testDestroy()
{
$this->be($this->user());
$this->session(['attachments.delete.url' => 'http://localhost']);
$this->call('POST', '/attachment/destroy/2');
$this->assertResponseStatus(302);
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::download
*/
public function testDownload()
{
$this->be($this->user());
$this->call('GET', '/attachment/download/1');
$this->assertResponseStatus(200);
// must have certain headers
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::edit
*/
public function testEdit()
{
$this->be($this->user());
$this->call('GET', '/attachment/edit/1');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::preview
*/
public function testPreview()
{
$this->be($this->user());
$this->call('GET', '/attachment/preview/1');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::update
* @covers FireflyIII\Http\Requests\AttachmentFormRequest::authorize
* @covers FireflyIII\Http\Requests\AttachmentFormRequest::rules
*/
public function testUpdate()
{
$this->session(['attachments.edit.url' => 'http://localhost']);
$args = [
'title' => 'New title',
'description' => 'New descr',
'notes' => 'New notes',
];
$this->be($this->user());
$this->call('POST', '/attachment/update/1', $args);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
}