function testNonExistingMethod() { try { /** @noinspection PhpUndefinedMethodInspection */ Mockster::stub($this->foo->nonExisting()); $this->fail("Should have thrown an exception"); } catch (\ReflectionException $e) { $this->assert->contains($e->getMessage(), "does not exist"); } }