Skip to content

Firefly III: a personal finances manager

All of this should contain one working test.

James Cole7329c0b200a9
diff --git a/app/database/migrations/2014_11_13_062347_expand_reminders_table.php b/app/database/migrations/2014_11_13_062347_expand_reminders_table.php
deleted file mode 100644
index c6e7993b50..0000000000
--- a/app/database/migrations/2014_11_13_062347_expand_reminders_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-
-class ExpandRemindersTable extends Migration
-{
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- //
- }
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table(
- 'reminders', function (Blueprint $table) {
- $table->string('title');
- $table->text('data');
- }
- );
- }
-
-}
diff --git a/app/database/migrations/2014_11_15_112449_extend_piggybank_events.php b/app/database/migrations/2014_11_15_112449_extend_piggybank_events.php
index 5fc8ea6f96..8b5880c958 100644
--- a/app/database/migrations/2014_11_15_112449_extend_piggybank_events.php
+++ b/app/database/migrations/2014_11_15_112449_extend_piggybank_events.php
@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
class ExtendPiggybankEvents extends Migration
{
diff --git a/app/database/migrations/2014_11_17_194734_event_table_additions_1.php b/app/database/migrations/2014_11_17_194734_event_table_additions_1.php
index 3ae334b60e..1e0097d757 100644
--- a/app/database/migrations/2014_11_17_194734_event_table_additions_1.php
+++ b/app/database/migrations/2014_11_17_194734_event_table_additions_1.php
@@ -26,10 +26,8 @@ class EventTableAdditions1 extends Migration
// remove some fields:
Schema::table(
'reminders', function (Blueprint $table) {
- $table->dropColumn('title');
- $table->dropColumn('data');
$table->integer('remembersable_id')->unsigned()->nullable();
- $table->string('remembersable_type');
+ $table->string('remembersable_type')->nullable();
}
);
}
diff --git a/app/filters.php b/app/filters.php
index 3d119c2a3b..de94e1a05e 100644
--- a/app/filters.php
+++ b/app/filters.php
@@ -4,6 +4,7 @@
App::before(
function ($request) {
+ $reminders = [];
if (Auth::check()) {
/** @var \FireflyIII\Shared\Toolkit\Filter $toolkit */
@@ -14,9 +15,10 @@ App::before(
$reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders');
$reminderKit->updateReminders();
- View::share('reminders',$reminderKit->getReminders());
+ $reminders = $reminderKit->getReminders();
}
+ View::share('reminders', $reminders);
}
);
diff --git a/app/models/User.php b/app/models/User.php
index 0ce9515e51..e58e572133 100644
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -42,6 +42,7 @@ class User extends Ardent implements UserInterface, RemindableInterface
public static $rules
= ['email' => 'required|email|unique:users,email', 'migrated' => 'required|boolean', 'password' => 'required|between:60,60',
'reset' => 'between:32,32',];
+ protected $fillable = ['email'];
/**
* The attributes excluded from the model's JSON form.
*
diff --git a/app/tests/HomeControllerTest.php b/app/tests/HomeControllerTest.php
index 7157067a7a..032ad2669c 100644
--- a/app/tests/HomeControllerTest.php
+++ b/app/tests/HomeControllerTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Generated by PHPUnit_SkeletonGenerator on 2014-11-18 at 09:03:51.
*/
@@ -15,14 +16,7 @@ class HomeControllerTest extends TestCase
*/
public function setUp()
{
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
+ parent::setUp();
}
/**
@@ -32,9 +26,7 @@ class HomeControllerTest extends TestCase
public function testFlush()
{
// Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->markTestIncomplete('This test has not been implemented yet.');
}
/**
@@ -43,10 +35,12 @@ class HomeControllerTest 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(new User(['email' => '[email protected]']));
+
+ $response = $this->call('GET', '/');
+ $this->assertResponseOk();
+
+ $this->assertTrue(true);
}
/**
@@ -84,4 +78,12 @@ class HomeControllerTest extends TestCase
'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/app/tests/TestCase.php b/app/tests/TestCase.php
index 08770a901e..f38b1effd9 100644
--- a/app/tests/TestCase.php
+++ b/app/tests/TestCase.php
@@ -15,4 +15,11 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase {
$testEnvironment = 'testing';
return require __DIR__.'/../../bootstrap/start.php';
}
+
+ public function setUp() {
+ parent::setUp();
+ Artisan::call('migrate');
+ $this->seed();
+ //$this->
+ }
}
\ No newline at end of file
diff --git a/app/views/partials/menu.blade.php b/app/views/partials/menu.blade.php
index 53a8736903..b571ba27b5 100644
--- a/app/views/partials/menu.blade.php
+++ b/app/views/partials/menu.blade.php
@@ -14,7 +14,7 @@
<ul class="nav navbar-top-links navbar-right">
<!-- reminders -->
- @if(count($reminders) > 0)
+ @if(isset($reminders) && count($reminders) > 0)
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
diff --git a/phpunit.xml b/phpunit.xml
index b5214fb9db..39d5a21a63 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -24,7 +24,6 @@
<directory suffix=".php">./app/helpers</directory>
<exclude>
<file>./app/controllers/BaseController.php</file>
- <file>./app/controllers/MigrationController.php</file>
</exclude>
</whitelist>