Esempio n. 1
0
 /**
  * Convert property
  */
 public function testConvertProperty()
 {
     $this->assertEquals('', DocInfo::convertProperty('a', 'empty'));
     $this->assertNull(DocInfo::convertProperty('a', 'null'));
     $this->assertEquals(8, DocInfo::convertProperty('8', 'int'));
     $this->assertEquals(8, DocInfo::convertProperty('8.3', 'uint'));
     $this->assertEquals(8.300000000000001, DocInfo::convertProperty('8.3', 'decimal'));
     $this->assertEquals('8.3', DocInfo::convertProperty('8.3', 'lpstr'));
     $this->assertEquals(strtotime('10/11/2013'), DocInfo::convertProperty('10/11/2013', 'date'));
     $this->assertTrue(DocInfo::convertProperty('true', 'bool'));
     // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x
     $this->assertEquals(false, DocInfo::convertProperty('1', 'bool'));
     $this->assertEquals('1', DocInfo::convertProperty('1', 'array'));
     $this->assertEquals('1', DocInfo::convertProperty('1', ''));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_INTEGER, DocInfo::convertPropertyType('int'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_INTEGER, DocInfo::convertPropertyType('uint'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_FLOAT, DocInfo::convertPropertyType('decimal'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_STRING, DocInfo::convertPropertyType('lpstr'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_DATE, DocInfo::convertPropertyType('date'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_BOOLEAN, DocInfo::convertPropertyType('bool'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_UNKNOWN, DocInfo::convertPropertyType('array'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_UNKNOWN, DocInfo::convertPropertyType(''));
 }