mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Reference to unknown chart.
This commit is contained in:
parent
e1c829f4fa
commit
40ca72c656
@ -298,7 +298,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
$categoryId = $row['category_id'];
|
$categoryId = $row['category_id'];
|
||||||
$name = $names[$categoryId];
|
$name = $names[$categoryId] ?? '(unknown)';
|
||||||
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency']]);
|
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency']]);
|
||||||
$chartData[$label] = $row['total'];
|
$chartData[$label] = $row['total'];
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@ namespace Tests\Feature\Controllers\Chart;
|
|||||||
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
|
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
|
||||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
@ -52,12 +54,21 @@ class BillControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFrontpage(string $range): void
|
public function testFrontpage(string $range): void
|
||||||
{
|
{
|
||||||
$generator = $this->mock(GeneratorInterface::class);
|
$generator = $this->mock(GeneratorInterface::class);
|
||||||
$repository = $this->mock(BillRepositoryInterface::class);
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
|
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||||
|
|
||||||
$repository->shouldReceive('getBillsPaidInRange')->once()->andReturn('-1');
|
$amounts = [
|
||||||
$repository->shouldReceive('getBillsUnpaidInRange')->once()->andReturn('2');
|
1 => '100',
|
||||||
$generator->shouldReceive('pieChart')->once()->andReturn([]);
|
2 => '100',
|
||||||
|
];
|
||||||
|
|
||||||
|
$currencyRepos->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1))->withArgs([1]);
|
||||||
|
$currencyRepos->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(2))->withArgs([2]);
|
||||||
|
|
||||||
|
$repository->shouldReceive('getBillsPaidInRangePerCurrency')->once()->andReturn($amounts);
|
||||||
|
$repository->shouldReceive('getBillsUnpaidInRangePerCurrency')->once()->andReturn($amounts);
|
||||||
|
$generator->shouldReceive('multiCurrencyPieChart')->once()->andReturn([]);
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$this->changeDateRange($this->user(), $range);
|
$this->changeDateRange($this->user(), $range);
|
||||||
|
Loading…
Reference in New Issue
Block a user