Skip to content

Firefly III: a personal finances manager

Expand tests.

James Cole1b7546f3f9d9
diff --git a/tests/acceptance/Controllers/Auth/PasswordControllerTest.php b/tests/acceptance/Controllers/Auth/PasswordControllerTest.php
deleted file mode 100644
index 65dcc62bc9..0000000000
--- a/tests/acceptance/Controllers/Auth/PasswordControllerTest.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/**
- * PasswordControllerTest.php
- * Copyright (C) 2016 [email protected]
- *
- * This software may be modified and distributed under the terms of the
- * Creative Commons Attribution-ShareAlike 4.0 International License.
- *
- * See the LICENSE file for details.
- */
-
-namespace Auth;
-
-use TestCase;
-
-/**
- * Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:32.
- */
-class PasswordControllerTest extends TestCase
-{
-
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- */
- public function setUp()
- {
- parent::setUp();
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\PasswordController::broker
- * Implement testBroker().
- */
- public function testBroker()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\PasswordController::redirectPath
- * Implement testRedirectPath().
- */
- public function testRedirectPath()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\PasswordController::reset
- * Implement testReset().
- */
- public function testReset()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\PasswordController::sendResetLinkEmail
- * Implement testSendResetLinkEmail().
- */
- public function testSendResetLinkEmail()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\PasswordController::showResetForm
- * Implement testShowResetForm().
- */
- public function testShowResetForm()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
-}
diff --git a/tests/acceptance/Controllers/Auth/RegisterControllerTest.php b/tests/acceptance/Controllers/Auth/RegisterControllerTest.php
deleted file mode 100644
index 8ed0991a75..0000000000
--- a/tests/acceptance/Controllers/Auth/RegisterControllerTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/**
- * RegisterControllerTest.php
- * Copyright (C) 2016 [email protected]
- *
- * This software may be modified and distributed under the terms of the
- * Creative Commons Attribution-ShareAlike 4.0 International License.
- *
- * See the LICENSE file for details.
- */
-
-namespace Auth;
-
-use TestCase;
-
-/**
- * Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:32.
- */
-class RegisterControllerTest extends TestCase
-{
-
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- */
- public function setUp()
- {
- parent::setUp();
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\RegisterController::redirectPath
- * Implement testRedirectPath().
- */
- public function testRedirectPath()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\RegisterController::register
- * Implement testRegister().
- */
- public function testRegister()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\RegisterController::showRegistrationForm
- * Implement testShowRegistrationForm().
- */
- public function testShowRegistrationForm()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
-}
diff --git a/tests/acceptance/Controllers/Auth/ResetPasswordControllerTest.php b/tests/acceptance/Controllers/Auth/ResetPasswordControllerTest.php
deleted file mode 100644
index 1ffbbf70d1..0000000000
--- a/tests/acceptance/Controllers/Auth/ResetPasswordControllerTest.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * ResetPasswordControllerTest.php
- * Copyright (C) 2016 [email protected]
- *
- * This software may be modified and distributed under the terms of the
- * Creative Commons Attribution-ShareAlike 4.0 International License.
- *
- * See the LICENSE file for details.
- */
-
-namespace Auth;
-
-use TestCase;
-
-/**
- * Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:32.
- */
-class ResetPasswordControllerTest extends TestCase
-{
-
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- */
- public function setUp()
- {
- parent::setUp();
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\ResetPasswordController::broker
- * Implement testBroker().
- */
- public function testBroker()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\ResetPasswordController::redirectPath
- * Implement testRedirectPath().
- */
- public function testRedirectPath()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\ResetPasswordController::reset
- * Implement testReset().
- */
- public function testReset()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\ResetPasswordController::showResetForm
- * Implement testShowResetForm().
- */
- public function testShowResetForm()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
-}
diff --git a/tests/acceptance/Controllers/Auth/TwoFactorControllerTest.php b/tests/acceptance/Controllers/Auth/TwoFactorControllerTest.php
index 33f947109c..a01fa4c750 100644
--- a/tests/acceptance/Controllers/Auth/TwoFactorControllerTest.php
+++ b/tests/acceptance/Controllers/Auth/TwoFactorControllerTest.php
@@ -11,6 +11,9 @@
namespace Auth;
+use FireflyIII\Models\Preference;
+use FireflyIII\Support\Facades\Preferences;
+use Google2FA;
use TestCase;
/**
@@ -35,10 +38,18 @@ class TwoFactorControllerTest extends TestCase
*/
public function testIndex()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+
+ $falsePreference = new Preference;
+ $falsePreference->data = true;
+ $secretPreference = new Preference;
+ $secretPreference->data = 'BlablaSeecret';
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference);
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
+ //$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));
+ $this->call('get', route('two-factor.index'));
+ $this->assertResponseStatus(200);
}
/**
@@ -47,22 +58,18 @@ class TwoFactorControllerTest extends TestCase
*/
public function testLostTwoFactor()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
+ $this->be($this->user());
- /**
- * @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::postIndex
- * Implement testPostIndex().
- */
- public function testPostIndex()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $truePreference = new Preference;
+ $truePreference->data = true;
+ $secretPreference = new Preference;
+ $secretPreference->data = 'BlablaSeecret';
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference);
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
+ Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
+ //$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));
+ $this->call('get', route('two-factor.lost'));
+ $this->assertResponseStatus(200);
}
/**
diff --git a/tests/acceptance/Controllers/Chart/AccountControllerTest.php b/tests/acceptance/Controllers/Chart/AccountControllerTest.php
index 42463ebacf..a113d151de 100644
--- a/tests/acceptance/Controllers/Chart/AccountControllerTest.php
+++ b/tests/acceptance/Controllers/Chart/AccountControllerTest.php
@@ -35,10 +35,9 @@ class AccountControllerTest extends TestCase
*/
public function testExpenseAccounts()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.expense'));
+ $this->assertResponseStatus(200);
}
/**
@@ -47,10 +46,9 @@ class AccountControllerTest extends TestCase
*/
public function testExpenseBudget()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.expense-budget', [1, '20120101', '20120131']));
+ $this->assertResponseStatus(200);
}
/**
@@ -59,10 +57,9 @@ class AccountControllerTest extends TestCase
*/
public function testExpenseCategory()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.expense-category', [1, '20120101', '20120131']));
+ $this->assertResponseStatus(200);
}
/**
@@ -71,10 +68,9 @@ class AccountControllerTest extends TestCase
*/
public function testFrontpage()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.frontpage'));
+ $this->assertResponseStatus(200);
}
/**
@@ -83,10 +79,20 @@ class AccountControllerTest extends TestCase
*/
public function testIncomeCategory()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.income-category', [1, '20120101', '20120131']));
+ $this->assertResponseStatus(200);
+ }
+
+ /**
+ * @covers \FireflyIII\Http\Controllers\Chart\AccountController::period
+ * Implement testSpecificPeriod().
+ */
+ public function testPeriod()
+ {
+ $this->be($this->user());
+ $this->call('get', route('chart.account.period', [1, '2012-01-01']));
+ $this->assertResponseStatus(200);
}
/**
@@ -95,10 +101,9 @@ class AccountControllerTest extends TestCase
*/
public function testReport()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.report', ['1', '20120101', '20120131']));
+ $this->assertResponseStatus(200);
}
/**
@@ -107,10 +112,9 @@ class AccountControllerTest extends TestCase
*/
public function testRevenueAccounts()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.revenue'));
+ $this->assertResponseStatus(200);
}
/**
@@ -119,22 +123,9 @@ class AccountControllerTest extends TestCase
*/
public function testSingle()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
- }
-
- /**
- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::specificPeriod
- * Implement testSpecificPeriod().
- */
- public function testSpecificPeriod()
- {
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('get', route('chart.account.single', [1]));
+ $this->assertResponseStatus(200);
}
/**