mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
More tests
This commit is contained in:
parent
406150620a
commit
dc28ba42ef
@ -115,7 +115,7 @@ class TestData
|
|||||||
'title' => Crypt::encrypt($attachment['title']),
|
'title' => Crypt::encrypt($attachment['title']),
|
||||||
'description' => Crypt::encrypt($attachment['description']),
|
'description' => Crypt::encrypt($attachment['description']),
|
||||||
'notes' => Crypt::encrypt($attachment['notes']),
|
'notes' => Crypt::encrypt($attachment['notes']),
|
||||||
'mime' => $attachment['mime'],
|
'mime' => Crypt::encrypt($attachment['mime']),
|
||||||
'size' => strlen($attachment['content']),
|
'size' => strlen($attachment['content']),
|
||||||
'uploaded' => 1,
|
'uploaded' => 1,
|
||||||
]
|
]
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,81 +29,88 @@ class AttachmentControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::delete
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::delete
|
||||||
* Implement testDelete().
|
|
||||||
*/
|
*/
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('attachments.delete', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::destroy
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::destroy
|
||||||
* Implement testDestroy().
|
|
||||||
*/
|
*/
|
||||||
public function testDestroy()
|
public function testDestroy()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['attachments.delete.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
$repository = $this->mock(AttachmentRepositoryInterface::class);
|
||||||
'This test has not been implemented yet.'
|
$repository->shouldReceive('destroy')->andReturn(true);
|
||||||
);
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('attachments.destroy', [1]));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::download
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::download
|
||||||
* Implement testDownload().
|
|
||||||
*/
|
*/
|
||||||
public function testDownload()
|
public function testDownload()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('attachments.download', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('This is attachment number one.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::edit
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::edit
|
||||||
* Implement testEdit().
|
|
||||||
*/
|
*/
|
||||||
public function testEdit()
|
public function testEdit()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('attachments.edit', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::preview
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::preview
|
||||||
* Implement testPreview().
|
|
||||||
*/
|
*/
|
||||||
public function testPreview()
|
public function testPreview()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('attachments.preview', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::update
|
* @covers \FireflyIII\Http\Controllers\AttachmentController::update
|
||||||
* Implement testUpdate().
|
|
||||||
*/
|
*/
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['attachments.edit.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
$data = [
|
||||||
'This test has not been implemented yet.'
|
'title' => 'Some updated title ' . rand(1000, 9999),
|
||||||
);
|
'notes' => '',
|
||||||
|
'description' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('attachments.update', [1]), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// view should be updated
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('attachments.edit', [1]));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user