示例#1
0
 public function testPropertyDefaultValueCanHandleUnquotedString()
 {
     $propDefaultValue = new PHP\PHPPropertyValue();
     $propDefaultValue->setValue('PHP_EOL');
     $propDefaultValue->setType('constant');
     $this->assertEquals('PHP_EOL;', $propDefaultValue->generate());
     $propDefaultValue = new PHP\PHPPropertyValue();
     $propDefaultValue->setValue(5);
     $this->assertEquals('5;', $propDefaultValue->generate());
     $propDefaultValue = new PHP\PHPPropertyValue();
     $propDefaultValue->setValue(5.25);
     $this->assertEquals('5.25;', $propDefaultValue->generate());
 }
示例#2
0
 /**
  * @dataProvider dataSetTypeSetValueGenerate
  * @param string $type
  * @param mixed $value
  * @param string $code
  */
 public function testSetTypeSetValueGenerate($type, $value, $code)
 {
     $defaultValue = new PHP\PHPPropertyValue();
     $defaultValue->setType($type);
     $defaultValue->setValue($value);
     $this->assertEquals($type, $defaultValue->getType());
     $this->assertEquals($code, $defaultValue->generate());
 }