/** * @requires PHP 7.0 * @expectedException \Error * @expectedExceptionMessageRegExp /Call to undefined method/ */ public function testNonExistingMethodCall() { $this->expectOutputRegex('/Call to undefined method/'); $obj = new SimpleClass(); $obj->nonExistingMethod(); }