comparison vendor/psy/psysh/test/Exception/ErrorExceptionTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
74 /** 74 /**
75 * @dataProvider getUserLevels 75 * @dataProvider getUserLevels
76 */ 76 */
77 public function testThrowExceptionAsErrorHandler($level, $type) 77 public function testThrowExceptionAsErrorHandler($level, $type)
78 { 78 {
79 set_error_handler(['Psy\Exception\ErrorException', 'throwException']); 79 \set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
80 try { 80 try {
81 trigger_error('{whot}', $level); 81 \trigger_error('{whot}', $level);
82 } catch (ErrorException $e) { 82 } catch (ErrorException $e) {
83 $this->assertContains('PHP ' . $type, $e->getMessage()); 83 $this->assertContains('PHP ' . $type, $e->getMessage());
84 $this->assertContains('{whot}', $e->getMessage()); 84 $this->assertContains('{whot}', $e->getMessage());
85 } 85 }
86 restore_error_handler(); 86 \restore_error_handler();
87 } 87 }
88 88
89 public function getUserLevels() 89 public function getUserLevels()
90 { 90 {
91 return [ 91 return [
108 $this->assertNotEmpty($e->getFile()); 108 $this->assertNotEmpty($e->getFile());
109 } 109 }
110 110
111 public function testFromError() 111 public function testFromError()
112 { 112 {
113 if (version_compare(PHP_VERSION, '7.0.0', '<')) { 113 if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
114 $this->markTestSkipped(); 114 $this->markTestSkipped();
115 } 115 }
116 116
117 $error = new \Error('{{message}}', 0); 117 $error = new \Error('{{message}}', 0);
118 $exception = ErrorException::fromError($error); 118 $exception = ErrorException::fromError($error);