Ejemplo n.º 1
0
 public function testGenerateIsCorrect()
 {
     $this->_parameter->setType('Foo');
     $this->_parameter->setName('bar');
     $this->_parameter->setDefaultValue(15);
     $this->assertEquals('Foo $bar = 15', $this->_parameter->generate());
     $this->_parameter->setDefaultValue('foo');
     $this->assertEquals('Foo $bar = \'foo\';', $this->_parameter->generate());
 }
Ejemplo n.º 2
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);
    }