mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-26 05:48:26 +00:00
Add local configuration file for RoboFile.php
This commit is contained in:
parent
930f4213dd
commit
04216cf96d
1
.gitignore
vendored
1
.gitignore
vendored
@ -45,6 +45,7 @@ vendor/*
|
|||||||
|
|
||||||
# Robo
|
# Robo
|
||||||
robo.phar
|
robo.phar
|
||||||
|
RoboFile.ini
|
||||||
|
|
||||||
# Test related files
|
# Test related files
|
||||||
tests/acceptance.suite.yml
|
tests/acceptance.suite.yml
|
||||||
|
5
RoboFile.dist.ini
Normal file
5
RoboFile.dist.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$configuration = array(
|
||||||
|
"skipClone" => true, // default is false
|
||||||
|
);
|
39
RoboFile.php
39
RoboFile.php
@ -17,6 +17,8 @@ class RoboFile extends \Robo\Tasks
|
|||||||
|
|
||||||
private $extension = '';
|
private $extension = '';
|
||||||
|
|
||||||
|
private $configuration = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Execute extension for Windows Operating System
|
* Set the Execute extension for Windows Operating System
|
||||||
*
|
*
|
||||||
@ -40,6 +42,8 @@ class RoboFile extends \Robo\Tasks
|
|||||||
*/
|
*/
|
||||||
public function runTests($seleniumPath = null, $suite = 'acceptance')
|
public function runTests($seleniumPath = null, $suite = 'acceptance')
|
||||||
{
|
{
|
||||||
|
$this->configuration = $this->getConfiguration();
|
||||||
|
|
||||||
$this->setExecExtension();
|
$this->setExecExtension();
|
||||||
|
|
||||||
$this->createTestingSite();
|
$this->createTestingSite();
|
||||||
@ -154,12 +158,16 @@ class RoboFile extends \Robo\Tasks
|
|||||||
// Kill selenium server
|
// Kill selenium server
|
||||||
// $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
|
// $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a testing Joomla site for running the tests (use it before run:test)
|
* Creates a testing Joomla site for running the tests (use it before run:test)
|
||||||
*/
|
*/
|
||||||
public function createTestingSite()
|
public function createTestingSite()
|
||||||
{
|
{
|
||||||
|
if (!empty($this->configuration['skipClone'])) {
|
||||||
|
$this->say('Reusing Joomla CMS site already present at tests/joomla-cms3');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get Joomla Clean Testing sites
|
// Get Joomla Clean Testing sites
|
||||||
if (is_dir('tests/joomla-cms3'))
|
if (is_dir('tests/joomla-cms3'))
|
||||||
{
|
{
|
||||||
@ -170,6 +178,35 @@ class RoboFile extends \Robo\Tasks
|
|||||||
$this->say('Joomla CMS site created at tests/joomla-cms3');
|
$this->say('Joomla CMS site created at tests/joomla-cms3');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get (optional) configuration from an external file
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
$configurationFile = __DIR__ . '/RoboFile.ini';
|
||||||
|
if (!file_exists($configurationFile)) {
|
||||||
|
$this->say("No local configuration file");
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
require_once $configurationFile;
|
||||||
|
if (!is_array($configuration)) {
|
||||||
|
$this->say('Local configuration file is empty or wrong (it must contain a $configuration array');
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $configuration;
|
||||||
|
}
|
||||||
|
catch (Exception $ex)
|
||||||
|
{
|
||||||
|
$this->say('Exception reading local configuration file: ' . $ex->getMessage());
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs Selenium Standalone Server.
|
* Runs Selenium Standalone Server.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user