예제 #1
0
    /**
     * @group ZF-7268
     */
    public function testDefaultValueGenerationDoesNotIncludeTrailingSemicolon()
    {
        $method = new Php\PhpMethod(array(
            'name' => 'setOptions',
        ));
        $default = new Php\PhpParameterDefaultValue();
        $default->setValue(array());

        $param   = new Php\PhpParameter(array(
            'name' => 'options',
            'type' => 'array',
        ));
        $param->setDefaultValue($default);

        $method->setParameter($param);
        $generated = $method->generate();
        $this->assertRegexp('/array \$options = array\(\)\)/', $generated, $generated);
    }
예제 #2
0
    /**
     * @group ZF-7205
     */
    public function testMethodCanHaveDocblock()
    {
        $codeGenProperty = new Php\PhpMethod(array('name' => 'someFoo', 'static' => true, 'visibility' => 'protected', 'docblock' => '@var string $someVal This is some val'));
        $expected = <<<EOS
    /**
     * @var string \$someVal This is some val
     */
    protected static function someFoo()
    {
    }

EOS;
        $this->assertEquals($expected, $codeGenProperty->generate());
    }