Exemplo n.º 1
0
    /**
     * @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);
    }