Beispiel #1
0
 public static function register()
 {
     /**
      * Register ModSync namespace
      */
     $autoLoader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
     $autoLoader->registerNamespace('ModSync', Base::getCoreComponentsDir() . DIRECTORY_SEPARATOR . __NAMESPACE__);
     $autoLoader->register();
     /**
      * Register all other namespaces
      */
     $components = new DirectoryIterator(Base::getCoreComponentsDir());
     foreach ($components as $component) {
         if ($component->isDot()) {
             continue;
         }
         if ($component->getFilename() == 'ModSync') {
             continue;
         }
         $componentFile = new SplFileInfo($component->getPathname() . DIRECTORY_SEPARATOR . 'Component' . DIRECTORY_SEPARATOR . 'Component.php');
         if ($componentFile->isFile()) {
             $autoLoader->registerNamespace($component->getFilename(), $component->getPathname());
         }
     }
 }
Beispiel #2
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(dirname(__DIR__)));
$loader = null;
if (file_exists('vendor/autoload.php')) {
    $loader = (include 'vendor/autoload.php');
} else {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('DmMailerTest', __DIR__ . '/DmMailerTest');
$loader->register();
 public function testAutoloadsNamespacedClassesWithUnderscores()
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace('ZendTest\\UnusualNamespace', __DIR__ . '/TestAsset');
     $loader->autoload('ZendTest\\UnusualNamespace\\Name_Space\\Namespaced_Class');
     $this->assertTrue(class_exists('ZendTest\\UnusualNamespace\\Name_Space\\Namespaced_Class', false));
 }
Beispiel #4
0
<?php

use Zend\Loader\StandardAutoloader;
if (!@(include_once __DIR__ . '/../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('Aubiplus\\Seo', __DIR__ . '/../src/Seo');
$loader->registerNamespace('Aubiplus\\SeoTest', __DIR__ . '/SeoTest');
$loader->register();
Beispiel #5
0
 /**
  * Setup autoloader. Phrozn uses Zend Framework 2 autoloader.
  *
  * @return void
  */
 private function __construct()
 {
     if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) {
         $base = dirname(__FILE__) . '/';
         set_include_path($base . PATH_SEPARATOR . get_include_path());
     } else {
         $base = '@PEAR-DIR@/Phrozn/';
     }
     require_once $base . 'Vendor/Zend/Loader/StandardAutoloader.php';
     $loader = new Loader();
     $loader->registerNamespace('Zend', $base . 'Vendor/Zend')->registerNamespace('Phrozn', $base)->registerNamespace('Symfony', $base . 'Vendor/Symfony')->registerNamespace('Twig', $base . 'Vendor/Twig')->setFallbackAutoloader(true)->register();
     // allow to use plugins from project's .phrozn/plugins
     $plugins = getcwd();
     if (strpos($plugins, '.phrozn') === false) {
         $plugins .= '/.phrozn';
     }
     $plugins .= '/plugins/';
     if (is_dir($plugins)) {
         $loader->registerNamespace('PhroznPlugin', $plugins);
     }
     $this->loader = $loader;
 }
Beispiel #6
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(dirname(__DIR__)));
$loader = null;
if (file_exists('vendor/autoload.php')) {
    $loader = (include 'vendor/autoload.php');
} else {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
// Config
$appConfig = (include __DIR__ . '/config/test.config.php');
// Init the framework
Zend\Mvc\Application::init($appConfig);
$loader = new StandardAutoloader();
$loader->registerNamespace('DmMailerTest', __DIR__ . '/../library/DmMailerTest');
$loader->registerNamespace('TestUtil', __DIR__ . '/TestUtil');
$loader->registerNamespace('TestFixture', __DIR__ . '/TestFixture');
$loader->register();
TestUtil\ServiceManagerFactory::setApplicationConfig($appConfig);
Beispiel #7
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(__DIR__));
include 'init_autoloader.php';
$loader = new StandardAutoloader();
$loader->registerNamespace('ZfDealsTest', __DIR__ . '/ZfDealsTest');
$loader->register();
Zend\Mvc\Application::init(include 'config/application.config.php');
Beispiel #8
0
<?php

// Set used namespaces
use Zend\Loader\StandardAutoloader;
use Zend\Locale\Locale;
use Zend\Service\LiveDocx\Helper;
// Turn up error reporting
error_reporting(E_ALL | E_STRICT);
// Library base
$base = dirname(dirname(dirname(dirname(__DIR__))));
// Set up autoloader
require_once "{$base}/library/Zend/Loader/StandardAutoloader.php";
$loader = new StandardAutoloader();
$loader->registerNamespace('Zend', "{$base}/library/Zend");
$loader->register();
// Include utility class
require_once "{$base}/demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php";
// Set fallback locale
Locale::setFallback(Helper::LOCALE);
// Ensure LiveDocx credentials are available
if (false === Helper::credentialsAvailable()) {
    Helper::printLine(Helper::credentialsHowTo());
    exit;
}
unset($base);
 public function testWillLoopThroughAllNamespacesUntilMatchIsFoundWhenAutoloading()
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace('ZendTest\\Loader\\TestAsset\\Parent', __DIR__ . '/TestAsset/Parent');
     $loader->registerNamespace('ZendTest\\Loader\\TestAsset\\Parent\\Child', __DIR__ . '/TestAsset/Child');
     $result = $loader->autoload('ZendTest\\Loader\\TestAsset\\Parent\\Child\\Subclass');
     $this->assertTrue($result !== false);
     $this->assertTrue(class_exists('ZendTest\\Loader\\TestAsset\\Parent\\Child\\Subclass', false));
 }
Beispiel #10
0
 * 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.
 *     * The names of its contributors may not 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 HOLDER 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.
 */
require_once './vendor/autoload.php';
use Zend\Loader\StandardAutoloader;
$autoloader = new StandardAutoloader();
$autoloader->registerNamespace('Pants', './library/Pants')->register();
// Setup PHPUnit autoloading
//require_once 'PHPUnit/Autoload.php';
// Set the error reporting
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('UTC');
Beispiel #11
0
 /**
  * @param StandardAutoloader &$loader
  * @return StandardAutoloader $loader
  */
 protected static function registerAddtionalNamespace(StandardAutoloader &$loader) : StandardAutoloader
 {
     $loader->registerNamespace('Gz3Base\\Test', __DIR__);
     return $loader;
 }
 /**
  * @param string $namespace
  * @param string $namespaceDirectory
  */
 protected function registerEntityFilesNamespace($namespace, $namespaceDirectory)
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace($namespace, $namespaceDirectory);
     $loader->register();
 }
Beispiel #13
0
<?php

/**
 * This makes our life easier when dealing with paths. Everything is relative
 * to the application root now.
 */
chdir(dirname(__DIR__));
// Setup autoloading
require 'vendor/autoload.php';
require 'module/Debug.php';
use Zend\Loader\StandardAutoloader;
$autoloader = new StandardAutoloader();
$autoloader->registerNamespace('ApplicationTest', __DIR__ . '/ApplicationTest/');
$autoloader->registerNamespace('TheodiaTest', __DIR__ . '/TheodiaTest/');
$autoloader->register();
// All tests always execute with a mocked 'now' time
$myClassReflection = new \ReflectionClass(Application\Utility::class);
$nowProperty = $myClassReflection->getProperty('now');
$nowProperty->setAccessible(true);
$nowProperty->setValue(null, new \DateTimeImmutable('2015-01-02T03:04:00', new \DateTimeZone('UTC')));
Beispiel #14
0
<?php

use Zend\Loader\StandardAutoloader;
require_once '../../../zendframework/zendframework/library/Zend/Loader/StandardAutoloader.php';
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespace('Skpd\\Bootstrap\\', '../src');
$loader->register();
$view = new \Zend\View\Renderer\PhpRenderer();
$view->getHelperPluginManager()->setInvokableClass('form', 'Skpd\\Bootstrap\\Form\\View\\Helper\\Form');
$view->getHelperPluginManager()->setInvokableClass('formColor', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormColor');
$view->getHelperPluginManager()->setInvokableClass('formDateTime', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormDateTime');
$view->getHelperPluginManager()->setInvokableClass('formEmail', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormEmail');
$view->getHelperPluginManager()->setInvokableClass('formFile', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormFile');
$view->getHelperPluginManager()->setInvokableClass('formInput', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormInput');
$view->getHelperPluginManager()->setInvokableClass('formMonth', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormMonth');
$view->getHelperPluginManager()->setInvokableClass('formNumber', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormNumber');
$view->getHelperPluginManager()->setInvokableClass('formPassword', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormPassword');
$view->getHelperPluginManager()->setInvokableClass('formRow', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormRow');
$view->getHelperPluginManager()->setInvokableClass('formSelect', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormSelect');
$view->getHelperPluginManager()->setInvokableClass('formTel', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormTel');
$view->getHelperPluginManager()->setInvokableClass('formText', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormText');
$view->getHelperPluginManager()->setInvokableClass('formTextArea', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormTextarea');
$view->getHelperPluginManager()->setInvokableClass('formUrl', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormUrl');
$view->getHelperPluginManager()->setInvokableClass('formCollection', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormCollection');
$view->getHelperPluginManager()->setInvokableClass('formLabel', 'Zend\\Form\\View\\Helper\\FormLabel');
$view->getHelperPluginManager()->setInvokableClass('formElement', 'Zend\\Form\\View\\Helper\\FormElement');
$view->getHelperPluginManager()->setInvokableClass('formElementErrors', 'Zend\\Form\\View\\Helper\\FormElementErrors');
$view->getHelperPluginManager()->setInvokableClass('formCheckbox', 'Zend\\Form\\View\\Helper\\FormCheckbox');
$view->getHelperPluginManager()->setInvokableClass('formSubmit', 'Zend\\Form\\View\\Helper\\FormSubmit');
$view->getHelperPluginManager()->setInvokableClass('formButton', 'Zend\\Form\\View\\Helper\\FormButton');
$view->getHelperPluginManager()->setInvokableClass('headScript', 'Zend\\View\\Helper\\HeadScript');
Beispiel #15
0
<?php

use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\Loader\StandardAutoloader;
chdir(__DIR__);
$previousDir = '.';
while (!file_exists('config/application.config.php')) {
    $dir = dirname(`pwd`);
    if ($previousDir === $dir) {
        throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is SxMail in a sub-directory of your application skeleton?');
    }
    $previousDir = $dir;
    chdir($dir);
}
if (!@(include_once __DIR__ . '/../../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
if (!($config = @(include __DIR__ . '/TestConfiguration.php'))) {
    $config = (require __DIR__ . '/TestConfiguration.php.dist');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('SxMail', __DIR__ . '/../src/SxMail');
$loader->registerNamespace('SxMailTest', __DIR__ . '/SxMailTest');
$loader->register();
$serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
$serviceManager->setService('ApplicationConfig', $config);
/* @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $serviceManager->get('ModuleManager');
$moduleManager->loadModules();