mockery: An interface specifying the magic __clone method cannot be mocked

interface X {
    public function __clone();
}

Mockery::mock(X::class);

Fatal error: Class Mockery_1_X contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (X::__clone) in Mockery\Loader\EvalLoader.php(16) : eval()'d code on line 25

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

At least you are consistent, even if that means being consistently wrong. May have something to do with why the library is dead. I suppose it is time for me to move on, too.

No, I’m not going to reopen the ticket.

I’ve provided you with a workaround, that is 4 lines of code, that you will have to use this once. I could probably write four lines of code to hack this in to Mockery itself, but then I would have to maintain for as long as I help out here, when it’s not really any use to anyone except you right now this minute.