Ejemplo n.º 1
0
 /**
  * Asserts the specified data about an exception
  * 
  * If an exception was found and you were not expecting one
  * ( $exceptionType must equal null ) then it
  * will throw that exception
  * 
  * @param string $expectedType
  * @param Exception $actualException
  * @param string $expectedMessagePattern
  */
 protected function assertException($expectedType, Exception $actualException = null, $expectedMessagePatterns = null)
 {
     if (!PHPToolsTestUtil::exceptionMatches($actualException, $expectedType)) {
         if ($actualException) {
             throw $actualException;
         }
         $this->fail('Expected ' . $expectedType . ' and did not get an Exception');
     }
     if (!PHPToolsTestUtil::exceptionMatches($actualException, $expectedType, $expectedMessagePatterns)) {
         $this->fail('Exception message "' . $actualException->getMessage() . '" did not match any supplied pattern');
     }
 }