Add .env support.
This commit is contained in:
41
RoboFile.php
41
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,35 +10,31 @@ 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
|
||||
->taskExec('phantomjs --webdriver=4444')
|
||||
->background()
|
||||
->run();
|
||||
sleep(2);
|
||||
$this->_exec('vendor/bin/codecept run acceptance');
|
||||
}
|
||||
$this->loadEnv();
|
||||
$this
|
||||
->taskExec('phantomjs --webdriver=4444')
|
||||
->background()
|
||||
->run();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user