Code cleanup and realign.

This commit is contained in:
James Cole
2018-08-06 19:14:30 +02:00
parent f7eef25fed
commit 5908c0ce8c
188 changed files with 1019 additions and 1031 deletions

View File

@@ -107,6 +107,28 @@ class JavascriptControllerTest extends TestCase
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JavascriptController::variables
* @covers \FireflyIII\Http\Controllers\JavascriptController::getDateRangeConfig
*
* @param string $range
*
* @dataProvider dateRangeProvider
*/
public function testVariablesCustom(string $range): void
{
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos->shouldReceive('findNull')->andReturn(new Account);
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$this->session(['is_custom_range' => true]);
$response = $this->get(route('javascript.variables'));
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JavascriptController::variables
@@ -132,27 +154,4 @@ class JavascriptControllerTest extends TestCase
$response = $this->get(route('javascript.variables'));
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JavascriptController::variables
* @covers \FireflyIII\Http\Controllers\JavascriptController::getDateRangeConfig
*
* @param string $range
*
* @dataProvider dateRangeProvider
*/
public function testVariablesCustom(string $range): void
{
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos->shouldReceive('findNull')->andReturn(new Account);
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$this->session(['is_custom_range' => true]);
$response = $this->get(route('javascript.variables'));
$response->assertStatus(200);
}
}