mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-10-31 21:33:23 -07:00
L5.3 methods (#10)
This commit is contained in:
parent
6311144581
commit
663c2b70a0
3 changed files with 86 additions and 8 deletions
10
README.md
10
README.md
|
@ -34,16 +34,16 @@ $result = $legacyUser->save();
|
|||
* destroy
|
||||
* restore
|
||||
* forceDelete
|
||||
* performDeleteOnModel
|
||||
* push
|
||||
* finishSave
|
||||
* performUpdate
|
||||
* touch
|
||||
|
||||
## TODO:
|
||||
* performDeleteOnModel
|
||||
* push
|
||||
* saveOrFail
|
||||
* finishSave
|
||||
* performUpdate
|
||||
* performInsert(??)
|
||||
* insertAndSetId(??)
|
||||
* touch
|
||||
* Add in a PR for any other methods you can find!
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ 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);
|
||||
|
@ -16,7 +15,6 @@ describe("User", function() {
|
|||
});
|
||||
});
|
||||
describe("::forceCreate()", function(){
|
||||
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->forceCreate([]))->toBe(false);
|
||||
|
@ -30,7 +28,7 @@ describe("User", function() {
|
|||
expect($user->save([]))->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("::update()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
|
@ -80,6 +78,41 @@ describe("User", function() {
|
|||
unset($user);
|
||||
});
|
||||
});
|
||||
describe("::performDeleteOnModel()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->performDeleteOnModel())->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
describe("::push()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->push())->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
describe("::finishSave()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->finishSave([]))->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
describe("::performUpdate()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->performUpdate())->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
describe("::touch()", function(){
|
||||
it("is expected to return false", function() {
|
||||
$user = new User;
|
||||
expect($user->touch())->toBe(false);
|
||||
unset($user);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -98,4 +98,49 @@ trait ReadOnlyTrait {
|
|||
public function forceDelete(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns false on performDeleteOnModel
|
||||
* @method performDeleteOnModel
|
||||
* @return false
|
||||
*/
|
||||
public function performDeleteOnModel(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns false on push
|
||||
* @method push
|
||||
* @return false
|
||||
*/
|
||||
public function push(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns false on finishSave
|
||||
* @method finishSave
|
||||
* @return false
|
||||
*/
|
||||
public function finishSave(array $options){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns false on performUpdate
|
||||
* @method performUpdate
|
||||
* @return false
|
||||
*/
|
||||
public function performUpdate(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns false on touch
|
||||
* @method touch
|
||||
* @return false
|
||||
*/
|
||||
public function touch(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue