コード例 #1
0
 protected function getTestMethodName($testMethodName)
 {
     return Filter::camelCaseToSpace(substr($testMethodName, 2));
 }
コード例 #2
0
 /**
  * @param string $exampleGroupName
  * @param string $specificationText
  * @return string
  * @throws \UnexpectedValueException
  */
 public function getExampleMethod($exampleGroupName, $specificationText)
 {
     foreach ($this->examplesByGroup[$this->getExampleGroupClass($exampleGroupName)] as $exampleMethod) {
         /* @var $exampleMethod \ReflectionMethod */
         if ($specificationText == Filter::camelCaseToSpace(substr($exampleMethod->getName(), 2))) {
             return $exampleMethod->getName();
         }
     }
     throw new \UnexpectedValueException(sprintf('The example corresponding to [ %s ] and [ %s ] is not found in the test suite.', $specificationText, $exampleGroupName));
 }
コード例 #3
0
ファイル: Example.php プロジェクト: nrocy/phpspec
 /**
  * Return the specification text taken from method name
  * 
  * itReturnZeroWithNoArguments
  * becomes
  * returns zero with no argument
  * 
  * @param string $methodName
  * @return string
  */
 public function getSpecificationText()
 {
     $methodName = substr($this->_methodName, 2);
     return Filter::camelCaseToSpace($methodName);
 }