Test data no longer runs into the future.

This commit is contained in:
James Cole 2015-07-19 09:37:52 +02:00
parent cdeb1ad87c
commit c0ea19e15e

View File

@ -596,6 +596,7 @@ class TestDataSeeder extends Seeder
{ {
$start = clone $date; $start = clone $date;
$end = clone $date; $end = clone $date;
$today = new Carbon;
$start->startOfMonth(); $start->startOfMonth();
$end->endOfMonth(); $end->endOfMonth();
@ -605,7 +606,7 @@ class TestDataSeeder extends Seeder
$budget = Budget::firstOrCreateEncrypted(['name' => 'Groceries', 'user_id' => $this->user->id]); $budget = Budget::firstOrCreateEncrypted(['name' => 'Groceries', 'user_id' => $this->user->id]);
$current = clone $start; $current = clone $start;
while ($current < $end) { while ($current < $end && $current < $today) {
// daily groceries: // daily groceries:
$amount = rand(1000, 2500) / 100; $amount = rand(1000, 2500) / 100;
$toAccount = $this->findAccount($stores[rand(0, count($stores) - 1)]); $toAccount = $this->findAccount($stores[rand(0, count($stores) - 1)]);
@ -651,10 +652,11 @@ class TestDataSeeder extends Seeder
{ {
$start = clone $date; $start = clone $date;
$end = clone $date; $end = clone $date;
$today = new Carbon;
$start->startOfMonth(); $start->startOfMonth();
$end->endOfMonth(); $end->endOfMonth();
$current = clone $start; $current = clone $start;
while ($current < $end) { while ($current < $end && $current < $today) {
// weekly drink: // weekly drink:
$thisDate = clone $current; $thisDate = clone $current;