i have a class that is binded in service provider
this class uses my facade which extends the laravel's facade,but
when i try to mock the class it say's
Cannot redeclare Mockery_1_App_Classes_Dashboard_class::shouldReceive()
.
my test method:
public function test_method()
{
class::shouldReceive('method')->once()->andReturns(true);
$response = $this->another_class->method();
dd($response);
}
my facade :
<?php
namespace App\Facades\Dashboard;
use Illuminate\Support\Facades\Facade;
class class extends Facade
{
protected static function getFacadeAccessor()
{
return 'class';
}
}
AppServiceProvider :
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use App\Classes\Dashboard\class;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind('class', function($app) {
return new class;
});
}
public function boot()
{
Schema::defaultStringLength(191);
}
}
i searched the web, unfortunately haven't find anything.
finally found the problem.
i was accidentally extending laravel's facade in my class inheritance.