public function testExtend() { $returnValue = uniqid('return'); $this->testInstance->extend('methodTesting', function () use($returnValue) { return $returnValue; }, true); $this->assertSame($returnValue, $this->testInstance->methodTesting()); try { $this->testInstance->nonExistantMethod(); } catch (\Exception $e) { $this->assertTrue($e instanceof \BadMethodCallException); } }
public function __call($method, array $arguments = []) { $delegate = $this->getDelegate(); if (is_callable([$delegate, $method])) { return call_user_func_array([$delegate, $method], $arguments); } return parent::__call($method, $arguments); }