Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Merge [3398] and [3399].

  • Loading branch information...
commit 47a883389ada9a5992e271f2801c2ebf9249302b 1 parent ab2eb21
@sebastianbergmann authored
View
3  PHPUnit/Framework.php
@@ -52,7 +52,8 @@
require 'PHPUnit/Framework/AssertionFailedError.php';
require 'PHPUnit/Framework/Assert.php';
require 'PHPUnit/Framework/Error.php';
-require 'PHPUnit/Framework/Notice.php';
+require 'PHPUnit/Framework/Error/Notice.php';
+require 'PHPUnit/Framework/Error/Warning.php';
require 'PHPUnit/Framework/IncompleteTest.php';
require 'PHPUnit/Framework/SkippedTest.php';
require 'PHPUnit/Framework/Test.php';
View
10 PHPUnit/Framework/Notice.php → PHPUnit/Framework/Error/Notice.php
@@ -41,21 +41,21 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version SVN: $Id$
* @link http://www.phpunit.de/
- * @since File available since Release 3.1.0
+ * @since File available since Release 3.3.0
*/
require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
-if (!class_exists('PHPUnit_Framework_Notice', FALSE)) {
+if (!class_exists('PHPUnit_Framework_Error_Notice', FALSE)) {
/**
* Wrapper for PHP notices.
* You can disable notice-to-exception conversion by setting
*
* <code>
- * PHPUnit_Framework_Notice::$enabled = FALSE;
+ * PHPUnit_Framework_Error_Notice::$enabled = FALSE;
* </code>
*
* @category Testing
@@ -65,9 +65,9 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: @package_version@
* @link http://www.phpunit.de/
- * @since Class available since Release 3.1.0
+ * @since Class available since Release 3.3.0
*/
-class PHPUnit_Framework_Notice extends PHPUnit_Framework_Error
+class PHPUnit_Framework_Error_Notice extends PHPUnit_Framework_Error
{
public static $enabled = TRUE;
}
View
76 PHPUnit/Framework/Error/Warning.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * PHPUnit
+ *
+ * Copyright (c) 2002-2008, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version SVN: $Id$
+ * @link http://www.phpunit.de/
+ * @since File available since Release 3.3.0
+ */
+
+require_once 'PHPUnit/Util/Filter.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
+
+if (!class_exists('PHPUnit_Framework_Error_Warning', FALSE)) {
+
+/**
+ * Wrapper for PHP warnings.
+ * You can disable notice-to-exception conversion by setting
+ *
+ * <code>
+ * PHPUnit_Framework_Error_Warning::$enabled = FALSE;
+ * </code>
+ *
+ * @category Testing
+ * @package PHPUnit
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2008 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://www.phpunit.de/
+ * @since Class available since Release 3.3.0
+ */
+class PHPUnit_Framework_Error_Warning extends PHPUnit_Framework_Error
+{
+ public static $enabled = TRUE;
+}
+
+}
+?>
View
39 PHPUnit/TextUI/TestRunner.php
@@ -174,7 +174,11 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
}
if (!$arguments['convertNoticesToExceptions']) {
- PHPUnit_Framework_Notice::$enabled = FALSE;
+ PHPUnit_Framework_Error_Notice::$enabled = FALSE;
+ }
+
+ if (!$arguments['convertWarningsToExceptions']) {
+ PHPUnit_Framework_Error_Warning::$enabled = FALSE;
}
if ($arguments['stopOnFailure']) {
@@ -636,6 +640,10 @@ protected function handleConfiguration(array &$arguments)
$arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
}
+ if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) {
+ $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
+ }
+
if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) {
$arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
}
@@ -752,20 +760,21 @@ protected function handleConfiguration(array &$arguments)
}
}
- $arguments['cpdMinLines'] = isset($arguments['cpdMinLines']) ? $arguments['cpdMinLines'] : 5;
- $arguments['cpdMinMatches'] = isset($arguments['cpdMinMatches']) ? $arguments['cpdMinMatches'] : 70;
- $arguments['ansi'] = isset($arguments['ansi']) ? $arguments['ansi'] : FALSE;
- $arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
- $arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
- $arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
- $arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
- $arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
- $arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'ISO-8859-1';
- $arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
- $arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
- $arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
- $arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
- $arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
+ $arguments['cpdMinLines'] = isset($arguments['cpdMinLines']) ? $arguments['cpdMinLines'] : 5;
+ $arguments['cpdMinMatches'] = isset($arguments['cpdMinMatches']) ? $arguments['cpdMinMatches'] : 70;
+ $arguments['ansi'] = isset($arguments['ansi']) ? $arguments['ansi'] : FALSE;
+ $arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
+ $arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
+ $arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
+ $arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
+ $arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
+ $arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
+ $arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'ISO-8859-1';
+ $arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
+ $arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
+ $arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
+ $arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
+ $arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
}
}
?>
View
9 PHPUnit/Util/Configuration.php
@@ -57,7 +57,7 @@
* <code>
* <?xml version="1.0" encoding="utf-8" ?>
*
- * <phpunit ansi="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" stopOnFailure="false">
+ * <phpunit ansi="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false">
* <testsuite name="My Test Suite">
* <directory suffix="Test.php">/path/to/files</directory>
* <file>/path/to/MyTest.php</file>
@@ -411,6 +411,13 @@ public function getPHPUnitConfiguration()
);
}
+ if ($this->document->documentElement->hasAttribute('convertWarningsToExceptions')) {
+ $result['convertWarningsToExceptions'] = $this->getBoolean(
+ (string)$this->document->documentElement->getAttribute('convertWarningsToExceptions'),
+ TRUE
+ );
+ }
+
if ($this->document->documentElement->hasAttribute('stopOnFailure')) {
$result['stopOnFailure'] = $this->getBoolean(
(string)$this->document->documentElement->getAttribute('stopOnFailure'),
View
16 PHPUnit/Util/ErrorHandler.php
@@ -100,12 +100,22 @@ public static function handleError($errno, $errstr, $errfile, $errline)
}
if ($errno == E_NOTICE || $errno == E_STRICT) {
- if (PHPUnit_Framework_Notice::$enabled !== TRUE) {
+ if (PHPUnit_Framework_Error_Notice::$enabled !== TRUE) {
return FALSE;
}
- $exception = 'PHPUnit_Framework_Notice';
- } else {
+ $exception = 'PHPUnit_Framework_Error_Notice';
+ }
+
+ else if ($errno == E_WARNING) {
+ if (PHPUnit_Framework_Error_Warning::$enabled !== TRUE) {
+ return FALSE;
+ }
+
+ $exception = 'PHPUnit_Framework_Error_Warning';
+ }
+
+ else {
$exception = 'PHPUnit_Framework_Error';
}
View
11 package.xml
@@ -383,6 +383,14 @@
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
</dir>
+ <dir name="Error">
+ <file baseinstalldir="/" name="Notice.php" role="php">
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
+ <file baseinstalldir="/" name="Warning.php" role="php">
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
+ </dir>
<dir name="MockObject">
<dir name="Builder">
<file baseinstalldir="/" name="Identity.php" role="php">
@@ -508,9 +516,6 @@
<file baseinstalldir="/" name="IncompleteTest.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
- <file baseinstalldir="/" name="Notice.php" role="php">
- <tasks:replace from="@package_version@" to="version" type="package-info" />
- </file>
<file baseinstalldir="/" name="SelfDescribing.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
Please sign in to comment.
Something went wrong with that request. Please try again.