示例#1
0
 public function testAutoload()
 {
     $auto = \r8\Autoload::getInstance();
     $this->assertThat($auto, $this->isInstanceOf('\\r8\\Autoload'));
     $this->assertSame($auto, \r8\Autoload::getInstance());
     $this->assertSame($auto, \r8\Autoload::getInstance());
     $this->assertSame($auto, \r8\Autoload::getInstance());
 }
示例#2
0
/**
 * Sets up the phpVocab environment
 *
 * @license Artistic License 2.0
 *
 * This file is part of phpVocab.
 *
 * phpVocab is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License as published by
 * the Open Source Initiative, either version 2.0 of the License, or
 * (at your option) any later version.
 *
 * phpVocab is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Artistic License for more details.
 *
 * You should have received a copy of the Artistic License
 * along with phpVocab. If not, see <http://www.phpVocab.com/license.php>
 * or <http://www.opensource.org/licenses/artistic-license-2.0.php>.
 *
 * @author James Frasca <*****@*****.**>
 * @copyright Copyright 2009, James Frasca, All Rights Reserved
 */
define("VOCAB_VERSION", '0.1.0dev');
define("VOCAB_DIR", rtrim(__DIR__, "/"));
// Round Eights for your library needs
require_once VOCAB_DIR . '/../lib/RoundEights.phar';
// Set up the autoload structure for vocab specific classes
\r8\Autoload::getInstance()->register('vc', VOCAB_DIR . '/classes')->register('vc\\iface', VOCAB_DIR . '/ifaces');
示例#3
0
文件: setup.php 项目: Nycto/phpVocab
 * @license Artistic License 2.0
 *
 * This file is part of phpVocab.
 *
 * phpVocab is free software: you can redistribute it and/or modify
 * it under the terms of the Artistic License as published by
 * the Open Source Initiative, either version 2.0 of the License, or
 * (at your option) any later version.
 *
 * phpVocab is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Artistic License for more details.
 *
 * You should have received a copy of the Artistic License
 * along with phpVocab. If not, see <http://www.phpVocab.com/license.php>
 * or <http://www.opensource.org/licenses/artistic-license-2.0.php>.
 *
 * @author James Frasca <*****@*****.**>
 * @copyright Copyright 2009, James Frasca, All Rights Reserved
 */
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Extensions/OutputTestCase.php';
define("r8_SUPPRESS_HANDLERS", TRUE);
define("vocab_TEST_DATA", __DIR__ . '/Data');
require_once rtrim(__DIR__, "/") . "/../src/include.php";
// Set up the autoload structure for vocab specific classes
\r8\Autoload::getInstance()->register('vc\\Test', rtrim(__DIR__, "/") . '/Test');
error_reporting(E_ALL | E_STRICT);
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
PHPUnit_Util_Filter::addDirectoryToFilter(rtrim(__DIR__, "/") . '/Test');
示例#4
0
 * An identity method that simply returns the input argument
 *
 * This helper method exists to aid with inline instantiation.
 *
 * @param Object $object The input object
 * @return Object Returns the input object
 */
function r8($object)
{
    return $object;
}
/**
 * Register the autoloader
 */
\r8\Autoload::getInstance()->register('r8', r8_DIR_CLASSES)->register('r8\\iface', r8_DIR_INTERFACES)->register('r8\\Test', r8_DIR_TEST);
spl_autoload_register(array(\r8\Autoload::getInstance(), "load"));
/**
 * Take a snapshot of the environment
 */
\r8\Env::Request();
/**
 * Set up error handling, but only if it isn't being suppressed by the including code
 */
if (!defined("r8_SUPPRESS_HANDLERS")) {
    // Register the error handler
    set_error_handler(function ($code, $message, $file, $line) {
        $level = (int) ini_get('error_reporting');
        $code = (int) $code;
        if (!($code & $level)) {
            return TRUE;
        }