firefly-iii/tests/acceptance/Controllers/AttachmentControllerTest.php

91 lines
2.5 KiB
PHP
Raw Normal View History

2016-01-19 23:20:09 -06:00
<?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
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Controllers\AttachmentController::__construct
2016-01-19 23:20:09 -06:00
*/
public function testDelete()
{
2016-01-20 03:47:29 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/attachment/delete/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::destroy
*/
public function testDestroy()
{
2016-01-20 03:47:29 -06:00
$this->be($this->user());
$this->session(['attachments.delete.url' => 'http://localhost']);
2016-01-24 11:11:57 -06:00
$this->call('POST', '/attachment/destroy/2');
$this->assertResponseStatus(302);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::download
*/
public function testDownload()
{
2016-01-20 03:47:29 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/attachment/download/1');
$this->assertResponseStatus(200);
2016-02-04 00:30:48 -06:00
// must have certain headers
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::edit
*/
public function testEdit()
{
2016-01-20 03:47:29 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/attachment/edit/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::preview
*/
public function testPreview()
{
2016-01-20 03:47:29 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/attachment/preview/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\AttachmentController::update
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Requests\AttachmentFormRequest::authorize
* @covers FireflyIII\Http\Requests\AttachmentFormRequest::rules
2016-01-19 23:20:09 -06:00
*/
public function testUpdate()
{
2016-01-20 03:47:29 -06:00
$this->session(['attachments.edit.url' => 'http://localhost']);
$args = [
'title' => 'New title',
'description' => 'New descr',
'notes' => 'New notes',
];
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('POST', '/attachment/update/1', $args);
$this->assertResponseStatus(302);
2016-01-20 03:47:29 -06:00
$this->assertSessionHas('success');
2016-01-19 23:20:09 -06:00
}
}