diff --git a/storage/database/databasecopy.sqlite b/storage/database/databasecopy.sqlite
old mode 100644
new mode 100755
index 03d527000f..e7bb5c4dec
Binary files a/storage/database/databasecopy.sqlite and b/storage/database/databasecopy.sqlite differ
diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php
index 2f7ca99259..45a7b70733 100644
--- a/tests/Feature/Controllers/AccountControllerTest.php
+++ b/tests/Feature/Controllers/AccountControllerTest.php
@@ -40,7 +40,8 @@ class AccountControllerTest extends TestCase
public function testDelete()
{
$this->be($this->user());
- $response = $this->get(route('accounts.delete', [1]));
+ $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
+ $response = $this->get(route('accounts.delete', [$account->id]));
$response->assertStatus(200);
// has bread crumb
$response->assertSee('
');
@@ -53,12 +54,13 @@ class AccountControllerTest extends TestCase
{
$this->session(['accounts.delete.url' => 'http://localhost/accounts/show/1']);
+ $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
$repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('find')->withArgs([0])->once()->andReturn(new Account);
$repository->shouldReceive('destroy')->andReturn(true);
$this->be($this->user());
- $response = $this->post(route('accounts.destroy', [1]));
+ $response = $this->post(route('accounts.destroy', [$account->id]));
$response->assertStatus(302);
$response->assertSessionHas('success');
}
@@ -69,7 +71,8 @@ class AccountControllerTest extends TestCase
public function testEdit()
{
$this->be($this->user());
- $response = $this->get(route('accounts.edit', [1]));
+ $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
+ $response = $this->get(route('accounts.edit', [$account->id]));
$response->assertStatus(200);
// has bread crumb
$response->assertSee('');
@@ -93,6 +96,37 @@ class AccountControllerTest extends TestCase
$response->assertSee('');
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\AccountController::show
+ * @covers \FireflyIII\Http\Controllers\AccountController::redirectToOriginalAccount
+ */
+ public function testShowInitial()
+ {
+ $date = new Carbon;
+ $this->session(['start' => $date, 'end' => clone $date]);
+
+ $this->be($this->user());
+ $account = $this->user()->accounts()->where('account_type_id', 6)->orderBy('id','DESC')->whereNull('deleted_at')->first();
+ $response = $this->get(route('accounts.show', [$account->id]));
+ $response->assertStatus(302);
+ }
+
+ /**
+ * @covers \FireflyIII\Http\Controllers\AccountController::show
+ * @covers \FireflyIII\Http\Controllers\AccountController::redirectToOriginalAccount
+ * @expectedExceptionMessage Expected a transaction
+ */
+ public function testShowBrokenInitial()
+ {
+ $date = new Carbon;
+ $this->session(['start' => $date, 'end' => clone $date]);
+
+ $this->be($this->user());
+ $account = $this->user()->accounts()->where('account_type_id', 6)->orderBy('id','ASC')->whereNull('deleted_at')->first();
+ $response = $this->get(route('accounts.show', [$account->id]));
+ $response->assertStatus(500);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\AccountController::show
* @covers \FireflyIII\Http\Controllers\AccountController::periodEntries