mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fixed more tests.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,10 +57,15 @@ class AccountControllerTest extends TestCase
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('find')->withArgs([0])->once()->andReturn(new Account);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
$this->session(['accounts.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('accounts.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,10 +138,23 @@ class AccountControllerTest extends TestCase
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['accounts.create.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$data = [
|
||||
'name' => 'new account ' . rand(1000, 9999),
|
||||
'what' => 'asset',
|
||||
];
|
||||
|
||||
$this->call('post', route('accounts.store', ['asset']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list should have this new account.
|
||||
$this->call('GET', route('accounts.index', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,9 +162,23 @@ class AccountControllerTest extends TestCase
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['accounts.edit.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$data = [
|
||||
'name' => 'updated account ' . rand(1000, 9999),
|
||||
'active' => 1,
|
||||
'what' => 'asset',
|
||||
];
|
||||
|
||||
$this->call('post', route('accounts.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list should have this new account.
|
||||
$this->call('GET', route('accounts.index', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user