Exemplo n.º 1
0
    /**
     * @group ZF-11513
     */
    public function testAllowsClassConstantToHaveSameNameAsClassProperty()
    {
        $const = new Php\PhpProperty();
        $const->setName('name')->setDefaultValue('constant')->setConst(true);

        $property = new Php\PhpProperty();
        $property->setName('name')->setDefaultValue('property');

        $codeGenClass = new Php\PhpClass();
        $codeGenClass->setName('My_Class')->setProperties(array($const, $property));

        $expected = <<<CODE
class My_Class
{

    const name = 'constant';

    public \$name = 'property';


}

CODE;
        $this->assertEquals( $expected, $codeGenClass->generate() );
    }
Exemplo n.º 2
0
 /**
  * @group ZF-7361
  */
 public function testHasProperty()
 {
     $property = new Php\PhpProperty();
     $property->setName('propertyOne');
     $codeGenClass = new Php\PhpClass();
     $codeGenClass->setProperty($property);
     $this->assertTrue($codeGenClass->hasProperty('propertyOne'));
 }
Exemplo n.º 3
0
 /**
  * @group ZF-8849
  */
 public function testZF8849()
 {
     $property = new Php\PhpProperty(array('defaultValue' => array('value' => 1.337, 'type' => 'string'), 'name' => 'ZF8849', 'const' => true));
     $this->assertEquals("    const ZF8849 = '1.337';", $property->generate());
 }