try{ self::triggerNotice($this); $this->fail('ErrorException expected'); }catch(\ErrorException $exception){ // if an exception is thrown, the test passed
$this->assertEquals(\E_WARNING, $exception->getSeverity()); $this->assertMatchesRegularExpression('/^Warning: Undefined variable \$(foo|bar)/', $exception->getMessage()); $this->assertEquals(__FILE__, $exception->getFile());