Ejemplo n.º 1
0
 /**
  * Loads environment variables from the .env file in the current working directory (getcwd), and puts them in a
  * Config container.
  *
  * @return Config
  */
 public static function GetConfig()
 {
     /*
      * Load environment variables (only if we have a .env file)
      */
     $envFilename = ".env";
     $envDir = getcwd();
     $envPath = "{$envDir}/{$envFilename}";
     if (file_exists($envPath)) {
         \Dotenv::load($envDir, $envFilename);
     }
     /*
      * Make sure required environment variables are set
      */
     \Dotenv::required(array("PAYPAL_CLIENT_ID", "PAYPAL_CLIENT_SECRET", "PAYPAL_ENDPOINT_MODE", "PAYPAL_EXPERIENCE_CLI_PROFILES_DIR"));
     /*
      * Create a config object and return it
      */
     $config = new Config(getenv("PAYPAL_CLIENT_ID"), getenv("PAYPAL_CLIENT_SECRET"), getenv("PAYPAL_ENDPOINT_MODE"), getenv("PAYPAL_EXPERIENCE_CLI_PROFILES_DIR"), getenv("PAYPAL_ENABLE_LOG"), getenv("PAYPAL_LOG_FILENAME"));
     // make sure the profiles directory is valid
     if (!$config->GetProfilesDirAbsolute()) {
         die("ERROR / Could not find profiles directory.\n");
     }
     return $config;
 }
Ejemplo n.º 2
0
 public function __construct($path, $file = 'config.php')
 {
     \Dotenv::load($path);
     if (file_exists($path . $file)) {
         $this->config = (include $path . $file);
     }
 }
 public function setUp()
 {
     \Dotenv::load(__DIR__ . '/../');
     $app = new \Laravel\Lumen\Application(realpath(__DIR__ . '/../'));
     $app->withFacades();
     $this->model = 'QueryParser\\Tests\\BaseModel';
 }
Ejemplo n.º 4
0
 public function testDotEnvWithConfig()
 {
     Dotenv::load(__DIR__ . '/_files/');
     $config = new Config(__DIR__ . '/_files/', 'dotenv.php');
     $this->assertEquals(getenv('MYSQL_USER'), $config->mysql['user']);
     $this->assertEquals(getenv('MYSQL_HOST'), $config->mysql['host']);
     $this->assertEquals(getenv('CUSTOM_BAR'), $config->custom['bar']);
 }
Ejemplo n.º 5
0
 /**
  * Creates the application.
  *
  * @return \Illuminate\Foundation\Application
  */
 public function createApplication()
 {
     $app = (require __DIR__ . '/../bootstrap/app.php');
     if (file_exists(dirname(__DIR__) . '/.env.test')) {
         Dotenv::load(dirname(__DIR__), '.env.test');
     }
     $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
     return $app;
 }
 function testGetOrder()
 {
     $dotenv = new Dotenv();
     $root = dirname(dirname(__FILE__));
     $dotenv->load($root);
     $dotenv->required(['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'APPLICATION_NAME', 'APPLICATION_VERSION']);
     $serviceUrl = "https://mws.amazonservices.com/Orders/2013-09-01";
     $config = array('ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'ProxyUsername' => null, 'ProxyPassword' => null, 'MaxErrorRetry' => 3);
     $service = new \Amazon\MWS\Orders\Orders_Client(getenv("AWS_ACCESS_KEY_ID"), getenv("AWS_SECRET_ACCESS_KEY"), getenv("APPLICATION_NAME"), getenv("APPLICATION_VERSION"), $config);
     /************************************************************************
      * Uncomment to try out Mock Service that simulates MarketplaceWebServiceOrders
      * responses without calling MarketplaceWebServiceOrders service.
      *
      * Responses are loaded from local XML files. You can tweak XML files to
      * experiment with various outputs during development
      *
      * XML files available under MarketplaceWebServiceOrders/Mock tree
      *
      ***********************************************************************/
     // $service = new MarketplaceWebServiceOrders_Mock();
     /************************************************************************
      * Setup request parameters and uncomment invoke to try out
      * sample for Get Order Action
      ***********************************************************************/
     // @TODO: set request. Action can be passed as Orders_Model_GetOrder
     $request = new \Amazon\MWS\Orders\Model\Orders_Model_GetOrderRequest(['AmazonOrderId' => '114-9172390-8828251', 'SellerId' => getenv("SELLER_ID")]);
     //		$request->setSellerId(getenv("MERCHANT_ID"));
     //		$request->setAmazonOrderId('114-9172390-8828251');
     // object or array of parameters
     /**
      * Get Get Order Action Sample
      * Gets competitive pricing and related information for a product identified by
      * the MarketplaceId and ASIN.
      *
      * @param MarketplaceWebServiceOrders_Interface $service instance of MarketplaceWebServiceOrders_Interface
      * @param mixed $request Orders_Model_GetOrder or array of parameters
      */
     try {
         $response = $service->GetOrder($request);
         echo "Service Response\n";
         echo "=============================================================================\n";
         $dom = new \DOMDocument();
         $dom->loadXML($response->toXML());
         $dom->preserveWhiteSpace = false;
         $dom->formatOutput = true;
         echo $dom->saveXML();
         echo "ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n";
     } catch (MarketplaceWebServiceOrders_Exception $ex) {
         echo "Caught Exception: " . $ex->getMessage() . "\n";
         echo "Response Status Code: " . $ex->getStatusCode() . "\n";
         echo "Error Code: " . $ex->getErrorCode() . "\n";
         echo "Error Type: " . $ex->getErrorType() . "\n";
         echo "Request ID: " . $ex->getRequestId() . "\n";
         echo "XML: " . $ex->getXML() . "\n";
         echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
     }
 }
Ejemplo n.º 7
0
 /**
  * PHPUnit Setup Function
  *
  */
 public function setUp()
 {
     if (file_exists(__DIR__ . '/../.env')) {
         Dotenv::load(__DIR__ . '/../');
     }
     $this->client = new \Cjhbtn\Periscopr\Client();
     if ($this->requiresAuth && !$this->setUpAuth()) {
         $this->markTestSkipped("Authenticated test skipped - Unable to authenticate with Periscope API");
     }
 }
 /**
  * loading envs
  */
 private static function _loadEnv()
 {
     if (getenv('DB_NAME') != null && getenv('DB_NAME') != "") {
         return;
     }
     if (defined('ABSPATH')) {
         \Dotenv::load(ABSPATH);
     } else {
         \Dotenv::load(getenv('HOME'));
     }
 }
Ejemplo n.º 9
0
 /**
  * Register the config provider and load the default configs
  *
  * @param Application $app
  *
  * @return void
  */
 protected function registerConfigs(Application $app)
 {
     $base = $app['path.base'];
     if (file_exists("{$base}/.env")) {
         $dotenv = \Dotenv::load($base);
     }
     $preloadedVars = ['env.HTTP_CACHE_ENABLED' => $app['http_cache.enabled'], 'env.DEBUG' => $app['debug'], 'env.AUTO_REBUILD' => $app['auto_rebuild'], 'path.base' => $base];
     $envVars = $_ENV;
     foreach ($envVars as $k => $v) {
         $preloadedVars["env.{$k}"] = $v;
     }
     $app->register(new \Igorw\Silex\ConfigServiceProvider("{$base}/config/site.yaml", $preloadedVars));
 }
Ejemplo n.º 10
0
 /**
  * @return string
  *
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function getEnvironment()
 {
     $fileSystem = new Filesystem();
     $environment = '';
     $environmentPath = app()->getBasePath() . '/.env';
     if ($fileSystem->isFile($environmentPath)) {
         $environment = trim($fileSystem->get($environmentPath));
         $envFile = app()->getBasePath() . '/.' . $environment;
         if ($fileSystem->isFile($envFile . '.env')) {
             $dotEnv = new Dotenv(app()->getBasePath() . '/', '.' . $environment . '.env');
             $dotEnv->load();
         }
     }
     return $environment;
 }
Ejemplo n.º 11
0
 function boot($rootDir, $urlDepth = 0, callable $onStartUp = null)
 {
     $rootDir = normalizePath($rootDir);
     // Initialize some settings from environment variables
     $dotenv = new Dotenv("{$rootDir}/.env");
     try {
         $dotenv->load();
     } catch (ConfigException $e) {
         echo $e->getMessage();
         return 1;
     }
     // Load the kernel's configuration.
     /** @var KernelSettings $kernelSettings */
     $kernelSettings = $this->kernelSettings = $this->injector->share(KernelSettings::class, 'app')->make(KernelSettings::class);
     $kernelSettings->isWebBased = true;
     $kernelSettings->setApplicationRoot($rootDir, $urlDepth);
     // Setup debugging (must be done before instantiating the kernel, but after instantiating its settings).
     $this->setupDebugging($rootDir);
     // Boot up the framework's kernel.
     $this->injector->execute([KernelModule::class, 'register']);
     // Boot up the framework's subsytems and the application's modules.
     /** @var KernelInterface $kernel */
     $kernel = $this->injector->make(KernelInterface::class);
     if ($onStartUp) {
         $onStartUp($kernel);
     }
     // Boot up all modules.
     try {
         $kernel->boot();
     } catch (ConfigException $e) {
         $NL = "<br>\n";
         echo $e->getMessage() . $NL . $NL;
         if ($e->getCode() == -1) {
             echo sprintf('Possile error causes:%2$s%2$s- the class name may be misspelled,%2$s- the class may no longer exist,%2$s- module %1$s may be missing or it may be corrupted.%2$s%2$s', str_match($e->getMessage(), '/from module (\\S+)/')[1], $NL);
         }
         $path = "{$kernelSettings->storagePath}/" . ModulesRegistry::REGISTRY_FILE;
         if (file_exists($path)) {
             echo "Tip: one possible solution is to remove the '{$path}' file and run 'workman' to rebuild the module registry.";
         }
     }
     // Finalize.
     if ($kernel->devEnv()) {
         $this->setDebugPathsMap($this->injector->make(ModulesRegistry::class));
     }
     return $kernel->getExitCode();
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     /*
         This is necessary for frontend servers to perform cleanup
         after running their own unit tests
     */
     if ($request->has('test_key')) {
         if (file_exists(base_path() . '/.env.testing')) {
             \Dotenv::load(base_path(), '.env.testing');
         }
         $inputKey = $request->input('test_key', str_random(32));
         $envKey = env('TEST_KEY', str_random(32));
         if ($inputKey != $envKey) {
             throw new \FatalErrorException('Get outta here.');
         }
     }
     return $next($request);
 }
Ejemplo n.º 13
0
 public function envLoad($path = null)
 {
     if (empty($path)) {
         $path = base_path();
     }
     $dotenv = \Dotenv::load($path);
     $this->gitHost = str_replace("\"", "", getenv('GITLAB_HOST'));
     $this->gitToken = str_replace("\"", "", getenv('GITLAB_TOKEN'));
     $this->hookUrl = str_replace("\"", "", getenv('HOOK_URL'));
     $debug = str_replace("\"", "", getenv('APP_DEBUG'));
     if (strtolower($debug) === 'true') {
         $this->debug = true;
     }
     $verbose = str_replace("\"", "", getenv('APP_VERBOSE'));
     if (strtolower($verbose) === 'true') {
         $this->verbose = true;
     }
 }
Ejemplo n.º 14
0
 /**
  * @inheritdoc
  */
 public function register(Container $app)
 {
     $app['env.default_options'] = ['prefix' => 'SILEX', 'use_dotenv' => function () {
         return true;
     }, 'dotenv_dir' => __DIR__ . '/../../../..', 'var_config' => []];
     $app['env.load'] = function ($app) {
         if (!isset($app['env.options'])) {
             $app['env.options'] = [];
         }
         $app['env.options'] = array_merge($app['env.default_options'], $app['env.options']);
         $this->addEnvVarsToApp($app);
         if ($app['env.options']['use_dotenv']()) {
             \Dotenv::load($app['env.options']['dotenv_dir']);
             //again pls
             $this->addEnvVarsToApp($app);
         }
         $this->applyConfigs($app, $app['env.options']['var_config']);
     };
 }
Ejemplo n.º 15
0
 public function setUp()
 {
     parent::setUp();
     // Load Dotenv
     Dotenv::load(__DIR__);
     // Set Laravel configuration parameters
     Config::set('elvis.api_endpoint_uri', getenv('ELVIS_API_ENDPOINT_URI'));
     Config::set('elvis.username', getenv('ELVIS_USERNAME'));
     Config::set('elvis.password', getenv('ELVIS_PASSWORD'));
     // Get session Id to user in the queries
     $this->sessionId = Elvis::login();
     // Upload a randon file to Elvis for various tests
     $temporaryFilename = tempnam("/tmp", "ElvisTest");
     // Create a file and store asset id
     $create = Elvis::create($this->sessionId, $temporaryFilename);
     $this->assetId = $create->id;
     // Remove temporary file
     unlink($temporaryFilename);
 }
Ejemplo n.º 16
0
 /**
  * Initialize main environment vars and load Yii 2
  */
 public static function init()
 {
     require '/var/www/vendor/autoload.php';
     // Load .env file if enabled and if it exists
     if (getenv('ENABLE_ENV_FILE') && file_exists(self::APP_DIR . '.env')) {
         Dotenv::load(self::APP_DIR);
     }
     // Define main environment variables
     if (isset($_ENV['YII_DEBUG'])) {
         define('YII_DEBUG', (bool) $_ENV['YII_DEBUG']);
         if (YII_DEBUG) {
             error_reporting(E_ALL);
         }
     }
     if (isset($_ENV['YII_ENV'])) {
         define('YII_ENV', $_ENV['YII_ENV']);
     }
     define('YII_ENV_TEST', defined('YII_ENV') && YII_ENV === 'test');
     require self::VENDOR_DIR . 'yiisoft/yii2/Yii.php';
 }
Ejemplo n.º 17
0
<?php

// Path to directory that contains the entire app
define('ROOT_DIR', realpath(__DIR__ . '/..'));
// Loads all the environment variables from ROOT_DIR/.env
Dotenv::load(ROOT_DIR);
// Set the default timezone <http://php.net/manual/en/timezones.php>
NConfig::setTimezone(getenv('TIMEZONE'));
// Legacy defines. Environment variables should be used moving forward
define('APP_NAME', 'nterchange');
define('APP_DIR', APP_NAME);
define('CACHE_DIR', realpath(ROOT_DIR . '/var'));
define('EXTERNAL_CACHE', false);
// no trailing slash
define('ASSET_DIR', realpath(ROOT_DIR . '/app'));
define('DOCUMENT_ROOT', ROOT_DIR . '/public_html');
define('ENVIRONMENT', getenv('ENVIRONMENT'));
define('SECURE_SITE', false);
define('ADMIN_SITE', APP_DIR . '/');
define('ADMIN_URL', false);
// this is false by default, or the full domain of the admin (http://admin.example.com/)
define('SITE_DRAFTS', true);
define('SITE_PERMISSIONS', true);
define('SITE_WORKFLOW', false);
define('SITE_PRINTABLE', true);
define('SITE_AUDIT_TRAIL', true);
define('SITE_TIME_ZONE', 'MST7MDT');
// string id of the site's time zone (eg. MST7MDT) - this is case-sensitive!
define('ERROR_EMAIL', '*****@*****.**');
define('CURRENT_SITE', (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']) == 443 ? 'secure' : 'public');
define('SITE_NAME', getenv('SITE_NAME'));
Ejemplo n.º 18
0
<?php

define('APP_START', microtime(true));
define('APP_PATH', realpath(__DIR__ . '/..') . '/');
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require APP_PATH . 'vendor/autoload.php';
try {
    Dotenv::load(APP_PATH);
} catch (InvalidArgumentException $e) {
    //
}
Ejemplo n.º 19
0
<?php

$root_dir = dirname(__DIR__);
$webroot_dir = $root_dir . '/web';
/**
 * Use Dotenv to set required environment variables and load .env file in root
 */
if (file_exists($root_dir . '/.env')) {
    Dotenv::load($root_dir);
}
Dotenv::required(array('DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL'));
/**
 * Set up our global environment constant and load its config first
 * Default: development
 */
define('WP_ENV', getenv('WP_ENV') ? getenv('WP_ENV') : 'development');
$env_config = dirname(__FILE__) . '/environments/' . WP_ENV . '.php';
if (file_exists($env_config)) {
    require_once $env_config;
}
/**
 * Custom Content Directory
 */
define('CONTENT_DIR', '/app');
define('WP_CONTENT_DIR', $webroot_dir . CONTENT_DIR);
define('WP_CONTENT_URL', WP_HOME . CONTENT_DIR);
/**
 * DB settings
 */
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
Ejemplo n.º 20
0
 /**
  * Load the variables using the .env handling
  *
  * @param string $envPath Path to the .env file
  * @return array|boolean Array of data if found, false if load fails
  */
 protected static function loadDotEnv($envPath)
 {
     try {
         \Dotenv::load($envPath);
         $config = array('username' => $_SERVER['DB_USER'], 'password' => $_SERVER['DB_PASS'], 'name' => $_SERVER['DB_NAME'], 'type' => isset($_SERVER['DB_TYPE']) ? $_SERVER['DB_TYPE'] : 'mysql', 'host' => $_SERVER['DB_HOST']);
         if (isset($_SERVER['DB_PREFIX'])) {
             $config['prefix'] = $_SERVER['DB_PREFIX'];
         }
         return $config;
     } catch (\Exception $e) {
         return false;
     }
 }
Ejemplo n.º 21
0
// FALSE.DIRECTORY_SEPARATOR = '/' .. mayhem insues.
if (realpath($plugins)) {
    define('PLUGINPATH', realpath($plugins) . DIRECTORY_SEPARATOR);
}
// Define the absolute paths for configured directories
define('APPPATH', realpath($application) . DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules) . DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system) . DIRECTORY_SEPARATOR);
define('VENPATH', realpath($vendor) . DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $system);
/**
 * Define the start time of the application, used for profiling.
 */
if (!defined('KOHANA_START_TIME')) {
    define('KOHANA_START_TIME', microtime(TRUE));
}
/**
 * Define the memory usage at the start of the application, used for profiling.
 */
if (!defined('KOHANA_START_MEMORY')) {
    define('KOHANA_START_MEMORY', memory_get_usage());
}
// Ushahidi: load transitional code
require APPPATH . '../src/Init' . EXT;
// Load dotenv
if (is_file(APPPATH . '../.env')) {
    Dotenv::load(APPPATH . '../');
}
// Bootstrap the application
require APPPATH . 'bootstrap' . EXT;
<?php

date_default_timezone_set('UTC');
// If there is an env file, then load it, so that the configs can use them
if (build_path([__DIR__, '..', '.env'], true)) {
    Dotenv::load(build_path([__DIR__, '..']));
}
// Path to config file
$config_file = build_path([__DIR__, '..', 'config', 'generator.php'], true);
// Read the config file if there is one, otherwise set to empty array
$config = (array) ($config_file ? require $config_file : []);
// Return a new generator
return new Spinen\ConnectWise\Generator\Generator($config);
Ejemplo n.º 23
0
<?php

require 'vendor/autoload.php';
function out($message)
{
    echo "\n{$message}\n";
}
Dotenv::load(__DIR__);
$backup_directory_today = "/backup/" . date('Y-m-d');
mkdir($backup_directory_today);
$issue_database_filename = $backup_directory_today . "/issue_database.sql.gz";
// Archive Lendia database
$db_host = getenv('DB_HOST');
$db_database = getenv('DB_DATABASE');
$db_user = getenv('DB_USERNAME');
$db_pass = getenv('DB_PASSWORD');
$dump_command = "mysqldump --host={$db_host} --user={$db_user} --password={$db_pass} {$db_database} | gzip > {$issue_database_filename}";
out("Running Issue database backup");
out($dump_command);
exec($dump_command);
Ejemplo n.º 24
0
<?php

ini_set('memory_limit', '2048M');
use Alchemy\Zippy\Zippy;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v2\AwsS3Adapter;
use League\Flysystem\Filesystem;
Dotenv::load(__DIR__, '.env.deploy');
/**
 * This is project's console commands configuration for Robo task runner.
 *
 * @see http://robo.li/
 */
class RoboFile extends \Robo\Tasks
{
    /**
     * Build task.
     *
     * @return bool
     */
    public function build()
    {
        $this->say('Build task');
        $envFile = __DIR__ . '/.env.dist';
        if (!file_exists($envFile)) {
            $this->yell(sprintf('The environment "%s" file does not exist!', $envFile));
            return false;
        }
        $buildPath = $this->getBuildPath();
        $filename = 'api_' . time() . '.zip';
        $this->say("Creating archive {$filename} in {$buildPath}");
<?php

/*
 |--------------------------------------------------------------------------
 | Detect The Application Environment
 |--------------------------------------------------------------------------
 |
 | Laravel takes a dead simple approach to your application environments
 | so you can just specify a machine name for the host that matches a
 | given environment, then we will automatically detect it for you.
 |
*/
$env = $app->detectEnvironment(function () {
    $environmentPath = __DIR__ . '/../.env';
    $setEnv = trim(file_get_contents($environmentPath));
    if (file_exists($environmentPath)) {
        putenv("APP_ENV={$setEnv}");
        if (getenv('APP_ENV') && file_exists(__DIR__ . '/../.' . getenv('APP_ENV') . '.env')) {
            Dotenv::load(__DIR__ . '/../', '.' . getenv('APP_ENV') . '.env');
        }
    }
});
Ejemplo n.º 26
0
function import_db()
{
    // Name of the file
    $filename = 'application/database/dump.sql';
    Dotenv::load(__DIR__);
    // MySQL host
    $mysql_host = getenv('DB_HOST');
    // MySQL username
    $mysql_username = getenv('DB_USERNAME');
    // MySQL password
    $mysql_password = getenv('DB_PASSWORD');
    // Database name
    $mysql_database = getenv('DB_DATABASE');
    // Connect to MySQL server
    $connection = mysqli_connect($mysql_host, $mysql_username, $mysql_password) or die('Error connecting to MySQL server: ' . mysql_error());
    // Select database
    if (!mysqli_select_db($connection, $mysql_database)) {
        die('Error selecting MySQL database: ' . mysql_error());
    }
    // Temporary variable, used to store current query
    $templine = '';
    // Read in entire file
    $lines = file($filename);
    // Loop through each line
    foreach ($lines as $line) {
        // Skip it if it's a comment
        if (substr($line, 0, 2) == '--' || $line == '') {
            continue;
        }
        // Add this line to the current segment
        $templine .= $line;
        // If it has a semicolon at the end, it's the end of the query
        if (substr(trim($line), -1, 1) == ';') {
            // Perform the query
            mysqli_query($connection, $templine) or print 'Error performing query \'<strong>' . $templine . '\': ' . mysqli_error() . '<br /><br />';
            // Reset temp variable to empty
            $templine = '';
        }
    }
    echo '<span class="success">Successfully Imported Database (<i class="fa fa-check-square-o"></i> PASS)</span>';
    new_line();
}
<?php

require dirname(__FILE__) . "/../vendor/autoload.php";
Dotenv::load(__DIR__ . "/../");
use SoftLayer\Messaging;
define('QUEUE_ACCOUNT', getenv('QUEUE_ACCOUNT'));
define('QUEUE_USERNAME', getenv('QUEUE_USERNAME'));
define('QUEUE_API_KEY', getenv('QUEUE_API_KEY'));
define('WAIT', 5);
abstract class BaseTest extends PHPUnit_Framework_TestCase
{
    public static $messaging;
    public static $queues = array();
    public static $topics = array();
    public static function setUpBeforeClass()
    {
        self::$messaging = new Messaging();
        self::$messaging->authenticate(QUEUE_ACCOUNT, QUEUE_USERNAME, QUEUE_API_KEY);
        self::$queues = array();
        self::$topics = array();
    }
    public static function queueName()
    {
        array_unshift(self::$queues, "testQueue_" . rand(0, 99999));
        return self::$queues[0];
    }
    public static function topicName()
    {
        array_unshift(self::$topics, "testTopic_" . rand(0, 99999));
        return self::$topics[0];
    }
Ejemplo n.º 28
0
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, and ABSPATH. You can find more information by visiting
 * {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}
 * Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */
require_once dirname(__DIR__) . '/vendor/autoload.php';
Dotenv::load(dirname(__DIR__));
Dotenv::required(['ENVIRONMENT', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_CHARSET', 'DB_PREFIX']);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', getenv('DB_DATABASE'));
/** MySQL database username */
define('DB_USER', getenv('DB_USERNAME'));
/** MySQL database password */
define('DB_PASSWORD', getenv('DB_PASSWORD'));
/** MySQL hostname */
define('DB_HOST', getenv('DB_HOST'));
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', getenv('DB_CHARSET'));
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
Ejemplo n.º 29
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
Dotenv::load(__DIR__ . '/../');
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(realpath(__DIR__ . '/../'));
$app->withFacades();
$app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
|
*/
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
/*
|--------------------------------------------------------------------------
Ejemplo n.º 30
0
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
if (is_file(base_path() . '/.env')) {
    Dotenv::load(base_path());
}