I have tried to mock Reminder::exists() in Laravel Sentinel function.Please consider following code.
This is input array.
$adminUser = [
"id"=> 1,
"name" => "",
"email" => "sandun.d@gmail.com",
"password" => "abc123",
"token" => "1e2b5c4b47955609629214b103b3089da03163f7",
"app_user_id" => 0,
"remember_token" => null,
"status" => 1,
"created_at" => "2016-05-03 12:12:40",
"updated_at" => "2016-08-29 19:50:04",
"first_name" => "Sandunm8",
"last_name" => "Dissanayake",
"last_login" => "2016-08-29 19:50:04"
];
This is mocking Reminder facade mocking and call to exits function
$userObject = Cartalyst\Sentinel\Laravel\Facades\Sentinel::shouldReceive('findByCredentials')
->once()
->withAnyArgs(["email" => "sandun.d@eyepax.com"])
->andReturn(json_decode(json_encode($adminUser)));
$reminderObject = [
"code" => "HOVnwYnlZ54jFNuABj0CoKN7f1dUg4Bc",
"completed" => 0,
"user_id" => 32,
"updated_at" => "2016-09-08 15:01:26",
"created_at" => "2016-09-08 15:01:26",
"id" => 34
];
Cartalyst\Sentinel\Laravel\Facades\Reminder::shouldReceive('exists')
->once()
->with($userObject)
->andReturn($reminderObject);
But it is given following error.
Argument 1 passed to Mockery_5_Cartalyst_Sentinel_Reminders_IlluminateReminderRepository::exists() must implement interface Cartalyst\Sentinel\Users\UserInterface, instance of stdClass given, called in C:\xampp\htdocs\lsk\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 217 and defined
Aucun commentaire:
Enregistrer un commentaire