Skip to content

Firefly III: a personal finances manager

Fixed tests.

James Cole780d137b76a7
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 6b46ed2a03..ae39246843 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -56,13 +56,13 @@ class ProfileController extends Controller
if (!Hash::check($request->get('current_password'), Auth::user()->password)) {
Session::flash('error', 'Invalid current password!');
- return Redirect::route('change-password');
+ return Redirect::route('profile.change-password');
}
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'));
if (!($result === true)) {
Session::flash('error', $result);
- return Redirect::route('change-password');
+ return Redirect::route('profile.change-password');
}
// update the user with the new password.
@@ -103,7 +103,7 @@ class ProfileController extends Controller
if (!Hash::check($request->get('password'), Auth::user()->password)) {
Session::flash('error', 'Invalid password!');
- return Redirect::route('delete-account');
+ return Redirect::route('profile.delete-account');
}
// DELETE!
diff --git a/tests/controllers/ProfileControllerTest.php b/tests/controllers/ProfileControllerTest.php
index 7f76dec19b..ff08eef3a2 100644
--- a/tests/controllers/ProfileControllerTest.php
+++ b/tests/controllers/ProfileControllerTest.php
@@ -103,8 +103,6 @@ class ProfileControllerTest extends TestCase
public function testPostChangePasswordInvalidCurrent()
{
$user = FactoryMuffin::create('FireflyIII\User');
- $user->password = bcrypt('current');
- $user->save();
$this->be($user);
$post = [
@@ -116,7 +114,7 @@ class ProfileControllerTest extends TestCase
$this->call('POST', '/profile/change-password', $post);
- $this->assertRedirectedToRoute('change-password');
+ $this->assertRedirectedToRoute('profile.change-password');
$this->assertSessionHas('error', 'Invalid current password!');
$this->assertResponseStatus(302);
@@ -144,7 +142,7 @@ class ProfileControllerTest extends TestCase
$this->assertSessionHas('error', 'The idea is to change your password.');
$this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('change-password');
+ $this->assertRedirectedToRoute('profile.change-password');
}
@@ -188,7 +186,7 @@ class ProfileControllerTest extends TestCase
$this->call('POST', '/profile/delete-account', $post);
- $this->assertRedirectedToRoute('delete-account');
+ $this->assertRedirectedToRoute('profile.delete-account');
$this->assertSessionHas('error', 'Invalid password!');
$this->assertResponseStatus(302);
diff --git a/tests/controllers/ReminderControllerTest.php b/tests/controllers/ReminderControllerTest.php
deleted file mode 100644
index b21501d850..0000000000
--- a/tests/controllers/ReminderControllerTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-use Illuminate\Support\Collection;
-use League\FactoryMuffin\Facade as FactoryMuffin;
-
-/**
- * Class ReportControllerTest
- */
-class ReminderControllerTest 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();
-
- }
-
- /**
- * This method is called before the first test of this test class is run.
- *
- * @since Method available since Release 3.4.0
- */
- public static function setUpBeforeClass()
- {
- parent::setUpBeforeClass();
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- public function tearDown()
- {
- parent::tearDown();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReminderController::act
- */
- public function testAct()
- {
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
- $this->be($reminder->remindersable->account->user);
-
- $this->call('GET', '/reminder/act/' . $reminder->id);
- $this->assertResponseStatus(302);
- $this->assertRedirectedToRoute('transactions.create', ['transfer']);
-
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReminderController::dismiss
- */
- public function testDismiss()
- {
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
- $this->be($reminder->remindersable->account->user);
-
- $this->call('GET', '/reminder/dismiss/' . $reminder->id);
- $this->assertResponseStatus(302);
- $this->assertRedirectedTo('/');
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReminderController::index
- */
- public function testIndex()
- {
- $user = FactoryMuffin::create('FireflyIII\User');
- $this->be($user);
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
- $collection = new Collection([$reminder]);
-
- $repository = $this->mock('FireflyIII\Repositories\Reminder\ReminderRepositoryInterface');
-
- $repository->shouldReceive('getActiveReminders')->andReturn($collection);
- $repository->shouldReceive('getExpiredReminders')->andReturn($collection);
- $repository->shouldReceive('getInactiveReminders')->andReturn($collection);
- $repository->shouldReceive('getDismissedReminders')->andReturn($collection);
-
- $this->call('GET', '/reminders');
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReminderController::show
- */
- public function testShow()
- {
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
- $reminder->notnow = false;
- $reminder->save();
- $this->be($reminder->remindersable->account->user);
-
- $this->call('GET', '/reminder/' . $reminder->id);
- $this->assertResponseOk();
- }
-
- /**
- * @covers FireflyIII\Http\Controllers\ReminderController::show
- */
- public function testShowDismissed()
- {
- $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder');
- $reminder->notnow = true;
- $reminder->save();
- $this->be($reminder->remindersable->account->user);
-
- $this->call('GET', '/reminder/' . $reminder->id);
- $this->assertResponseOk();
- }
-
-}