示例#1
0
 /**
 * Creates a partial code for class method.
 *
 ` @param  Stagehand_PHP_Class_Method $method
 * @return string
 */
 protected function _createMethodCode($method)
 {
     if ($method->isFinal()) {
         return;
     }
     return $method->render();
 }
    /**
     * @test
     */
    public function useDocComment()
    {
        $name = 'getFoo';
        $docComment = "A tests for DocComment.\n\n@return boolean";
        $formatedDocComment = "/**\n * A tests for DocComment.\n *\n * @return boolean\n */";
        $result = <<<EOF
/**
 * A tests for DocComment.
 *
 * @return boolean
 */
public function getFoo()
{
    return true;
}
EOF;
        $method = new Stagehand_PHP_Class_Method($name);
        $method->setCode('return true;');
        $method->setDocComment($docComment);
        $this->assertEquals($method->getDocComment(), $formatedDocComment);
        $this->assertEquals($method->render(), $result);
        $docComment = "/**\n * A tests for DocComment.\n *\n * @return boolean\n */";
        $method->setDocComment($docComment, true);
        $this->assertEquals($method->getDocComment(), $formatedDocComment);
        $this->assertEquals($method->render(), $result);
    }