Why I am unable to mock a php static function that is used in factory patern?

Dimitrios Desyllas - Mar 23 '20 - - Dev Community

Hello May I have some help on that?

I have the following class:


public function MyClass
{
  public static foo():string
  {
    // Some logic there
    // This is a dummy value just for explaining the problem
    return 'n123';
  }

  public static factory():MyClass
  {
    return new MyClass();
  }
}

Also I have the following class as well:


class MyClassConsumer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player