Skip to content
This repository
Browse code

DocBlox plugin updated to handle annotations

  • Loading branch information...
commit bb607ec01cdc725bd3570246dbbee830f768a139 1 parent b8a7729
Michael Bodnarchuk DavertMik authored
9 plugins/DocBlox/Codeception/Listener.php
@@ -135,7 +135,7 @@ protected function getScenarioText($test, $class, $method)
135 135
136 136 }, $args);
137 137
138   - if (in_array($step->getAction(), array('executeTestedMethodOn'))) {
  138 + if (in_array($step->getAction(), array('executeTestedMethodOn', 'executeMethod'))) {
139 139 $stub = array_shift($args);
140 140 }
141 141
@@ -158,6 +158,11 @@ protected function getScenarioText($test, $class, $method)
158 158 continue;
159 159 }
160 160
  161 + if (in_array($step->getAction(), array('executeMethod'))) {
  162 + $text .= "I execute <span style=\"background: #ddd;\">$stub->$method($args)</span>\n";
  163 + continue;
  164 + }
  165 +
161 166 if (in_array($step->getAction(), array('executeTestedMethodOn'))) {
162 167 $text .= "If I execute <span style=\"background: #ddd;\">$stub->$method($args)</span>\n";
163 168 continue;
@@ -165,7 +170,7 @@ protected function getScenarioText($test, $class, $method)
165 170
166 171
167 172 if ($step->getName() == 'Comment') {
168   - $text .= "\nI ".$this->getStepAction($step)." $args\n";
  173 + $text .= "\n".ucfirst($step)." $args\n";
169 174 continue;
170 175 }
171 176
4 src/Codeception/Codecept.php
@@ -7,10 +7,10 @@
7 7
8 8 class Codecept
9 9 {
10   - const VERSION = "1.0.3";
  10 + const VERSION = "1.0.4";
11 11
12 12 /**
13   - * @var \Codeception\Runner
  13 + * @var \Codeception\PHPUnit\Runner
14 14 */
15 15 protected $runner;
16 16 /**
12 src/Codeception/TestCase/Cest.php
@@ -63,6 +63,18 @@ public function getCoveredMethod()
63 63 if (!$this->getCoveredClass()) return null;
64 64 $r = new \ReflectionClass($this->getCoveredClass());
65 65 if ($r->hasMethod($this->testMethod)) return $this->testMethod;
  66 +
  67 + // search by annotations
  68 + $rm = new \ReflectionMethod($this->testClass, $this->testMethod);
  69 + $doc = $rm->getDocComment();
  70 +
  71 +
  72 + if (preg_match('~@(covers|doc) (.*?)\*~si', $doc, $matches)) {
  73 + $method = trim($matches[2]);
  74 + if ($r->hasMethod($method)) return $method;
  75 + return null;
  76 + }
  77 +
66 78 return null;
67 79 }
68 80

0 comments on commit bb607ec

Please sign in to comment.
Something went wrong with that request. Please try again.