mock(CurrencyRepositoryInterface::class); $rate = factory(CurrencyExchangeRate::class)->make(); $repository->shouldReceive('getExchangeRate')->andReturn($rate); $this->be($this->user()); $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101'])); $response->assertStatus(200); } /** * @covers \FireflyIII\Http\Controllers\Json\ExchangeController::getRate */ public function testGetRateAmount() { $repository = $this->mock(CurrencyRepositoryInterface::class); $rate = factory(CurrencyExchangeRate::class)->make(); $repository->shouldReceive('getExchangeRate')->andReturn($rate); $this->be($this->user()); $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10'); $response->assertStatus(200); } }