L5.3 methods (#10)

This commit is contained in:
michaelachrisco 2016-12-09 06:37:13 -08:00 committed by GitHub
parent 6311144581
commit 663c2b70a0
3 changed files with 86 additions and 8 deletions

View file

@ -34,16 +34,16 @@ $result = $legacyUser->save();
* destroy * destroy
* restore * restore
* forceDelete * forceDelete
* performDeleteOnModel
* push
* finishSave
* performUpdate
* touch
## TODO: ## TODO:
* performDeleteOnModel
* push
* saveOrFail * saveOrFail
* finishSave
* performUpdate
* performInsert(??) * performInsert(??)
* insertAndSetId(??) * insertAndSetId(??)
* touch
* Add in a PR for any other methods you can find! * Add in a PR for any other methods you can find!

View file

@ -8,7 +8,6 @@ class User extends Illuminate\Database\Eloquent\Model {
describe("User", function() { describe("User", function() {
describe("::create()", function(){ describe("::create()", function(){
it("is expected to return false", function() { it("is expected to return false", function() {
$user = new User; $user = new User;
expect($user->create([]))->toBe(false); expect($user->create([]))->toBe(false);
@ -16,7 +15,6 @@ describe("User", function() {
}); });
}); });
describe("::forceCreate()", function(){ describe("::forceCreate()", function(){
it("is expected to return false", function() { it("is expected to return false", function() {
$user = new User; $user = new User;
expect($user->forceCreate([]))->toBe(false); expect($user->forceCreate([]))->toBe(false);
@ -30,7 +28,7 @@ describe("User", function() {
expect($user->save([]))->toBe(false); expect($user->save([]))->toBe(false);
unset($user); unset($user);
}); });
}); });
describe("::update()", function(){ describe("::update()", function(){
it("is expected to return false", function() { it("is expected to return false", function() {
$user = new User; $user = new User;
@ -80,6 +78,41 @@ describe("User", function() {
unset($user); 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);
});
});
}); });

View file

@ -98,4 +98,49 @@ trait ReadOnlyTrait {
public function forceDelete(){ public function forceDelete(){
return false; 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;
}
} }