public function testPropertyDefaultValueCanHandleUnquotedString() { $propDefaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue(); $propDefaultValue->setValue('PHP_EOL'); $propDefaultValue->setType('constant'); $this->assertEquals('PHP_EOL;', $propDefaultValue->generate()); $propDefaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue(); $propDefaultValue->setValue(5); $this->assertEquals('5;', $propDefaultValue->generate()); $propDefaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue(); $propDefaultValue->setValue(5.25); $this->assertEquals('5.25;', $propDefaultValue->generate()); }
/** * @dataProvider dataSetTypeSetValueGenerate * @param string $type * @param mixed $value * @param string $code */ public function testSetBogusTypeSetValueGenerateUseAutoDetection($type, $value, $code) { if ($type == 'constant') { return; // constant can only be detected explicitly } $defaultValue = new Zend_CodeGenerator_Php_Property_DefaultValue(); $defaultValue->setType("bogus"); $defaultValue->setValue($value); $this->assertEquals($code, $defaultValue->generate()); }