Example #1
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:
 */
 /**
  */
 public static function disable()
 {
     restore_exception_handler();
     Stagehand_LegacyError_PEARErrorStack::disableConversion();
     Stagehand_LegacyError_PEARError::disableConversion();
     Stagehand_LegacyError_PHPError::disableConversion();
 }
 /**
  * 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;
 }