mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Fixed tests.
This commit is contained in:
parent
ad8a9717d1
commit
780d137b76
@ -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!
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user