Add .env support.
This commit is contained in:
1
.env.sample
Normal file
1
.env.sample
Normal file
@@ -0,0 +1 @@
|
||||
WP_TEST_URL="http://localhost"
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ tests/_output/*
|
||||
bower_components/*
|
||||
node_modules
|
||||
tests/*.suite.yml
|
||||
.env
|
||||
|
29
RoboFile.php
29
RoboFile.php
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__);
|
||||
$dotenv->load();
|
||||
|
||||
class RoboFile extends \Robo\Tasks {
|
||||
function install() {
|
||||
$this->_exec('./composer.phar install');
|
||||
@@ -6,25 +10,21 @@ class RoboFile extends \Robo\Tasks {
|
||||
}
|
||||
|
||||
function update() {
|
||||
$this->say(getenv('WP_TEST_URL'));
|
||||
$this->_exec('./composer.phar update');
|
||||
$this->_exec('npm update');
|
||||
}
|
||||
|
||||
function watch() {
|
||||
$this->_exec('./node_modules/stylus/bin/stylus -u nib -w assets/css/src/admin.styl -o assets/css/');
|
||||
}
|
||||
|
||||
function testUnit() {
|
||||
$this->_exec('vendor/bin/codecept run unit');
|
||||
}
|
||||
|
||||
function testAcceptanceConfig() {
|
||||
// create config file from sample unless a config file alread exists
|
||||
return $this->_copy(
|
||||
'tests/acceptance.suite.yml.sample',
|
||||
'tests/acceptance.suite.yml',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
function testAcceptance() {
|
||||
if($this->testAcceptanceConfig()) {
|
||||
$this->loadEnv();
|
||||
$this
|
||||
->taskExec('phantomjs --webdriver=4444')
|
||||
->background()
|
||||
@@ -32,9 +32,9 @@ class RoboFile extends \Robo\Tasks {
|
||||
sleep(2);
|
||||
$this->_exec('vendor/bin/codecept run acceptance');
|
||||
}
|
||||
}
|
||||
|
||||
function testAll() {
|
||||
$this->loadEnv();
|
||||
$this
|
||||
->taskexec('phantomjs --webdriver=4444')
|
||||
->background()
|
||||
@@ -43,7 +43,10 @@ class RoboFile extends \Robo\Tasks {
|
||||
$this->_exec('vendor/bin/codecept run');
|
||||
}
|
||||
|
||||
function watch() {
|
||||
$this->_exec('./node_modules/stylus/bin/stylus -u nib -w assets/css/src/admin.styl -o assets/css/');
|
||||
function loadEnv() {
|
||||
$this->taskReplaceInFile('tests/acceptance.suite.yml')
|
||||
->regex("/url.*/")
|
||||
->to('url: ' . "'" . getenv('WP_TEST_URL'). "'")
|
||||
->run();
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,8 @@
|
||||
"codeception/codeception": "*",
|
||||
"codeception/specify": "*",
|
||||
"codeception/verify": "*",
|
||||
"codegyre/robo": "*"
|
||||
"codegyre/robo": "*",
|
||||
"vlucas/phpdotenv": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
48
composer.lock
generated
48
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "d120ce6897bd8803e0dcface16642b8b",
|
||||
"hash": "8868736a7d968f4adddfcd0c607810ae",
|
||||
"packages": [
|
||||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
@@ -2110,6 +2110,52 @@
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-07-01 11:25:50"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vlucas/phpdotenv.git",
|
||||
"reference": "91064290f5b53a09bdff1b939d7f69fb0e7531b5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/91064290f5b53a09bdff1b939d7f69fb0e7531b5",
|
||||
"reference": "91064290f5b53a09bdff1b939d7f69fb0e7531b5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dotenv\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Vance Lucas",
|
||||
"email": "vance@vancelucas.com",
|
||||
"homepage": "http://www.vancelucas.com"
|
||||
}
|
||||
],
|
||||
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
|
||||
"homepage": "http://github.com/vlucas/phpdotenv",
|
||||
"keywords": [
|
||||
"dotenv",
|
||||
"env",
|
||||
"environment"
|
||||
],
|
||||
"time": "2015-05-30 16:15:01"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php //[STAMP] b7decc66e5ef5eaba3d375be7320376b
|
||||
<?php //[STAMP] 9cd003010af5e6228d99a8c6909f010e
|
||||
namespace _generated;
|
||||
|
||||
// This class was automatically generated by build task
|
||||
@@ -8,7 +8,7 @@ namespace _generated;
|
||||
use Codeception\Module\WebDriver;
|
||||
use Helper\Acceptance;
|
||||
|
||||
trait AcceptanceTesterActions
|
||||
trait acceptancetesterActions
|
||||
{
|
||||
/**
|
||||
* @return \Codeception\Scenario
|
||||
|
Reference in New Issue
Block a user