-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New approach to manage suite configuration
- Loading branch information
Showing
2 changed files
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
<?php | ||
namespace Codeception\Module; | ||
|
||
use Codeception\Configuration; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
class AcceptanceHelper extends \Codeception\Module | ||
{ | ||
protected static $acceptanceSuiteConfiguration = []; | ||
|
||
/** | ||
* Function to getConfiguration from the YML and return in the test | ||
* Function to get Configuration from the acceptance.suite.yml to be used by a test | ||
* | ||
* @param null $element | ||
* @return array | ||
* | ||
* @return mixed | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function getConfiguration($element = null) | ||
public function getSuiteConfiguration() | ||
{ | ||
if (is_null($element)) { | ||
throw new InvalidArgumentException('empty value or non existing element was requested from configuration'); | ||
if (empty(self::$acceptanceSuiteConfiguration)) | ||
{ | ||
self::$acceptanceSuiteConfiguration = Configuration::suiteSettings('acceptance', Configuration::config()); | ||
} | ||
return $this->config[$element]; | ||
|
||
return self::$acceptanceSuiteConfiguration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters