Expand test coverage.

This commit is contained in:
James Cole
2018-08-31 21:12:53 +02:00
parent 69b4632ef6
commit 13f72c73fb
16 changed files with 552 additions and 71 deletions

View File

@@ -24,6 +24,7 @@ namespace Tests\Feature\Controllers\Json;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Currency\ExchangeRateInterface;
use Log;
use Tests\TestCase;
@@ -60,6 +61,24 @@ class ExchangeControllerTest extends TestCase
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Json\ExchangeController
*/
public function testGetRateNull(): void
{
$repository = $this->mock(CurrencyRepositoryInterface::class);
$rate = factory(CurrencyExchangeRate::class)->make();
$repository->shouldReceive('getExchangeRate')->andReturnNull();
$interface = $this->mock(ExchangeRateInterface::class);
$interface->shouldReceive('setUser')->once();
$interface->shouldReceive('getRate')->andReturn($rate);
$this->be($this->user());
$response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']));
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Json\ExchangeController
*/