/**
  * @test
  */
 public function notCauseAStrictStandardsErrorToBeRaised()
 {
     error_reporting(E_ALL);
     Stagehand_LegacyError_PHPError::enableConversion(E_STRICT);
     try {
         class_exists('Stagehand_LegacyError_PEARErrorStack');
     } catch (Stagehand_LegacyError_PHPError_Exception $e) {
         Stagehand_LegacyError_PHPError::disableConversion();
         $this->fail($e->getMessage());
     }
     Stagehand_LegacyError_PHPError::disableConversion();
 }
Пример #2
0
 protected function setUp()
 {
     Stagehand_LegacyError_PHPError::enableConversion(error_reporting());
     $this->tmpDirectory = dirname(__FILE__) . '/../../../tmp';
     $this->config = new Stagehand_TestRunner_Config();
     $this->config->framework = $this->framework;
     $this->config->logsResultsInJUnitXML = true;
     $this->config->junitXMLFile = $this->tmpDirectory . '/' . get_class($this) . '.' . $this->getName(false) . '.xml';
     $this->configure($this->config);
     $preparatorFactory = new Stagehand_TestRunner_Preparator_PreparatorFactory($this->config);
     $this->preparator = $preparatorFactory->create();
     $this->preparator->prepare();
     $collectorFactory = new Stagehand_TestRunner_Collector_CollectorFactory($this->config);
     $this->collector = $collectorFactory->create();
     $this->loadClasses();
 }
 /**
  */
 public static function disable()
 {
     restore_exception_handler();
     Stagehand_LegacyError_PEARErrorStack::disableConversion();
     Stagehand_LegacyError_PEARError::disableConversion();
     Stagehand_LegacyError_PHPError::disableConversion();
 }
Пример #4
0
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    Release: @package_version@
 * @since      File available since Release 2.10.0
 */
error_reporting(E_ALL);
if (defined('E_DEPRECATED')) {
    error_reporting(error_reporting() & ~E_DEPRECATED);
}
set_include_path(realpath(dirname(__FILE__)) . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../examples') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../vendor') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../src') . PATH_SEPARATOR . get_include_path());
@(require_once 'PHPUnit/Framework.php');
// TODO Remove this if Stagehand_TestRunner will not support PHPUnit 3.4.
require_once 'Stagehand/Autoload.php';
$legacyLoader = Stagehand_Autoload::legacyLoader();
$legacyLoader->addNamespace('Stagehand');
Stagehand_Autoload::register($legacyLoader);
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
    $namespaceLoader = Stagehand_Autoload::namespaceLoader();
    $namespaceLoader->addNamespace('Stagehand\\TestRunner');
    Stagehand_Autoload::register($namespaceLoader);
}
Stagehand_LegacyError_PHPError::enableConversion(error_reporting());
/*
 * Local Variables:
 * mode: php
 * coding: iso-8859-1
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * indent-tabs-mode: nil
 * End:
 */
 /**
  * Scans the directory and invoke the callback.
  *
  * @param string $directory
  * @throws Stagehand_DirectoryScanner_Exception
  */
 public function scan($directory)
 {
     Stagehand_LegacyError_PHPError::enableConversion(E_WARNING);
     try {
         $files = scandir($directory);
     } catch (Stagehand_LegacyError_PHPError $e) {
         Stagehand_LegacyError_PHPError::disableConversion();
         throw new Stagehand_DirectoryScanner_Exception($e->getMessage());
     }
     Stagehand_LegacyError_PHPError::disableConversion();
     if ($files === false) {
         throw new Stagehand_DirectoryScanner_Exception('Failed to scan the directory [ ' . $directory . ' ], possible reasons are the directory is not found or not readable');
     }
     for ($i = 0, $count = count($files); $i < $count; ++$i) {
         if ($this->denyAllow->evaluate($files[$i]) == Stagehand_AccessControl_AccessState::DENY) {
             continue;
         }
         $absoluteFilePath = $directory . DIRECTORY_SEPARATOR . $files[$i];
         call_user_func($this->callback, $absoluteFilePath);
         if (is_dir($absoluteFilePath) && $this->recursivelyScans) {
             $this->scan($absoluteFilePath);
         }
     }
 }
Пример #6
0
 * 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.
 *
 * @package    Piece_Unity
 * @copyright  2007-2009 KUBO Atsuhiro <*****@*****.**>
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    Release: @package_version@
 * @since      File available since Release 1.0.0
 */
error_reporting(E_ALL);
set_include_path(realpath(dirname(__FILE__)) . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../src') . PATH_SEPARATOR . get_include_path());
require_once 'PHPUnit/Framework.php';
require_once 'Stagehand/Autoload.php';
$loader = Stagehand_Autoload::legacyLoader();
$loader->addNamespace('Stagehand');
$loader->addNamespace('Piece');
Stagehand_Autoload::register($loader);
Stagehand_LegacyError_PHPError::enableConversion();
Stagehand_LegacyError_PEARError::enableConversion();
Stagehand_LegacyError_PEARErrorStack::enableConversion();
/*
 * Local Variables:
 * mode: php
 * coding: iso-8859-1
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * indent-tabs-mode: nil
 * End:
 */
Пример #7
0
 /**
  */
 public static function disableConversion()
 {
     $oldErrorReportingLevel = error_reporting(error_reporting() & ~E_STRICT);
     Stagehand_LegacyError_PHPError::enableConversion(error_reporting());
     PEAR::staticPopErrorHandling();
     Stagehand_LegacyError_PHPError::disableConversion();
     error_reporting($oldErrorReportingLevel);
 }
 /**
  * Parses the command line options.
  *
  * @return array
  */
 protected function parseOptions()
 {
     Stagehand_LegacyError_PEARError::enableConversion();
     $oldErrorReportingLevel = error_reporting(error_reporting() & ~E_STRICT & ~E_NOTICE);
     Stagehand_LegacyError_PHPError::enableConversion(error_reporting());
     try {
         $argv = Console_Getopt::readPHPArgv();
         array_shift($argv);
         $parsedOptions = Console_Getopt::getopt2($argv, $this->shortOptions, $this->longOptions);
     } catch (Stagehand_LegacyError_PEARError_Exception $e) {
         Stagehand_LegacyError_PHPError::disableConversion();
         error_reporting($oldErrorReportingLevel);
         Stagehand_LegacyError_PEARError::disableConversion();
         throw new $this->exceptionClass(preg_replace('/^Console_Getopt: /', '', $e->getMessage()));
     } catch (Exception $e) {
         Stagehand_LegacyError_PHPError::disableConversion();
         error_reporting($oldErrorReportingLevel);
         Stagehand_LegacyError_PEARError::disableConversion();
         throw $e;
     }
     Stagehand_LegacyError_PHPError::disableConversion();
     error_reporting($oldErrorReportingLevel);
     Stagehand_LegacyError_PEARError::disableConversion();
     return $parsedOptions;
 }
Пример #9
0
 /**
  * @test
  */
 public function notRaiseAnExceptionWhenAnUnrelatedErrorIsRaised()
 {
     Stagehand_LegacyError_PHPError::enableConversion(E_ALL);
     error_reporting(E_ALL & ~E_USER_WARNING);
     try {
         trigger_error('An expected exception has not been raised', E_USER_ERROR);
         $this->fail($e->getMessage());
         Stagehand_LegacyError_PHPError::disableConversion();
     } catch (Stagehand_LegacyError_PHPError_Exception $e) {
     }
     try {
         trigger_error('An unexpected exception has been raised', E_USER_WARNING);
     } catch (Stagehand_LegacyError_PHPError_Exception $e) {
         Stagehand_LegacyError_PHPError::disableConversion();
         $this->fail($e->getMessage());
     }
     Stagehand_LegacyError_PHPError::disableConversion();
 }