Fix tests.

This commit is contained in:
James Cole
2018-07-01 09:27:22 +02:00
parent 0502f2a4a5
commit db149ca6e1
50 changed files with 551 additions and 647 deletions

View File

@@ -37,10 +37,6 @@ use Mockery;
/**
* Class ConfigurationControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReconcileControllerTest extends TestCase
{
@@ -54,7 +50,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit
* Test editing a reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testEdit(): void
{
@@ -76,7 +74,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::edit
* Test the redirect if journal is not a reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testEditRedirect(): void
{
@@ -88,7 +88,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview()
* Test overview of reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testOverview(): void
{
@@ -109,7 +111,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::overview()
* Test overview when it's not an asset.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
* @expectedExceptionMessage is not an asset account
*/
public function testOverviewNotAsset(): void
@@ -127,9 +131,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()
* Test showing the reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testReconcile(): void
{
@@ -144,9 +148,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()
* Test showing the reconciliation (its a initial balance).
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testReconcileInitialBalance(): void
{
@@ -158,9 +162,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()
* Test reconcile view (without date info).
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testReconcileNoDates(): void
{
@@ -176,9 +180,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()
* Test reconcile view (without end date).
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testReconcileNoEndDate(): void
{
@@ -194,9 +198,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::__construct
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::reconcile()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::redirectToOriginalAccount()
* Test reconcile view when account is not an asset.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testReconcileNotAsset(): void
{
@@ -207,7 +211,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show()
* Test show for actual reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testShow(): void
{
@@ -225,7 +231,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::show()
* Test show for actual reconciliation, but its not a reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testShowSomethingElse(): void
{
@@ -237,7 +245,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::submit()
* Submit reconciliation.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
* @covers \FireflyIII\Http\Requests\ReconciliationStoreRequest
*/
public function testSubmit(): void
@@ -266,7 +276,9 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions()
* List transactions for reconciliation view.
*
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testTransactions(): void
{
@@ -279,7 +291,7 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::transactions()
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
*/
public function testTransactionsInitialBalance(): void
{
@@ -291,7 +303,7 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest
*/
public function testUpdate(): void
@@ -314,7 +326,7 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest
*/
public function testUpdateNotReconcile(): void
@@ -331,7 +343,7 @@ class ReconcileControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController::update
* @covers \FireflyIII\Http\Controllers\Account\ReconcileController
* @covers \FireflyIII\Http\Requests\ReconciliationUpdateRequest
*/
public function testUpdateZero(): void

View File

@@ -29,10 +29,6 @@ use Tests\TestCase;
/**
* Class ConfigurationControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ConfigurationControllerTest extends TestCase
{

View File

@@ -29,10 +29,6 @@ use Tests\TestCase;
/**
* Class HomeControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class HomeControllerTest extends TestCase
{
@@ -46,8 +42,7 @@ class HomeControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\HomeController::index
* @covers \FireflyIII\Http\Controllers\Admin\HomeController::__construct
* @covers \FireflyIII\Http\Controllers\Admin\HomeController
*/
public function testIndex(): void
{
@@ -58,6 +53,9 @@ class HomeControllerTest extends TestCase
$response->assertSee('<ol class="breadcrumb">');
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\HomeController
*/
public function testTestMessage(): void
{
Event::fake();

View File

@@ -30,10 +30,6 @@ use Tests\TestCase;
/**
* Class LinkControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LinkControllerTest extends TestCase
{
@@ -47,8 +43,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::__construct
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::create
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testCreate(): void
{
@@ -59,7 +54,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::delete
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testDeleteEditable(): void
{
@@ -76,7 +71,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::delete
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testDeleteNonEditable(): void
{
@@ -89,7 +84,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::destroy
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testDestroy(): void
{
@@ -99,7 +94,7 @@ class LinkControllerTest extends TestCase
LinkType::create(['editable' => 1, 'inward' => 'hellox', 'outward' => 'byex', 'name' => 'Test typeX']);
$linkType = LinkType::where('editable', 1)->first();
$repository->shouldReceive('find')->andReturn($linkType);
$repository->shouldReceive('findNull')->andReturn($linkType);
$repository->shouldReceive('destroy');
$this->be($this->user());
$this->session(['link_types.delete.uri' => 'http://localhost']);
@@ -109,7 +104,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::edit
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testEditEditable(): void
{
@@ -123,7 +118,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::edit
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testEditNonEditable(): void
{
@@ -135,7 +130,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::index
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testIndex(): void
{
@@ -149,7 +144,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::show
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
*/
public function testShow(): void
{
@@ -160,7 +155,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::store
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest
*/
public function testStore(): void
@@ -172,7 +167,7 @@ class LinkControllerTest extends TestCase
'outward' => 'test outward' . random_int(1, 1000),
];
$repository->shouldReceive('store')->once()->andReturn(LinkType::first());
$repository->shouldReceive('find')->andReturn(LinkType::first());
$repository->shouldReceive('findNull')->andReturn(LinkType::first());
$this->session(['link_types.create.uri' => 'http://localhost']);
$this->be($this->user());
@@ -182,7 +177,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::store
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest
*/
public function testStoreRedirect(): void
@@ -203,7 +198,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::update
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest
*/
public function testUpdate(): void
@@ -227,7 +222,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::update
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest
*/
public function testUpdateNonEditable(): void
@@ -249,7 +244,7 @@ class LinkControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\LinkController::update
* @covers \FireflyIII\Http\Controllers\Admin\LinkController
* @covers \FireflyIII\Http\Requests\LinkTypeFormRequest
*/
public function testUpdateRedirect(): void

View File

@@ -34,10 +34,6 @@ use Tests\TestCase;
/**
* Class UpdateControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class UpdateControllerTest extends TestCase
{
@@ -51,8 +47,7 @@ class UpdateControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::index
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::__construct
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testIndex(): void
{
@@ -75,7 +70,7 @@ class UpdateControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::post
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testPost(): void
{
@@ -93,7 +88,7 @@ class UpdateControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testUpdateCheck(): void
{
@@ -122,7 +117,7 @@ class UpdateControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testUpdateCheckCurrent(): void
{
@@ -149,7 +144,7 @@ class UpdateControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testUpdateCheckError(): void
{
@@ -172,7 +167,7 @@ class UpdateControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController::updateCheck
* @covers \FireflyIII\Http\Controllers\Admin\UpdateController
*/
public function testUpdateCheckNewer(): void
{

View File

@@ -29,10 +29,6 @@ use Tests\TestCase;
/**
* Class UserControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class UserControllerTest extends TestCase
{
@@ -46,7 +42,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::delete
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testDelete(): void
{
@@ -58,7 +54,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::destroy
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testDestroy(): void
{
@@ -71,7 +67,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::edit
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testEdit(): void
{
@@ -83,8 +79,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::index
* @covers \FireflyIII\Http\Controllers\Admin\UserController::__construct
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testIndex(): void
{
@@ -100,7 +95,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::show
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testShow(): void
{
@@ -121,7 +116,7 @@ class UserControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\UserController::update
* @covers \FireflyIII\Http\Controllers\Admin\UserController
*/
public function testUpdate(): void
{

View File

@@ -28,10 +28,6 @@ use Tests\TestCase;
/**
* Class ForgotPasswordControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ForgotPasswordControllerTest extends TestCase
{
@@ -45,8 +41,7 @@ class ForgotPasswordControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::__construct
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::sendResetLinkEmail
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController
*/
public function testSendResetLinkEmail(): void
{
@@ -62,8 +57,7 @@ class ForgotPasswordControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::__construct
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController::sendResetLinkEmail
* @covers \FireflyIII\Http\Controllers\Auth\ForgotPasswordController
*/
public function testSendResetLinkEmailDemo(): void
{

View File

@@ -30,10 +30,6 @@ use Tests\TestCase;
/**
* Class TwoFactorControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class TwoFactorControllerTest extends TestCase
{
@@ -47,7 +43,7 @@ class TwoFactorControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController
*/
public function testIndex(): void
{
@@ -70,7 +66,7 @@ class TwoFactorControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController
*/
public function testIndexNo2FA(): void
{
@@ -92,7 +88,7 @@ class TwoFactorControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::index
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController
* @expectedExceptionMessage Your two factor authentication secret is empty
*/
public function testIndexNoSecret(): void
@@ -116,7 +112,7 @@ class TwoFactorControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::lostTwoFactor
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController
*/
public function testLostTwoFactor(): void
{
@@ -139,7 +135,7 @@ class TwoFactorControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::postIndex
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController
*/
public function testPostIndex(): void
{

View File

@@ -43,10 +43,6 @@ use Tests\TestCase;
/**
* Class AccountControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AccountControllerTest extends TestCase
{
@@ -60,8 +56,8 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseAccounts
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::singleSet
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -84,8 +80,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseBudget
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::getBudgetNames
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -112,8 +107,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseBudgetAll
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::getBudgetNames
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -142,8 +136,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseCategory
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::getCategoryNames
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -171,8 +164,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseCategoryAll
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::getCategoryNames
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -202,10 +194,8 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::accountBalanceChart
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::multiSet
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -232,7 +222,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::incomeCategory
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -260,7 +250,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::incomeCategoryAll
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -290,7 +280,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::period
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -311,8 +301,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::report
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::accountBalanceChart
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
*/
public function testReport(): void
{
@@ -328,7 +317,7 @@ class AccountControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::revenueAccounts
* @covers \FireflyIII\Http\Controllers\Chart\AccountController
* @dataProvider dateRangeProvider
*
* @param string $range

View File

@@ -32,10 +32,6 @@ use Tests\TestCase;
/**
* Class BillControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BillControllerTest extends TestCase
{
@@ -49,8 +45,7 @@ class BillControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BillController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\BillController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\BillController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -71,7 +66,7 @@ class BillControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BillController::single
* @covers \FireflyIII\Http\Controllers\Chart\BillController
*/
public function testSingle(): void
{

View File

@@ -40,10 +40,6 @@ use Tests\TestCase;
/**
* Class BudgetControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BudgetControllerTest extends TestCase
{
@@ -57,8 +53,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -79,7 +74,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -99,7 +94,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @expectedExceptionMessage This budget limit is not part of this budget.
*/
public function testBudgetLimitWrongLimit(): void
@@ -113,8 +108,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseAsset
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getAccountNames
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -142,8 +136,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseCategory
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getCategoryNames
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -176,8 +169,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::expenseExpense
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getAccountNames
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -210,10 +202,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -247,10 +236,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -286,10 +272,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getExpensesForBudget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodWithout
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::spentInPeriodMulti
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -321,8 +304,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::period
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::getBudgetedInPeriod
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
*/
public function testPeriod(): void
{
@@ -342,7 +324,7 @@ class BudgetControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::periodNoBudget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController
*/
public function testPeriodNoBudget(): void
{

View File

@@ -39,10 +39,6 @@ use Tests\TestCase;
/**
* Class BudgetReportControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BudgetReportControllerTest extends TestCase
{
@@ -56,8 +52,7 @@ class BudgetReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::accountExpense
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController
*/
public function testAccountExpense(): void
{
@@ -80,7 +75,7 @@ class BudgetReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::budgetExpense
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController
*/
public function testBudgetExpense(): void
{
@@ -102,10 +97,7 @@ class BudgetReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::mainChart
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::filterBudgetLimits
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::getExpenses
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController::groupByBudget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetReportController
*/
public function testMainChart(): void
{

View File

@@ -35,10 +35,6 @@ use Tests\TestCase;
/**
* Class CategoryControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryControllerTest extends TestCase
{
@@ -52,8 +48,7 @@ class CategoryControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::all
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -80,7 +75,7 @@ class CategoryControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::frontpage
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController
* @dataProvider dateRangeProvider
*
* @param string $range
@@ -106,7 +101,7 @@ class CategoryControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriod
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController
*/
public function testReportPeriod(): void
{
@@ -123,7 +118,7 @@ class CategoryControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriodNoCategory
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController
*/
public function testReportPeriodNoCategory(): void
{
@@ -140,8 +135,7 @@ class CategoryControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::specificPeriod
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::makePeriodChart
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController
* @dataProvider dateRangeProvider
*
* @param string $range

View File

@@ -36,10 +36,6 @@ use Tests\TestCase;
/**
* Class CategoryReportControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryReportControllerTest extends TestCase
{
@@ -53,8 +49,7 @@ class CategoryReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountExpense
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController
*/
public function testAccountExpense(): void
{
@@ -75,7 +70,7 @@ class CategoryReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountIncome
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController
*/
public function testAccountIncome(): void
{
@@ -96,7 +91,7 @@ class CategoryReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryExpense
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController
*/
public function testCategoryExpense(): void
{
@@ -117,7 +112,7 @@ class CategoryReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryIncome
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController
*/
public function testCategoryIncome(): void
{
@@ -138,10 +133,7 @@ class CategoryReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::mainChart
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::groupByCategory
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::getExpenses
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::getIncome
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController
*/
public function testMainChart(): void
{

View File

@@ -33,10 +33,6 @@ use Tests\TestCase;
/**
* Class ExpenseReportControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ExpenseReportControllerTest extends TestCase
{
@@ -51,12 +47,7 @@ class ExpenseReportControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::groupByName
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::mainChart()
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::getExpenses
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::getIncome
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController::combineAccounts
* @covers \FireflyIII\Http\Controllers\Chart\ExpenseReportController
*/
public function testMainChart(): void
{

View File

@@ -31,10 +31,6 @@ use Tests\TestCase;
/**
* Class PiggyBankControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PiggyBankControllerTest extends TestCase
{
@@ -48,8 +44,7 @@ class PiggyBankControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController::history
* @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\PiggyBankController
*/
public function testHistory(): void
{

View File

@@ -30,10 +30,6 @@ use Tests\TestCase;
/**
* Class ReportControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReportControllerTest extends TestCase
{
@@ -47,9 +43,7 @@ class ReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::netWorth
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::arraySum
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\ReportController
*/
public function testNetWorth(): void
{
@@ -64,8 +58,7 @@ class ReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::operations
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::getChartData
* @covers \FireflyIII\Http\Controllers\Chart\ReportController
*/
public function testOperations(): void
{
@@ -83,8 +76,7 @@ class ReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::sum
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::getChartData
* @covers \FireflyIII\Http\Controllers\Chart\ReportController
*/
public function testSum(): void
{

View File

@@ -40,10 +40,6 @@ use Tests\TestCase;
/**
* Class TagReportControllerTest
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class TagReportControllerTest extends TestCase
{
@@ -57,8 +53,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::accountExpense
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::__construct
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testAccountExpense(): void
{
@@ -86,7 +81,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::accountIncome
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testAccountIncome(): void
{
@@ -113,7 +108,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::budgetExpense()
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testBudgetExpense(): void
{
@@ -139,7 +134,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::categoryExpense()
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testCategoryExpense(): void
{
@@ -165,10 +160,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::mainChart()
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::getExpenses
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::getIncome
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::groupByTag
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testMainChart(): void
{
@@ -207,7 +199,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::tagExpense()
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testTagExpense(): void
{
@@ -233,7 +225,7 @@ class TagReportControllerTest extends TestCase
}
/**
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController::tagIncome
* @covers \FireflyIII\Http\Controllers\Chart\TagReportController
*/
public function testTagIncome(): void
{

View File

@@ -109,8 +109,6 @@ class PiggyBankControllerTest extends TestCase
$currencyRepos->shouldReceive('findNull')->andReturn($currency);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getAccountsByType')
->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('balance')->andReturn('0');
@@ -196,13 +194,12 @@ class PiggyBankControllerTest extends TestCase
public function testIndex(): void
{
// mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$one = factory(PiggyBank::class)->make();
$two = factory(PiggyBank::class)->make();
$two->account_id = $one->account_id;
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two]));
$first = $this->user()->transactionJournals()->inRandomOrder()->first();
$repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$piggies = $this->user()->piggyBanks()->take(2)->get();
$journalRepos->shouldReceive('firstNull')->once()->andReturn($first);
$repository->shouldReceive('getPiggyBanks')->andReturn($piggies);
$repository->shouldReceive('getCurrentAmount')->andReturn('10');
$repository->shouldReceive('setUser');
$repository->shouldReceive('correctOrder');
@@ -350,10 +347,11 @@ class PiggyBankControllerTest extends TestCase
public function testShow(): void
{
// mock stuff
$first = $this->user()->transactionJournals()->inRandomOrder()->first();
$repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('setUser')->once();
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn($first);
$repository->shouldReceive('getEvents')->andReturn(new Collection);
$repository->shouldReceive('getSuggestedMonthlyAmount')->andReturn('1');
$repository->shouldReceive('getCurrentAmount')->andReturn('1');

View File

@@ -173,43 +173,6 @@ class ReportControllerTest extends TestCase
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::parseAttributes
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::balanceAmount
*/
public function testBalanceAmountDiffRole(): void
{
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$popupHelper = $this->mock(PopupReportInterface::class);
$budget = factory(Budget::class)->make();
$account = factory(Account::class)->make();
$budgetRepos->shouldReceive('findNull')->andReturn($budget)->once()->withArgs([1]);
$accountRepos->shouldReceive('findNull')->andReturn($account)->once()->withArgs([1]);
$popupHelper->shouldReceive('balanceDifference')->once()->andReturn(new Collection);
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'balance-amount',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
'role' => 3, // diff role, is complicated.
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$response = $this->get($uri);
$response->assertStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::parseAttributes

View File

@@ -25,7 +25,6 @@ namespace Tests\Feature\Controllers\Transaction;
use Amount;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -64,7 +63,15 @@ class ConvertControllerTest extends TestCase
// mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// find deposit:
$loop = 0;
do {
$deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $deposit->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
$journalRepos->shouldReceive('firstNull')->andReturn($deposit);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -75,15 +82,12 @@ class ConvertControllerTest extends TestCase
$this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getAccountsByType')
->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(3);
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);
Amount::shouldReceive('formatAnything')->andReturn('0')->once();
$this->be($this->user());
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$response = $this->get(route('transactions.convert.index', ['transfer', $deposit->id]));
$response->assertStatus(200);
$response->assertSee('Convert a deposit into a transfer');
@@ -96,7 +100,16 @@ class ConvertControllerTest extends TestCase
{
// mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// find deposit:
$loop = 0;
do {
$deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $deposit->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
$journalRepos->shouldReceive('firstNull')->andReturn($deposit);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -107,7 +120,7 @@ class ConvertControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->twice();
Amount::shouldReceive('formatAnything')->andReturn('0')->once();
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$this->be($this->user());
$response = $this->get(route('transactions.convert.index', ['withdrawal', $deposit->id]));
$response->assertStatus(200);
@@ -120,12 +133,21 @@ class ConvertControllerTest extends TestCase
public function testIndexSameType(): void
{
// mock stuff:
// find deposit:
$loop = 0;
do {
$deposit = TransactionJournal::where('transaction_type_id', 2)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $deposit->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->andReturn($deposit);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$this->be($this->user());
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$response = $this->get(route('transactions.convert.index', ['deposit', $deposit->id]));
$response->assertStatus(302);
$response->assertSessionHas('info');
@@ -166,14 +188,21 @@ class ConvertControllerTest extends TestCase
public function testIndexTransferDeposit(): void
{
// mock stuff:
// find transfer:
$loop = 0;
do {
$transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $transfer->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->andReturn($transfer);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
$transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();
$this->be($this->user());
$response = $this->get(route('transactions.convert.index', ['deposit', $transfer->id]));
$response->assertStatus(200);
@@ -185,6 +214,14 @@ class ConvertControllerTest extends TestCase
*/
public function testIndexTransferWithdrawal(): void
{
// find transfer:
$loop = 0;
do {
$transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $transfer->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
// mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
@@ -197,7 +234,6 @@ class ConvertControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);
Amount::shouldReceive('formatAnything')->andReturn('0')->once();
$transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();
$this->be($this->user());
$response = $this->get(route('transactions.convert.index', ['withdrawal', $transfer->id]));
$response->assertStatus(200);
@@ -209,6 +245,15 @@ class ConvertControllerTest extends TestCase
*/
public function testIndexWithdrawalDeposit(): void
{
// find withdrawal:
$loop = 0;
do {
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $withdrawal->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
// mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
@@ -221,7 +266,6 @@ class ConvertControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);
Amount::shouldReceive('formatAnything')->andReturn('0')->once();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$this->be($this->user());
$response = $this->get(route('transactions.convert.index', ['deposit', $withdrawal->id]));
$response->assertStatus(200);
@@ -233,6 +277,14 @@ class ConvertControllerTest extends TestCase
*/
public function testIndexWithdrawalTransfer(): void
{
// find withdrawal:
$loop = 0;
do {
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $withdrawal->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
// mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
@@ -242,17 +294,13 @@ class ConvertControllerTest extends TestCase
// mock stuff for new account list thing.
$currency = TransactionCurrency::first();
$account = factory(Account::class)->make();
$this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getAccountsByType')
->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->once();
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(3);
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency)->times(2);
Amount::shouldReceive('formatAnything')->andReturn('0')->once();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$this->be($this->user());
$response = $this->get(route('transactions.convert.index', ['transfer', $withdrawal->id]));
$response->assertStatus(200);
@@ -274,12 +322,6 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('find')->andReturn(new Account);
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$accountRepos->shouldReceive('findNull')->andReturn($account)->once();
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['source_account_asset' => 1];
$this->be($this->user());
@@ -304,8 +346,6 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('store')->andReturn(new Account);
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_expense' => 'New expense name.'];
@@ -328,15 +368,8 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_expense' => ''];
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_expense' => ''];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['withdrawal', $deposit->id]), $data);
$response->assertStatus(302);
@@ -353,6 +386,14 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$account = $this->user()->accounts()->first();
// find withdrawal:
$loop = 0;
do {
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $withdrawal->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
// mock stuff
$messageBag = new MessageBag;
@@ -364,10 +405,7 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$accountRepos->shouldReceive('findNull')->andReturn($account)->once();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = [
$data = [
'destination_account_asset' => 2,
];
$this->be($this->user());
@@ -434,6 +472,14 @@ class ConvertControllerTest extends TestCase
*/
public function testPostIndexTransferDeposit(): void
{
// find transfer:
$loop = 0;
do {
$transfer = TransactionJournal::where('transaction_type_id', 3)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $transfer->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
// mock stuff
$repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag);
@@ -446,8 +492,7 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();
$data = ['source_account_revenue' => 'New rev'];
$data = ['source_account_revenue' => 'New rev'];
$this->be($this->user());
$response = $this->post(route('transactions.convert.index', ['deposit', $transfer->id]), $data);
$response->assertStatus(302);
@@ -466,13 +511,6 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('store')->andReturn(new Account)->once();
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = ['source_account_revenue' => 'New revenue name.'];
$this->be($this->user());
@@ -493,13 +531,6 @@ class ConvertControllerTest extends TestCase
$repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = ['source_account_revenue' => ''];
$this->be($this->user());
@@ -523,10 +554,6 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('findNull')->andReturn(new Account);
$account = $this->user()->accounts()->first();
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = ['destination_account_asset' => 2,];
$this->be($this->user());

View File

@@ -33,7 +33,6 @@ use FireflyIII\Models\Note;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
@@ -352,7 +351,7 @@ class SingleControllerTest extends TestCase
$response->assertStatus(200);
// has bread crumb
$response->assertSee('<ol class="breadcrumb">');
$response->assertSee(' name="destinationt_name" type="text" value="">');
$response->assertSee(' name="destination_name" type="text" value="">');
}
/**
@@ -592,8 +591,8 @@ class SingleControllerTest extends TestCase
'what' => 'withdrawal',
'amount' => '10',
'amount_currency_id_amount' => 1,
'source_id' => 1,
'destination_name' => 'Some destination',
'source_id' => 1,
'destination_name' => 'Some destination',
'date' => '2016-01-01',
'description' => 'Test descr',
];
@@ -645,8 +644,8 @@ class SingleControllerTest extends TestCase
'what' => 'withdrawal',
'amount' => '10',
'amount_currency_id_amount' => 1,
'source_id' => 1,
'destination_name' => 'Some destination',
'source_id' => 1,
'destination_name' => 'Some destination',
'date' => '2016-01-01',
'description' => 'Test descr',
];
@@ -700,8 +699,8 @@ class SingleControllerTest extends TestCase
'what' => 'deposit',
'amount' => '10',
'amount_currency_id_amount' => 1,
'destination_id' => 1,
'source_name' => 'Some source',
'destination_id' => 1,
'source_name' => 'Some source',
'date' => '2016-01-01',
'description' => 'Test descr',
];
@@ -756,8 +755,8 @@ class SingleControllerTest extends TestCase
'what' => 'transfer',
'amount' => '10',
'amount_currency_id_amount' => 1,
'destination_id' => 1,
'source_id' => 2,
'destination_id' => 1,
'source_id' => 2,
'date' => '2016-01-01',
'description' => 'Test descr',
];
@@ -814,8 +813,8 @@ class SingleControllerTest extends TestCase
'amount_currency_id_amount' => 1,
'source_account_currency' => 1,
'destination_account_currency' => 2,
'destination_id' => 1,
'source_id' => 2,
'destination_id' => 1,
'source_id' => 2,
'date' => '2016-01-01',
'description' => 'Test descr',
];
@@ -858,13 +857,15 @@ class SingleControllerTest extends TestCase
$this->assertTrue(false, $e->getMessage());
}
$journal = new TransactionJournal();
$type = TransactionType::find(1);
$journal->id = 1000;
$journal->description = 'New journal';
$journal->transactionType()->associate($type);
// find withdrawal:
$loop = 0;
do {
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->inRandomOrder()->where('user_id', $this->user()->id)->first();
$count = $withdrawal->transactions()->count();
$loop++;
} while ($count !== 2 && $loop < 30);
$journalRepos->shouldReceive('update')->andReturn($journal);
$journalRepos->shouldReceive('update')->andReturn($withdrawal);
$this->session(['transactions.edit.uri' => 'http://localhost']);
$this->be($this->user());
@@ -872,8 +873,8 @@ class SingleControllerTest extends TestCase
'id' => 123,
'what' => 'withdrawal',
'description' => 'Updated groceries',
'source_id' => 1,
'destination_name' => 'PLUS',
'source_id' => 1,
'destination_name' => 'PLUS',
'amount' => '123',
'amount_currency_id_amount' => 1,
'budget_id' => 1,
@@ -882,13 +883,13 @@ class SingleControllerTest extends TestCase
'date' => '2016-01-01',
];
$response = $this->post(route('transactions.update', [123]), $data);
$response = $this->post(route('transactions.update', [$withdrawal->id]), $data);
$response->assertStatus(302);
$response->assertSessionHas('success');
$response = $this->get(route('transactions.show', [123]));
$response = $this->get(route('transactions.show', [$withdrawal->id]));
$response->assertStatus(200);
$response->assertSee('Updated groceries');
$response->assertSee($withdrawal->description);
// has bread crumb
$response->assertSee('<ol class="breadcrumb">');
}