From 3e6729614c8069ad6988084efa2825e5d46e419d Mon Sep 17 00:00:00 2001 From: Adam Engebretson Date: Tue, 1 Dec 2015 03:52:30 -0600 Subject: [PATCH] Fixing Tests Signed-off-by: Adam Engebretson --- tests/FormAccessibleTest.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/FormAccessibleTest.php b/tests/FormAccessibleTest.php index 5fa9ce9..52a8e5e 100644 --- a/tests/FormAccessibleTest.php +++ b/tests/FormAccessibleTest.php @@ -20,11 +20,13 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase Capsule::table('models')->truncate(); Model::unguard(); + $this->now = Carbon::now(); + $this->modelData = [ 'string' => 'abcdefghijklmnop', 'email' => 'tj@tjshafer.com', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), + 'created_at' => $this->now, + 'updated_at' => $this->now, ]; $this->urlGenerator = new UrlGenerator(new RouteCollection(), Request::create('/foo', 'GET')); @@ -39,7 +41,7 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase $this->formBuilder->setModel($model); $this->assertEquals($model->getFormValue('string'), 'ponmlkjihgfedcba'); - $this->assertEquals($model->getFormValue('created_at'), time()); + $this->assertEquals($model->getFormValue('created_at'), $this->now->timestamp); } public function testItCanStillMutateValuesForViews() @@ -48,7 +50,7 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase $this->formBuilder->setModel($model); $this->assertEquals($model->string, 'ABCDEFGHIJKLMNOP'); - $this->assertEquals($model->created_at, Carbon::now()->diffForHumans()); + $this->assertEquals($model->created_at, '1 second ago'); } public function testItDoesntRequireTheUseOfThisFeature() @@ -57,7 +59,7 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase $this->formBuilder->setModel($model); $this->assertEquals($model->string, 'ABCDEFGHIJKLMNOP'); - $this->assertEquals($model->created_at, Carbon::now()->diffForHumans()); + $this->assertEquals($model->created_at, '1 second ago'); } }