Warning.php (1473B)
1 <?php 2 /* 3 * This file is part of PHPUnit. 4 * 5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 /** 12 * A warning. 13 * 14 * @since Class available since Release 2.0.0 15 */ 16 class PHPUnit_Framework_Warning extends PHPUnit_Framework_TestCase 17 { 18 /** 19 * @var string 20 */ 21 protected $message = ''; 22 23 /** 24 * @var bool 25 */ 26 protected $backupGlobals = false; 27 28 /** 29 * @var bool 30 */ 31 protected $backupStaticAttributes = false; 32 33 /** 34 * @var bool 35 */ 36 protected $runTestInSeparateProcess = false; 37 38 /** 39 * @var bool 40 */ 41 protected $useErrorHandler = false; 42 43 /** 44 * @param string $message 45 */ 46 public function __construct($message = '') 47 { 48 $this->message = $message; 49 parent::__construct('Warning'); 50 } 51 52 /** 53 * @throws PHPUnit_Framework_Exception 54 */ 55 protected function runTest() 56 { 57 $this->fail($this->message); 58 } 59 60 /** 61 * @return string 62 * 63 * @since Method available since Release 3.0.0 64 */ 65 public function getMessage() 66 { 67 return $this->message; 68 } 69 70 /** 71 * Returns a string representation of the test case. 72 * 73 * @return string 74 * 75 * @since Method available since Release 3.4.0 76 */ 77 public function toString() 78 { 79 return 'Warning'; 80 } 81 }