mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Should fix tests.
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
@@ -79,6 +76,9 @@ class AccountControllerTest extends TestCase
|
||||
Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency);
|
||||
Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]);
|
||||
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
$this->call('GET', '/accounts/create/asset');
|
||||
$this->assertResponseOk();
|
||||
|
@@ -194,6 +194,9 @@ class BudgetControllerTest extends TestCase
|
||||
$date = Carbon::now()->startOfMonth()->format('FY');
|
||||
Preferences::shouldReceive('set')->once()->withArgs(['budgetIncomeTotal' . $date, 1001]);
|
||||
Preferences::shouldReceive('mark')->once()->andReturn(true);
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
// language preference:
|
||||
$language = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
@@ -386,6 +389,9 @@ class BudgetControllerTest extends TestCase
|
||||
Amount::shouldReceive('format')->andReturn('xx');
|
||||
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
|
||||
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
// language preference:
|
||||
$language = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
|
@@ -108,6 +108,10 @@ class HomeControllerTest extends TestCase
|
||||
$language->save();
|
||||
Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
|
||||
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
|
||||
Amount::shouldReceive('getCurrencyCode')->andReturn('EUR');
|
||||
Amount::shouldReceive('format')->andReturn('xxx');
|
||||
|
@@ -62,6 +62,10 @@ class PreferencesControllerTest extends TestCase
|
||||
Amount::shouldReceive('getAllCurrencies')->andReturn(new Collection);
|
||||
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
|
||||
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
// language preference:
|
||||
$language = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$language->data = 'en';
|
||||
@@ -105,6 +109,10 @@ class PreferencesControllerTest extends TestCase
|
||||
$language->save();
|
||||
Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language);
|
||||
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
|
||||
$this->call('POST', '/preferences', $data);
|
||||
$this->assertResponseStatus(302);
|
||||
|
@@ -60,6 +60,14 @@ class ChartBillControllerTest extends TestCase
|
||||
$repository->shouldReceive('createFakeBill')->andReturn($bills->first());
|
||||
Steam::shouldReceive('balance')->andReturn(-10, 0);
|
||||
|
||||
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$lastActivity->data = microtime();
|
||||
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
|
||||
|
||||
$language = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$language->data = 'en';
|
||||
Preferences::shouldReceive('get')->withArgs(['language', 'en'])->andReturn($language);
|
||||
|
||||
|
||||
$this->call('GET', '/chart/bill/frontpage');
|
||||
$this->assertResponseOk();
|
||||
|
@@ -111,6 +111,9 @@ class ReportHelperTest extends TestCase
|
||||
*/
|
||||
public function testGetBillReport()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// factory!
|
||||
$set = new Collection;
|
||||
$journals = new Collection;
|
||||
|
@@ -62,6 +62,8 @@ class TransactionJournalModelTest extends TestCase
|
||||
*/
|
||||
public function testGetAmountAttributeAdvancePayment()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
// make types:
|
||||
$withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
|
||||
$depositType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
|
||||
@@ -120,6 +122,9 @@ class TransactionJournalModelTest extends TestCase
|
||||
*/
|
||||
public function testGetAmountAttributeBalancingAct()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// make types:
|
||||
$withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
|
||||
FactoryMuffin::create('FireflyIII\Models\TransactionType');
|
||||
@@ -177,6 +182,8 @@ class TransactionJournalModelTest extends TestCase
|
||||
*/
|
||||
public function testGetAmountAttributeNoTags()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
|
||||
|
||||
$journal->transactions[0]->amount = 123.45;
|
||||
@@ -194,6 +201,9 @@ class TransactionJournalModelTest extends TestCase
|
||||
*/
|
||||
public function testGetAmountAttributeTag()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// has a normal tag, but nothing special.
|
||||
// make tag
|
||||
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
|
||||
|
@@ -38,6 +38,9 @@ class BillRepositoryTest extends TestCase
|
||||
|
||||
public function testBillPaymentsInRange()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now()->endOfMonth();
|
||||
|
@@ -446,6 +446,9 @@ class JournalRepositoryTest extends TestCase
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
FactoryMuffin::create('FireflyIII\Models\AccountType');
|
||||
}
|
||||
@@ -504,6 +507,9 @@ class JournalRepositoryTest extends TestCase
|
||||
*/
|
||||
public function testUpdateNoTags()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
FactoryMuffin::create('FireflyIII\Models\AccountType');
|
||||
}
|
||||
|
Reference in New Issue
Block a user