#1191·mockery

Partial overload

Author: JesusTheHunCreated Sep 26, 2022Updated Jul 24, 2024

When creating a mock overload, making it partial does not actually make anything.

php
// given this class
class Foo {
  public function bar() {
    return "barrrrr";
  }

  public static function baz() {
    return "bazzzzz";
  }
}

// and this mock
Mockery::mock('overload:Foo')->makePartial();

// Expected
$f = new Foo();
$f->bar() // => barrrrr
$f::baz() // => bazzzzz

// Actual
// Method Foo::bar() does not exist on this mock object
// Static method Foo::baz() does not exist on this mock object

Is there a way to make this work ?