be($this->user()); $response = $this->call('GET', '/currency/create'); $this->assertEquals(200, $response->status()); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::defaultCurrency */ public function testDefaultCurrency() { $this->be($this->user()); $response = $this->call('GET', '/currency/default/2'); $this->assertEquals(302, $response->status()); $this->assertRedirectedToRoute('currency.index'); $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::delete */ public function testDelete() { $this->be($this->user()); $response = $this->call('GET', '/currency/delete/2'); $this->assertEquals(200, $response->status()); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::destroy */ public function testDestroy() { $args = [ '_token' => Session::token(), ]; $this->session(['currency.delete.url' => 'http://localhost/currency']); $this->be($this->user()); $response = $this->call('POST', '/currency/destroy/3', $args); $this->assertSessionHas('success'); $this->assertRedirectedToRoute('currency.index'); $this->assertEquals(302, $response->status()); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::edit */ public function testEdit() { $this->be($this->user()); $response = $this->call('GET', '/currency/edit/2'); $this->assertEquals(200, $response->status()); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::index */ public function testIndex() { $this->be($this->user()); $response = $this->call('GET', '/currency'); $this->assertEquals(200, $response->status()); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::store */ public function testStore() { $this->be($this->user()); $this->session(['currency.create.url' => 'http://localhost/currency']); $args = [ '_token' => Session::token(), 'name' => 'New Euro.', 'symbol' => 'Y', 'code' => 'IUY', ]; $response = $this->call('POST', '/currency/store', $args); $this->assertEquals(302, $response->status()); $this->assertSessionHas('success'); $this->assertRedirectedToRoute('currency.index'); } /** * @covers FireflyIII\Http\Controllers\CurrencyController::update */ public function testUpdate() { $this->session(['currency.edit.url' => 'http://localhost/currency']); $args = [ 'id' => 1, 'name' => 'New Euro.', 'symbol' => 'Y', 'code' => 'IUY', '_token' => Session::token(), ]; $this->be($this->user()); $response = $this->call('POST', '/currency/update/1', $args); $this->assertEquals(302, $response->status()); $this->assertSessionHas('success'); $this->assertRedirectedToRoute('currency.index'); } }