Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DocBlox plugin updated to handle annotations

  • Loading branch information...
commit bb607ec01cdc725bd3570246dbbee830f768a139 1 parent b8a7729
@DavertMik DavertMik authored
View
9 plugins/DocBlox/Codeception/Listener.php
@@ -135,7 +135,7 @@ protected function getScenarioText($test, $class, $method)
}, $args);
- if (in_array($step->getAction(), array('executeTestedMethodOn'))) {
+ if (in_array($step->getAction(), array('executeTestedMethodOn', 'executeMethod'))) {
$stub = array_shift($args);
}
@@ -158,6 +158,11 @@ protected function getScenarioText($test, $class, $method)
continue;
}
+ if (in_array($step->getAction(), array('executeMethod'))) {
+ $text .= "I execute <span style=\"background: #ddd;\">$stub->$method($args)</span>\n";
+ continue;
+ }
+
if (in_array($step->getAction(), array('executeTestedMethodOn'))) {
$text .= "If I execute <span style=\"background: #ddd;\">$stub->$method($args)</span>\n";
continue;
@@ -165,7 +170,7 @@ protected function getScenarioText($test, $class, $method)
if ($step->getName() == 'Comment') {
- $text .= "\nI ".$this->getStepAction($step)." $args\n";
+ $text .= "\n".ucfirst($step)." $args\n";
continue;
}
View
4 src/Codeception/Codecept.php
@@ -7,10 +7,10 @@
class Codecept
{
- const VERSION = "1.0.3";
+ const VERSION = "1.0.4";
/**
- * @var \Codeception\Runner
+ * @var \Codeception\PHPUnit\Runner
*/
protected $runner;
/**
View
12 src/Codeception/TestCase/Cest.php
@@ -63,6 +63,18 @@ public function getCoveredMethod()
if (!$this->getCoveredClass()) return null;
$r = new \ReflectionClass($this->getCoveredClass());
if ($r->hasMethod($this->testMethod)) return $this->testMethod;
+
+ // search by annotations
+ $rm = new \ReflectionMethod($this->testClass, $this->testMethod);
+ $doc = $rm->getDocComment();
+
+
+ if (preg_match('~@(covers|doc) (.*?)\*~si', $doc, $matches)) {
+ $method = trim($matches[2]);
+ if ($r->hasMethod($method)) return $method;
+ return null;
+ }
+
return null;
}
Please sign in to comment.
Something went wrong with that request. Please try again.