public function testMatches()
 {
     $this->assertTrue(Autoload::matches('api\\frontend\\UserHelper', 'api\\frontend', 'Helper'));
     $this->assertTrue(Autoload::matches('\\api\\frontend\\ModelHelper', 'api\\frontend', 'Helper'));
     $this->assertTrue(Autoload::matches('\\api\\Codeception\\UserController', 'api\\Codeception', 'Controller'));
     $this->assertTrue(Autoload::matches('\\api\\Codeception\\UserController', 'api\\Codeception', 'Controller'));
     $this->assertTrue(Autoload::matches('\\api\\Codeception\\UserController', '', 'Controller'));
 }
Beispiel #2
0
 protected static function autoloadHelpers()
 {
     Autoload::registerSuffix('Helper', self::helpersDir());
 }
<?php

/**
 * ownCloud - gallery
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Olivier Paroz <*****@*****.**>
 *
 * @copyright Olivier Paroz 2015
 */
use Codeception\Util\Autoload;
define('PHPUNIT_RUN', 1);
// Add core
require_once __DIR__ . '/../../../lib/base.php';
// Add core tests to the list of valid paths
OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
// Give access to core tests to Codeception
Autoload::addNamespace('Test', '/../../../tests/lib');
// Load all apps
OC_App::loadApps();
OC_Hook::clear();
<?php

// Here you can initialize variables that will be available to your tests
use Phalcon\Mvc\Application;
use Phalcon\DI\FactoryDefault;
use Codeception\Util\Fixtures;
use Codeception\Util\Autoload;
defined('APP_PATH') || define('APP_PATH', dirname(dirname(dirname(__FILE__))));
defined('CONFIG_PATH') || define('CONFIG_PATH', dirname(dirname(__FILE__)));
require APP_PATH . "/vendor/autoload.php";
$config = (include CONFIG_PATH . "/config/config.php");
$di = new FactoryDefault();
require CONFIG_PATH . "/config/services.php";
$application = new Application();
$application->setDI($di);
Fixtures::add("app", $application);
Autoload::addNamespace('SimpleHelpers\\Libs\\Github', '/src/');
<?php

// This is global bootstrap for autoloading
include 'ZendServiceLocator.php';
$zendServiceLocator = new \SandboxContact\ZendServiceLocator();
\Codeception\Util\Autoload::register('SandboxContact\\Pages', 'Page', __DIR__ . DIRECTORY_SEPARATOR . 'Pages');
\Codeception\Util\Autoload::register('SandboxContact\\Acceptance', 'Cest', __DIR__ . DIRECTORY_SEPARATOR . 'acceptance');
\Codeception\Util\Autoload::register('SandboxContact\\Functional', 'Cest', __DIR__ . DIRECTORY_SEPARATOR . 'functional');
require_once '_support/LoginCommons.php';
Beispiel #6
0
<?php

require __DIR__ . '/../vendor/autoload.php';
\Codeception\Util\Autoload::addNamespace('WebChemistry\\Images', __DIR__ . '/../src');
\Codeception\Util\Autoload::addNamespace('', __DIR__ . '/includes');
<?php

// This is global bootstrap for autoloading
use Codeception\Util\Autoload;
require_once __DIR__ . '/../vendor/autoload.php';
Autoload::addNamespace('', __DIR__ . '/unit/');
Autoload::addNamespace('', __DIR__ . '/../src');
Beispiel #8
0
 protected static function autoloadHelpers()
 {
     $namespace = self::$config['namespace'];
     Autoload::addNamespace($namespace, self::supportDir());
     // deprecated
     Autoload::addNamespace($namespace . '\\Codeception\\Module', self::supportDir());
 }
Beispiel #9
0
<?php

// This is global bootstrap for autoloading
use Codeception\Util\Autoload;
Autoload::addNamespace('consultnn\\helpers', codecept_root_dir());
Beispiel #10
0
<?php

// Here you can initialize variables that will for your tests
\Codeception\Util\Autoload::registerSuffix('Group', __DIR__ . DIRECTORY_SEPARATOR . '_groups');
date_default_timezone_set('Europe/Paris');
 /**
  * Loads global config file which is `codeception.yml` by default.
  * When config is already loaded - returns it.
  *
  * @param null $configFile
  * @return array
  * @throws Exception\ConfigurationException
  */
 public static function config($configFile = null)
 {
     if (!$configFile && self::$config) {
         return self::$config;
     }
     if (self::$config && self::$lock) {
         return self::$config;
     }
     if ($configFile === null) {
         $configFile = getcwd() . DIRECTORY_SEPARATOR . 'codeception.yml';
     }
     if (is_dir($configFile)) {
         $configFile = $configFile . DIRECTORY_SEPARATOR . 'codeception.yml';
     }
     $dir = realpath(dirname($configFile));
     self::$dir = $dir;
     $configDistFile = $dir . DIRECTORY_SEPARATOR . 'codeception.dist.yml';
     if (!(file_exists($configDistFile) || file_exists($configFile))) {
         throw new ConfigurationException("Configuration file could not be found.\nRun `bootstrap` to initialize Codeception.", 404);
     }
     // Preload config to retrieve params such that they are applied to codeception config file below
     $tempConfig = self::$defaultConfig;
     $distConfigContents = "";
     if (file_exists($configDistFile)) {
         $distConfigContents = file_get_contents($configDistFile);
         $tempConfig = self::mergeConfigs($tempConfig, self::getConfFromContents($distConfigContents));
     }
     $configContents = "";
     if (file_exists($configFile)) {
         $configContents = file_get_contents($configFile);
         $tempConfig = self::mergeConfigs($tempConfig, self::getConfFromContents($configContents));
     }
     self::prepareParams($tempConfig);
     $config = self::mergeConfigs(self::$defaultConfig, self::getConfFromContents($distConfigContents));
     $config = self::mergeConfigs($config, self::getConfFromContents($configContents));
     if ($config == self::$defaultConfig) {
         throw new ConfigurationException("Configuration file is invalid");
     }
     self::$config = $config;
     if (!isset($config['paths']['log'])) {
         throw new ConfigurationException('Log path is not defined by key "paths: log"');
     }
     self::$logDir = $config['paths']['log'];
     // fill up includes with wildcard expansions
     $config['include'] = self::expandWildcardedIncludes($config['include']);
     // config without tests, for inclusion of other configs
     if (count($config['include']) and !isset($config['paths']['tests'])) {
         return self::$config = $config;
     }
     if (!isset($config['paths']['tests'])) {
         throw new ConfigurationException('Tests directory is not defined in Codeception config by key "paths: tests:"');
     }
     if (!isset($config['paths']['data'])) {
         throw new ConfigurationException('Data path is not defined Codeception config by key "paths: data"');
     }
     // compatibility with 1.x, 2.0
     if (!isset($config['paths']['support']) and isset($config['paths']['helpers'])) {
         $config['paths']['support'] = $config['paths']['helpers'];
     }
     if (!isset($config['paths']['support'])) {
         throw new ConfigurationException('Helpers path is not defined by key "paths: support"');
     }
     self::$dataDir = $config['paths']['data'];
     self::$supportDir = $config['paths']['support'];
     self::$testsDir = $config['paths']['tests'];
     if (isset($config['paths']['envs'])) {
         self::$envsDir = $config['paths']['envs'];
     }
     Autoload::addNamespace(self::$config['namespace'], self::supportDir());
     self::loadBootstrap($config['settings']['bootstrap']);
     self::loadSuites();
     return $config;
 }
Beispiel #12
0
 protected static function autoloadHelpers()
 {
     Autoload::registerSuffix('Helper', \Codeception\Configuration::helpersDir());
 }
Beispiel #13
0
use RuntimeException;
use WellCart\Mvc\Application;
use WellCart\Utility\Config;
use WellCart\Utility\PHPEnvironment;
if (is_file(__DIR__ . '/../../../bootstrap.php')) {
    require_once __DIR__ . '/../../../bootstrap.php';
}
if (!defined('WELLCART')) {
    define('WELLCART', true);
    chdir(__DIR__);
    /**
     * Bootstrap module tests
     */
    Bootstrap::init();
}
CodeceptionAutoload::addNamespace('WellCart\\Theme\\BackendUi\\Test', __DIR__ . '/support');
/**
 * Bootstrap test environment
 */
class Bootstrap
{
    /**
     * Initialize testing environment
     *
     * @return void
     */
    public static function init()
    {
        if (is_file(__DIR__ . '/config/.env')) {
            Dotenv::load(['filepath' => __DIR__ . '/config/.env', 'toEnv' => true]);
        }
Beispiel #14
0
<?php

use Codeception\Util\Autoload;
// no utf without this
setlocale(LC_ALL, 'en_US.UTF8');
// This is global bootstrap for autoloading
$ds = DIRECTORY_SEPARATOR;
Autoload::registerSuffix('Page', implode($ds, array(__DIR__, '_pages')));
Autoload::registerSuffix('Helper', implode($ds, array(__DIR__, '_support', 'helpers')));
// this shit sucks
// Yii isn't found by standard composer autoload
require_once dirname(__DIR__) . '/boot/testing-console.php';
require_once __DIR__ . '/_data/YiiBridge/yiit.php';
launch_codeception_yii_bridge();
#require_once dirname(__DIR__).'/vendor/codeception/codeception/Platform/RunFailed.php';
$helper = new \Codeception\Module\BootstrapHelper();
$helper->bootstrap();
Beispiel #15
0
<?php

\Codeception\Util\Autoload::addNamespace('Page', __DIR__ . '/_support/_pages');
Beispiel #16
0
<?php

// Here you can initialize variables that will be available to your tests
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__ . DIRECTORY_SEPARATOR . 'installation/_pages');
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__ . DIRECTORY_SEPARATOR . 'administrator/_pages');
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__ . DIRECTORY_SEPARATOR . 'administrator/_pages/system');
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__ . DIRECTORY_SEPARATOR . 'installation/_steps/');
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__ . DIRECTORY_SEPARATOR . 'administrator/_steps/');
<?php

// Here you can initialize variables that will be available to your tests
use Codeception\Util\Autoload;
Autoload::addNamespace('', __DIR__ . '/unit/');
Beispiel #18
0
<?php

use Codeception\Util\Autoload;
use Codeception\Util\Fixtures;
/**
 * Bootstrap for Codeception tests
 *
 * @author Gawain Lynch <*****@*****.**>
 */
Autoload::addNamespace('\\', __DIR__);
// User IDs
Fixtures::add('users', ['admin' => ['username' => 'admin', 'password' => 'topsecret', 'email' => '*****@*****.**', 'displayname' => 'Admin Person'], 'author' => ['username' => 'author', 'password' => 'iamanartisandarnit', 'email' => '*****@*****.**', 'displayname' => 'Author Person'], 'editor' => ['username' => 'editor', 'password' => 'nomoresecrets', 'email' => '*****@*****.**', 'displayname' => 'Editor Person'], 'manager' => ['username' => 'manager', 'password' => 'cantkeepsecrets', 'email' => '*****@*****.**', 'displayname' => 'Manager Person'], 'developer' => ['username' => 'developer', 'password' => '~n0Tne1k&nGu3$$', 'email' => '*****@*****.**', 'displayname' => 'Developer Person'], 'lemmings' => ['username' => 'lemmings', 'password' => 'MikeDaillyDavidJones', 'email' => '*****@*****.**', 'displayname' => 'Lemmings Person']]);
// Files that we'll backup. If they exist when we run, then we keep the
// original in tact before starting the suite run
Fixtures::add('backups', [INSTALL_ROOT . '/app/config/config.yml' => false, INSTALL_ROOT . '/app/config/contenttypes.yml' => false, INSTALL_ROOT . '/app/config/menu.yml' => false, INSTALL_ROOT . '/app/config/permissions.yml' => false, INSTALL_ROOT . '/app/config/routing.yml' => false, INSTALL_ROOT . '/app/config/taxonomy.yml' => false, BOLT_ROOT . '/app/resources/translations/en_GB/messages.en_GB.yml' => true, BOLT_ROOT . '/app/resources/translations/en_GB/infos.en_GB.yml' => true, BOLT_ROOT . '/app/resources/translations/en_GB/contenttypes.en_GB.yml' => true, INSTALL_ROOT . '/app/database/bolt.db' => false, INSTALL_ROOT . '/theme/base-2016/partials/_footer.twig' => true]);
// Session and authentication tokens
Fixtures::add('tokenNames', ['session' => 'bolt_session_' . md5('localhost:8123'), 'authtoken' => 'bolt_authtoken_' . md5('localhost:8123')]);
// Temporary hack
restore_error_handler();
<?php

// This is global bootstrap for autoloading
\Codeception\Util\Autoload::registerSuffix('Base', __DIR__ . DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_base_class');
Beispiel #20
0
<?php

// This is global bootstrap for autoloading
use Codeception\Util\Autoload;
Autoload::addNamespace('tempsmsru', '.');
Beispiel #21
0
<?php

// Here you can initialize variables that will for your tests
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__ . DIRECTORY_SEPARATOR . '_pages');
Beispiel #22
0
<?php

\Codeception\Util\Autoload::addNamespace('CliGuy', __DIR__ . DIRECTORY_SEPARATOR . '_steps');
Beispiel #23
0
<?php

// Here you can initialize variables that will for your tests
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__ . DIRECTORY_SEPARATOR . '_pages');
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__ . DIRECTORY_SEPARATOR . '_steps');
Beispiel #24
0
<?php

\Codeception\Util\Autoload::addNamespace('Project\\Command', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'examples');