public function testVisitFunction()
 {
     $writer = new Writer();
     $function = new PhpFunction('foo');
     $function->addParameter(PhpParameter::create('a'))->addParameter(PhpParameter::create('b'))->setBody($writer->writeln('if ($a === $b) {')->indent()->writeln('throw new \\InvalidArgumentException(\'$a is not allowed to be the same as $b.\');')->outdent()->write("}\n\n")->write('return $b;')->getContent());
     $visitor = new DefaultVisitor();
     $visitor->visitFunction($function);
     $this->assertEquals($this->getContent('a_b_function.php'), $visitor->getContent());
 }
    public function testFromReflection()
    {
        $doc = new Docblock('/**
 * Makes foo with bar
 * 
 * @param string $baz
 * @return string
 */');
        $function = new PhpFunction('wurst');
        $function->addParameter(PhpParameter::create('baz')->setDefaultValue(null)->setType('string'))->setBody('return \'wurst\';')->setDocblock($doc)->setDescription($doc->getShortDescription())->setLongDescription($doc->getLongDescription());
        $this->assertEquals($function, PhpFunction::fromReflection(new \ReflectionFunction('wurst')));
    }