Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some general functionality #9

Merged
merged 2 commits into from Dec 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
87 changes: 87 additions & 0 deletions lib/AbstractTestCase.php
Expand Up @@ -6,6 +6,11 @@

abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{

protected $baseNamespace = 'Magium';



/**
* @var \Magium\WebDriver\WebDriver
*/
Expand Down Expand Up @@ -76,6 +81,76 @@ protected function tearDown()
}
}

/**
* @TODO Need to properly set the return type
* @param string $theme
* @return \Magium\Magento\Themes\ThemeConfiguration
*/

public function getTheme($theme = 'ThemeConfiguration')
{
if (strpos($theme, $this->baseNamespace) === false) {
$theme = $this->baseNamespace . '\Themes\\' . $theme;
}
return $this->get($theme);
}

/**
*
* @param string $navigator
* @return mixed
*/

public function getAction($action)
{
if (strpos($action, $this->baseNamespace ) === false) {
$action = $this->baseNamespace . '\Actions\\' . $action;
}
return $this->get($action);
}


/**
* @param string $name
* @return \Magium\Magento\Identities\AbstractEntity
*/

public function getIdentity($name = 'Customer')
{
if (strpos($name, $this->baseNamespace) === false) {
$name = $this->baseNamespace . '\Identities\\' . $name;
}
return $this->get($name);
}

/**
*
* @param string $navigator
* @return \Magium\Magento\Navigators\BaseMenuNavigator
*/

public function getNavigator($navigator = 'BaseMenuNavigator')
{
if (strpos($navigator, $this->baseNamespace) === false) {
$navigator = $this->baseNamespace . '\Navigators\\' . $navigator;
}
return $this->get($navigator);
}

/**
*
* @param string $extractor
* @return \Magium\Extractors\AbstractExtractor
*/

public function getExtractor($extractor)
{
if (strpos($extractor, $this->baseNamespace) === false) {
$extractor = $this->baseNamespace . '\Extractors\\' . $extractor;
}
return $this->get($extractor);
}

/**
* Sleep the specified amount of time.
*
Expand All @@ -100,6 +175,12 @@ public function sleep($time)
}


public function commandOpen($url)
{
$this->get('Magium\Commands\Open')->open($url);
}


/**
* @return \Zend\Log\Logger
*/
Expand Down Expand Up @@ -259,4 +340,10 @@ public function byCssSelector($selector)
return $this->webdriver->byCssSelector($selector);
}

}

function __($term)
{
// TODO; actually implement. This is a placeholder for future functionality.
return $term;
}