mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Various code coverage changes and code updates.
This commit is contained in:
@@ -87,48 +87,6 @@ class ReconcileControllerTest extends TestCase
|
||||
$response->assertRedirect(route('transactions.edit', [$journal->id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test overview of reconciliation.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
|
||||
*/
|
||||
public function testOverview(): void
|
||||
{
|
||||
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice();
|
||||
|
||||
$parameters = [
|
||||
'startBalance' => '0',
|
||||
'endBalance' => '10',
|
||||
'transactions' => [1, 2, 3],
|
||||
'cleared' => [4, 5, 6],
|
||||
];
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.overview', [1, '20170101', '20170131']) . '?' . http_build_query($parameters));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test overview when it's not an asset.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
|
||||
* @expectedExceptionMessage is not an asset account
|
||||
*/
|
||||
public function testOverviewNotAsset(): void
|
||||
{
|
||||
$account = $this->user()->accounts()->where('account_type_id', '!=', 3)->first();
|
||||
$parameters = [
|
||||
'startBalance' => '0',
|
||||
'endBalance' => '10',
|
||||
'transactions' => [1, 2, 3],
|
||||
'cleared' => [4, 5, 6],
|
||||
];
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.overview', [$account->id, '20170101', '20170131']) . '?' . http_build_query($parameters));
|
||||
$response->assertStatus(500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing the reconciliation.
|
||||
@@ -275,33 +233,6 @@ class ReconcileControllerTest extends TestCase
|
||||
$response->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* List transactions for reconciliation view.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
|
||||
*/
|
||||
public function testTransactions(): void
|
||||
{
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.transactions', [1, '20170101', '20170131']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
|
||||
*/
|
||||
public function testTransactionsInitialBalance(): void
|
||||
{
|
||||
$transaction = Transaction::leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->where('accounts.user_id', $this->user()->id)->where('accounts.account_type_id', 6)->first(['account_id']);
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.transactions', [$transaction->account_id, '20170101', '20170131']));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
|
||||
* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest
|
||||
|
@@ -25,6 +25,7 @@ namespace Tests\Feature\Controllers\Admin;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,8 @@ class UserControllerTest extends TestCase
|
||||
public function testDelete(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->once()->andReturn(true);
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('admin.users.delete', [1]));
|
||||
$response->assertStatus(200);
|
||||
@@ -62,7 +64,8 @@ class UserControllerTest extends TestCase
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->once();
|
||||
$repository->shouldReceive('hasRole')->once()->andReturn(true);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('admin.users.destroy', ['2']));
|
||||
@@ -76,6 +79,8 @@ class UserControllerTest extends TestCase
|
||||
public function testEdit(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->once()->andReturn(true);
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('admin.users.edit', [1]));
|
||||
$response->assertStatus(200);
|
||||
@@ -89,6 +94,8 @@ class UserControllerTest extends TestCase
|
||||
public function testIndex(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
//$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->times(2)->andReturn(true);
|
||||
$user = $this->user();
|
||||
$repository->shouldReceive('all')->andReturn(new Collection([$user]));
|
||||
|
||||
@@ -105,6 +112,7 @@ class UserControllerTest extends TestCase
|
||||
public function testShow(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->once()->andReturn(true);
|
||||
$repository->shouldReceive('getUserData')->andReturn(
|
||||
[
|
||||
'export_jobs_success' => 0,
|
||||
@@ -129,6 +137,8 @@ class UserControllerTest extends TestCase
|
||||
$repository->shouldReceive('changePassword')->once();
|
||||
$repository->shouldReceive('changeStatus')->once();
|
||||
$repository->shouldReceive('updateEmail')->once();
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->once()->andReturn(true);
|
||||
$data = [
|
||||
'id' => 1,
|
||||
'email' => 'test@example.com',
|
||||
|
@@ -243,19 +243,21 @@ class BillControllerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::store
|
||||
* @covers \FireflyIII\Http\Controllers\BillController
|
||||
* @covers \FireflyIII\Http\Requests\BillFormRequest
|
||||
* @covers \FireflyIII\Http\Requests\Request
|
||||
*/
|
||||
public function testStore(): void
|
||||
{
|
||||
$this->be($this->user());
|
||||
$bill = $this->user()->bills()->first();
|
||||
// mock stuff
|
||||
$attachHelper = $this->mock(AttachmentHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('store')->andReturn(new Bill);
|
||||
$repository->shouldReceive('store')->andReturn($bill);
|
||||
$attachHelper->shouldReceive('saveAttachmentsForModel');
|
||||
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
$ruleGroupRepos->shouldReceive('count')->andReturn(1);
|
||||
@@ -271,7 +273,7 @@ class BillControllerTest extends TestCase
|
||||
'repeat_freq' => 'monthly',
|
||||
];
|
||||
$this->session(['bills.create.uri' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
|
||||
$response = $this->post(route('bills.store'), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
@@ -289,8 +291,9 @@ class BillControllerTest extends TestCase
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$ruleGroupRepos =$this->mock(RuleGroupRepositoryInterface::class);
|
||||
$bill = $this->user()->bills()->first();
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('store')->andReturn(new Bill);
|
||||
$repository->shouldReceive('store')->andReturn($bill);
|
||||
$attachHelper->shouldReceive('saveAttachmentsForModel');
|
||||
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
|
||||
$ruleGroupRepos->shouldReceive('count')->andReturn(1);
|
||||
|
@@ -103,6 +103,7 @@ class IndexControllerTest extends TestCase
|
||||
$importJob = new ImportJob;
|
||||
$importJob->provider = 'fake';
|
||||
$importJob->key = 'fake_job_1';
|
||||
$importJob->user_id = 1;
|
||||
|
||||
// mock calls
|
||||
$userRepository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->andReturn(true)->once();
|
||||
@@ -135,6 +136,7 @@ class IndexControllerTest extends TestCase
|
||||
$importJob = new ImportJob;
|
||||
$importJob->provider = 'fake';
|
||||
$importJob->key = 'fake_job_2';
|
||||
$importJob->user_id = 1;
|
||||
|
||||
// mock call:
|
||||
$userRepository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->andReturn(true)->once();
|
||||
@@ -168,6 +170,7 @@ class IndexControllerTest extends TestCase
|
||||
$importJob = new ImportJob;
|
||||
$importJob->provider = 'file';
|
||||
$importJob->key = 'file_job_1';
|
||||
$importJob->user_id =1;
|
||||
|
||||
// mock calls
|
||||
$fakePrerequisites->shouldReceive('setUser')->once();
|
||||
|
122
tests/Feature/Controllers/Json/ReconcileControllerTest.php
Normal file
122
tests/Feature/Controllers/Json/ReconcileControllerTest.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* ReconcileControllerTest.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers\Json;
|
||||
|
||||
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Log;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class ReconcileControllerTest
|
||||
*/
|
||||
class ReconcileControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Log::debug(sprintf('Now in %s.', \get_class($this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test overview of reconciliation.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Json\ReconcileController
|
||||
*/
|
||||
public function testOverview(): void
|
||||
{
|
||||
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice();
|
||||
|
||||
$parameters = [
|
||||
'startBalance' => '0',
|
||||
'endBalance' => '10',
|
||||
'transactions' => [1, 2, 3],
|
||||
'cleared' => [4, 5, 6],
|
||||
];
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.overview', [1, '20170101', '20170131']) . '?' . http_build_query($parameters));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test overview when it's not an asset.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Json\ReconcileController
|
||||
* @expectedExceptionMessage is not an asset account
|
||||
*/
|
||||
public function testOverviewNotAsset(): void
|
||||
{
|
||||
$account = $this->user()->accounts()->where('account_type_id', '!=', 3)->first();
|
||||
$parameters = [
|
||||
'startBalance' => '0',
|
||||
'endBalance' => '10',
|
||||
'transactions' => [1, 2, 3],
|
||||
'cleared' => [4, 5, 6],
|
||||
];
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.overview', [$account->id, '20170101', '20170131']) . '?' . http_build_query($parameters));
|
||||
$response->assertStatus(500);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List transactions for reconciliation view.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\Json\ReconcileController
|
||||
*/
|
||||
public function testTransactions(): void
|
||||
{
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1));
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.transactions', [1, '20170101', '20170131']));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Json\ReconcileController
|
||||
*/
|
||||
public function testTransactionsInitialBalance(): void
|
||||
{
|
||||
$transaction = Transaction::leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->where('accounts.user_id', $this->user()->id)->where('accounts.account_type_id', 6)->first(['account_id']);
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('accounts.reconcile.transactions', [$transaction->account_id, '20170101', '20170131']));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -114,10 +114,10 @@ class ReportControllerTest extends TestCase
|
||||
$popupHelper = $this->mock(PopupReportInterface::class);
|
||||
$account = factory(Account::class)->make();
|
||||
|
||||
$popupHelper->shouldReceive('balanceForNoBudget')->once()->andReturn(new Collection);
|
||||
$popupHelper->shouldReceive('balanceForNoBudget')->andReturn(new Collection);
|
||||
$budgetRepos->shouldReceive('findNull')->andReturn(new Budget)->once()->withArgs([0]);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($account)->once()->withArgs([1]);
|
||||
|
||||
$popupHelper->shouldReceive('balanceForBudget')->once()->andReturn(new Collection);
|
||||
|
||||
$this->be($this->user());
|
||||
$arguments = [
|
||||
|
@@ -158,27 +158,13 @@ class ProfileControllerTest extends TestCase
|
||||
$response->assertRedirect(route('profile.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController
|
||||
*/
|
||||
public function testEnable2FADemo(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('profile.enable2FA'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('profile.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController
|
||||
*/
|
||||
public function testEnable2FANoSecret(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->twice()->andReturn(false);
|
||||
|
||||
// ask about language:
|
||||
$langPreference = new Preference;
|
||||
@@ -220,7 +206,7 @@ class ProfileControllerTest extends TestCase
|
||||
public function testEnable2FASecret(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->twice()->andReturn(false);
|
||||
|
||||
// ask about language:
|
||||
$langPreference = new Preference;
|
||||
@@ -291,6 +277,7 @@ class ProfileControllerTest extends TestCase
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('findByEmail')->once()->andReturn(null);
|
||||
$repository->shouldReceive('changeEmail')->once()->andReturn(true);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('profile.change-email.post'), $data);
|
||||
@@ -310,6 +297,7 @@ class ProfileControllerTest extends TestCase
|
||||
];
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('findByEmail')->once()->andReturn(new User);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('profile.change-email.post'), $data);
|
||||
@@ -324,6 +312,7 @@ class ProfileControllerTest extends TestCase
|
||||
public function testPostChangeEmailSame(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$data = [
|
||||
'email' => $this->user()->email,
|
||||
];
|
||||
@@ -345,6 +334,7 @@ class ProfileControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword');
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
|
||||
$data = [
|
||||
'current_password' => 'james',
|
||||
@@ -368,6 +358,7 @@ class ProfileControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword');
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
|
||||
$data = [
|
||||
'current_password' => 'james3',
|
||||
@@ -391,6 +382,7 @@ class ProfileControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword');
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
|
||||
$data = [
|
||||
'current_password' => 'james',
|
||||
@@ -440,6 +432,7 @@ class ProfileControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->once();
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$data = [
|
||||
'password' => 'james',
|
||||
];
|
||||
@@ -458,6 +451,7 @@ class ProfileControllerTest extends TestCase
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$data = [
|
||||
'password' => 'james2',
|
||||
];
|
||||
@@ -473,6 +467,8 @@ class ProfileControllerTest extends TestCase
|
||||
*/
|
||||
public function testRegenerate(): void
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->once()->andReturn(false);
|
||||
$token = '';
|
||||
$currentToken = Preference::where('user_id', $this->user()->id)->where('name', 'access_token')->first();
|
||||
if (null !== $currentToken) {
|
||||
|
@@ -264,7 +264,7 @@ class TagControllerTest extends TestCase
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('find')->andReturn(new Tag);
|
||||
$repository->shouldReceive('findNull')->andReturn(null);
|
||||
$repository->shouldReceive('store')->andReturn(new Tag);
|
||||
|
||||
$this->session(['tags.create.uri' => 'http://localhost']);
|
||||
@@ -299,7 +299,7 @@ class TagControllerTest extends TestCase
|
||||
];
|
||||
|
||||
$repository->shouldReceive('update');
|
||||
$repository->shouldReceive('find')->andReturn(Tag::first());
|
||||
$repository->shouldReceive('findNull')->andReturn(Tag::first());
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->post(route('tags.update', [1]), $data);
|
||||
|
@@ -188,7 +188,7 @@ class MassControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('update')->once();
|
||||
$repository->shouldReceive('find')->once()->andReturn($deposit);
|
||||
$repository->shouldReceive('findNull')->once()->andReturn($deposit);
|
||||
$repository->shouldReceive('getTransactionType')->andReturn('Deposit');
|
||||
$repository->shouldReceive('getNoteText')->andReturn('Some note');
|
||||
|
||||
|
@@ -84,6 +84,8 @@ class SingleControllerTest extends TestCase
|
||||
$journalRepos->shouldReceive('getJournalBudgetId')->andReturn(0);
|
||||
$journalRepos->shouldReceive('getJournalCategoryName')->andReturn('');
|
||||
$journalRepos->shouldReceive('getTags')->andReturn([]);
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturnNull();
|
||||
|
||||
|
||||
$note = new Note();
|
||||
$note->id = 5;
|
||||
|
@@ -323,7 +323,7 @@ class TransactionControllerTest extends TestCase
|
||||
$journal->date = new Carbon('2016-01-01');
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('find')->once()->andReturn($journal);
|
||||
$repository->shouldReceive('findNull')->once()->andReturn($journal);
|
||||
$repository->shouldReceive('setOrder')->once()->andReturn(true);
|
||||
|
||||
$data = [
|
||||
|
Reference in New Issue
Block a user