Why Mockerty is unable to make an alias of my model

Dimitrios Desyllas - May 15 '20 - - Dev Community

Hello how I can mock a static method of an Eloquent Model?
I tried the following without any hope.

I have the following model:

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    public static function foo():bool
    {
      return true;
    }
}

And for that I made the following controller:


namespace App\Controler;

use App\Model\Foo;

class MyController
{
   public function bar()
   {
      $value=MyModel::foo();
      if($value){
        return "OK"; 
      }
      throw new \Exception("Foo

Any ideas?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player