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 */ 14class PHPUnit_Framework_WarningTestCase extends PHPUnit_Framework_TestCase 15{ 16 /** 17 * @var string 18 */ 19 protected $message = ''; 20 21 /** 22 * @var bool 23 */ 24 protected $backupGlobals = false; 25 26 /** 27 * @var bool 28 */ 29 protected $backupStaticAttributes = false; 30 31 /** 32 * @var bool 33 */ 34 protected $runTestInSeparateProcess = false; 35 36 /** 37 * @var bool 38 */ 39 protected $useErrorHandler = false; 40 41 /** 42 * @param string $message 43 */ 44 public function __construct($message = '') 45 { 46 $this->message = $message; 47 parent::__construct('Warning'); 48 } 49 50 /** 51 * @throws PHPUnit_Framework_Exception 52 */ 53 protected function runTest() 54 { 55 throw new PHPUnit_Framework_Warning($this->message); 56 } 57 58 /** 59 * @return string 60 */ 61 public function getMessage() 62 { 63 return $this->message; 64 } 65 66 /** 67 * Returns a string representation of the test case. 68 * 69 * @return string 70 */ 71 public function toString() 72 { 73 return 'Warning'; 74 } 75} 76