Exemplo n.º 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());
 }
Exemplo n.º 2
0
 /**
  * @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 Php\PhpPropertyValue();
     $defaultValue->setType("bogus");
     $defaultValue->setValue($value);
     $this->assertEquals($code, $defaultValue->generate());
 }