Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00%
0 / 1
0.00%
0 / 10
CRAP
0.00%
0 / 77
AbstractGuy
0.00%
0 / 1
0.00%
0 / 10
342
0.00%
0 / 77
 __construct(\Codeception\Scenario $scenario)
0.00%
0 / 1
2
0.00%
0 / 4
 execute($callable)
0.00%
0 / 1
6
0.00%
0 / 10
 wantToTest($text)
0.00%
0 / 1
2
0.00%
0 / 4
 wantTo($text)
0.00%
0 / 1
6
0.00%
0 / 9
 expectTo($prediction)
0.00%
0 / 1
6
0.00%
0 / 9
 expect($prediction)
0.00%
0 / 1
6
0.00%
0 / 9
 amGoingTo($argumentation)
0.00%
0 / 1
6
0.00%
0 / 9
 am($role)
0.00%
0 / 1
6
0.00%
0 / 8
 lookForwardTo($role)
0.00%
0 / 1
6
0.00%
0 / 7
 __call($method, $arguments)
0.00%
0 / 1
6
0.00%
0 / 8
<?php
namespace Codeception;
abstract class AbstractGuy
{
public static $methods = array();
/**
* @var \Codeception\Scenario
*/
protected $scenario;
protected $running = false;
public function __construct(\Codeception\Scenario $scenario)
{
$this->scenario = $scenario;
}
/**
* Lazy-execution given anonymous function
* @param $callable \Closure
* @return null|void|bool|mixed
*/
public function execute($callable)
{
$this->scenario->executor($callable);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
} else {
}
return $this;
}
public function wantToTest($text)
{
return $this->wantTo('test ' . $text);
}
public function wantTo($text)
{
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
$this->scenario->setFeature(strtolower($text));
return $this;
}
public function expectTo($prediction)
{
$this->scenario->comment('I expect to ' . $prediction);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
return $this;
}
public function expect($prediction)
{
$this->scenario->comment('I expect ' . $prediction);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
return $this;
}
public function amGoingTo($argumentation)
{
$this->scenario->comment('I am going to ' . $argumentation);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
return $this;
}
public function am($role) {
$this->scenario->comment('As a ' . $role);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
return $this;
}
public function lookForwardTo($role) {
$this->scenario->comment('So that I ' . $role);
if ($this->scenario->running()) {
$this->scenario->runStep();
return $this;
}
}
public function __call($method, $arguments) {
if ($this->scenario->running()) {
$class = get_class($this);
throw new \RuntimeException("Call to undefined method $class::$method");
} else {
$this->scenario->action($method, $arguments);
}
}
}