From 1c6b5e2cc53ecbf908cce104fa149780474f0e0f Mon Sep 17 00:00:00 2001 From: Michael Chrisco Date: Thu, 6 Oct 2016 13:22:17 -0700 Subject: [PATCH] Add PHPDocs and create/forceCreate methods --- composer.json | 2 +- spec/ReadOnlyTraitSpec.php | 23 +++++++++---- src/ReadOnlyTrait.php | 70 +++++++++++++++++++++++++++++++++++--- 3 files changed, 83 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 9df4a86..9b74f43 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php": ">=5.5.9" }, "require-dev": { - "crysalead/kahlan": "^2.4", + "kahlan/kahlan": "^2.4", "illuminate/database": ">=5.2.0" } } diff --git a/spec/ReadOnlyTraitSpec.php b/spec/ReadOnlyTraitSpec.php index c6a13cb..3af4774 100644 --- a/spec/ReadOnlyTraitSpec.php +++ b/spec/ReadOnlyTraitSpec.php @@ -7,6 +7,22 @@ class User extends Illuminate\Database\Eloquent\Model { } describe("User", function() { + describe("::create()", function(){ + + it("is expected to return false", function() { + $user = new User; + expect($user->create([]))->toBe(false); + unset($user); + }); + }); + describe("::forceCreate()", function(){ + + it("is expected to return false", function() { + $user = new User; + expect($user->forceCreate([]))->toBe(false); + unset($user); + }); +}); describe("::save()", function(){ it("is expected to return false", function() { @@ -64,13 +80,6 @@ describe("User", function() { unset($user); }); }); - describe("::test()", function(){ - it("is expected to return false", function() { - $user = new User; - expect($user->test())->toBe(false); - unset($user); - }); - }); }); diff --git a/src/ReadOnlyTrait.php b/src/ReadOnlyTrait.php index 6c5b719..e215329 100644 --- a/src/ReadOnlyTrait.php +++ b/src/ReadOnlyTrait.php @@ -1,39 +1,101 @@