/** * @return array */ public function getMap() : array { $currencies = TC::get(); $list = []; foreach ($currencies as $currency) { $list[$currency->id] = $currency->name . ' (' . $currency->code . ')'; } asort($list); $list = [0 => trans('csv.do_not_map')] + $list; return $list; }
/** * @return Collection */ public function get() : Collection { return TransactionCurrency::get(); }
/** * @return Collection */ public function get() { return TransactionCurrency::get(); }
/** * @covers FireflyIII\Support\Amount::getCurrencyCode */ public function testGetCurrencyCodeNoSuchCurrency() { $user = FactoryMuffin::create('FireflyIII\\User'); $this->be($user); // delete any currency preferences: Preference::where('user_id', $user->id)->delete(); // delete transaction currencies: foreach (TransactionCurrency::get() as $c) { $c->delete(); } $preference = FactoryMuffin::create('FireflyIII\\Models\\Preference'); $preference->user_id = $user->id; $preference->name = 'currencyPreference'; $preference->data = 'SOM'; $preference->save(); Preferences::shouldReceive('get')->withArgs(['currencyPreference', 'EUR'])->andReturn($preference); $code = $this->object->getCurrencyCode(); $this->assertEquals('EUR', $code); }