public function testStaticMethodCall() { \TestClass\Shape::phlexmockMethod('setValue', function ($value) { self::$value = $value; }); \TestClass\Shape::phlexmockMethod('getValue', function () { return self::$value; }); \TestClass\Shape::setValue(200); $this->assertEquals(\TestClass\Shape::getValue(), 200); }
public function testConstructorInParent() { //reopen parent class's constructor \TestClass\Shape::phlexmockMethod('__construct', function () { self::$currentClass = 'Shape'; }); \TestClass\Shape::phlexmockMethod('getCurrentClass', function () { return self::$currentClass; }); $obj = new \TestClass\Circle(); $this->assertEquals($obj->getCurrentClass(), 'Shape'); \TestClass\Shape::phlexmockMethod('getCurrentCalledClass', function () { return get_called_class(); }); $this->assertEquals($obj->getCurrentCalledClass(), 'TestClass\\Circle'); }