Skip to content

Commit

Permalink
New approach to manage suite configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
javigomez committed Jun 23, 2016
1 parent 5349a5a commit e347ad9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions tests/_support/AcceptanceHelper.php
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;
}
}
6 changes: 3 additions & 3 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public function clickToolbarButton($button)
$I = $this;
$input = strtolower($button);

// @todo Needs to find way to work with different window size.
$screenSize = explode("x", $this->getConfiguration('window_size'));
$suiteConfiguration = $I->getSuiteConfiguration();
$screenWidth = explode("x", $suiteConfiguration['modules']['config']['JoomlaBrowser']['window_size']);

if ($screenSize[0] <= 480)
if ($screenWidth[0] <= 480)
{
$I->click('Toolbar');
}
Expand Down

0 comments on commit e347ad9

Please sign in to comment.