All of this should contain one working test.

This commit is contained in:
James Cole
2014-11-18 10:33:38 +01:00
parent 0afe3c48a1
commit 7329c0b200
9 changed files with 31 additions and 54 deletions

View File

@@ -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');
}
);
}
}

View File

@@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class ExtendPiggybankEvents extends Migration class ExtendPiggybankEvents extends Migration
{ {

View File

@@ -26,10 +26,8 @@ class EventTableAdditions1 extends Migration
// remove some fields: // remove some fields:
Schema::table( Schema::table(
'reminders', function (Blueprint $table) { 'reminders', function (Blueprint $table) {
$table->dropColumn('title');
$table->dropColumn('data');
$table->integer('remembersable_id')->unsigned()->nullable(); $table->integer('remembersable_id')->unsigned()->nullable();
$table->string('remembersable_type'); $table->string('remembersable_type')->nullable();
} }
); );
} }

View File

@@ -4,6 +4,7 @@
App::before( App::before(
function ($request) { function ($request) {
$reminders = [];
if (Auth::check()) { if (Auth::check()) {
/** @var \FireflyIII\Shared\Toolkit\Filter $toolkit */ /** @var \FireflyIII\Shared\Toolkit\Filter $toolkit */
@@ -14,9 +15,10 @@ App::before(
$reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders'); $reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders');
$reminderKit->updateReminders(); $reminderKit->updateReminders();
View::share('reminders',$reminderKit->getReminders()); $reminders = $reminderKit->getReminders();
} }
View::share('reminders', $reminders);
} }
); );

View File

@@ -42,6 +42,7 @@ class User extends Ardent implements UserInterface, RemindableInterface
public static $rules public static $rules
= ['email' => 'required|email|unique:users,email', 'migrated' => 'required|boolean', 'password' => 'required|between:60,60', = ['email' => 'required|email|unique:users,email', 'migrated' => 'required|boolean', 'password' => 'required|between:60,60',
'reset' => 'between:32,32',]; 'reset' => 'between:32,32',];
protected $fillable = ['email'];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
* *

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2014-11-18 at 09:03:51. * Generated by PHPUnit_SkeletonGenerator on 2014-11-18 at 09:03:51.
*/ */
@@ -15,14 +16,7 @@ class HomeControllerTest extends TestCase
*/ */
public function setUp() public function setUp()
{ {
} parent::setUp();
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
} }
/** /**
@@ -32,9 +26,7 @@ class HomeControllerTest extends TestCase
public function testFlush() public function testFlush()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete('This test has not been implemented yet.');
'This test has not been implemented yet.'
);
} }
/** /**
@@ -43,10 +35,12 @@ class HomeControllerTest extends TestCase
*/ */
public function testIndex() public function testIndex()
{ {
// Remove the following lines when you implement this test. $this->be(new User(['email' => 'test@example.com']));
$this->markTestIncomplete(
'This test has not been implemented yet.' $response = $this->call('GET', '/');
); $this->assertResponseOk();
$this->assertTrue(true);
} }
/** /**
@@ -84,4 +78,12 @@ class HomeControllerTest extends TestCase
'This test has not been implemented yet.' '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()
{
}
} }

View File

@@ -15,4 +15,11 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase {
$testEnvironment = 'testing'; $testEnvironment = 'testing';
return require __DIR__.'/../../bootstrap/start.php'; return require __DIR__.'/../../bootstrap/start.php';
} }
public function setUp() {
parent::setUp();
Artisan::call('migrate');
$this->seed();
//$this->
}
} }

View File

@@ -14,7 +14,7 @@
<ul class="nav navbar-top-links navbar-right"> <ul class="nav navbar-top-links navbar-right">
<!-- reminders --> <!-- reminders -->
@if(count($reminders) > 0) @if(isset($reminders) && count($reminders) > 0)
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i> <i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>

View File

@@ -24,7 +24,6 @@
<directory suffix=".php">./app/helpers</directory> <directory suffix=".php">./app/helpers</directory>
<exclude> <exclude>
<file>./app/controllers/BaseController.php</file> <file>./app/controllers/BaseController.php</file>
<file>./app/controllers/MigrationController.php</file>
</exclude> </exclude>
</whitelist> </whitelist>