Пример #1
0
 /**
  * Custom properties
  */
 public function testCustomProperty()
 {
     $oProperties = new DocInfo();
     $oProperties->setCustomProperty('key1', null);
     $oProperties->setCustomProperty('key2', true);
     $oProperties->setCustomProperty('key3', 3);
     $oProperties->setCustomProperty('key4', 4.4);
     $oProperties->setCustomProperty('key5', 'value5');
     $this->assertEquals(DocInfo::PROPERTY_TYPE_STRING, $oProperties->getCustomPropertyType('key1'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_BOOLEAN, $oProperties->getCustomPropertyType('key2'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_INTEGER, $oProperties->getCustomPropertyType('key3'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_FLOAT, $oProperties->getCustomPropertyType('key4'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_STRING, $oProperties->getCustomPropertyType('key5'));
     $this->assertNull($oProperties->getCustomPropertyType('key6'));
     $this->assertNull($oProperties->getCustomPropertyValue('key1'));
     $this->assertTrue($oProperties->getCustomPropertyValue('key2'));
     $this->assertEquals(3, $oProperties->getCustomPropertyValue('key3'));
     $this->assertEquals(4.4, $oProperties->getCustomPropertyValue('key4'));
     $this->assertEquals('value5', $oProperties->getCustomPropertyValue('key5'));
     $this->assertNull($oProperties->getCustomPropertyValue('key6'));
     $this->assertTrue($oProperties->isCustomPropertySet('key5'));
     // todo: change to assertNotTrue when got upgraded to PHPUnit 4.x
     $this->assertEquals(false, $oProperties->isCustomPropertySet('key6'));
     $this->assertEquals(array('key1', 'key2', 'key3', 'key4', 'key5'), $oProperties->getCustomProperties());
 }
Пример #2
0
 /**
  * Custom properties
  */
 public function testCustomProperty()
 {
     $oProperties = new DocInfo();
     $oProperties->setCustomProperty('key1', null);
     $oProperties->setCustomProperty('key2', true);
     $oProperties->setCustomProperty('key3', 3);
     $oProperties->setCustomProperty('key4', 4.4);
     $oProperties->setCustomProperty('key5', 'value5');
     $this->assertEquals(DocInfo::PROPERTY_TYPE_STRING, $oProperties->getCustomPropertyType('key1'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_BOOLEAN, $oProperties->getCustomPropertyType('key2'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_INTEGER, $oProperties->getCustomPropertyType('key3'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_FLOAT, $oProperties->getCustomPropertyType('key4'));
     $this->assertEquals(DocInfo::PROPERTY_TYPE_STRING, $oProperties->getCustomPropertyType('key5'));
     $this->assertEquals(null, $oProperties->getCustomPropertyType('key6'));
     $this->assertEquals(null, $oProperties->getCustomPropertyValue('key1'));
     $this->assertEquals(true, $oProperties->getCustomPropertyValue('key2'));
     $this->assertEquals(3, $oProperties->getCustomPropertyValue('key3'));
     $this->assertEquals(4.4, $oProperties->getCustomPropertyValue('key4'));
     $this->assertEquals('value5', $oProperties->getCustomPropertyValue('key5'));
     $this->assertEquals(null, $oProperties->getCustomPropertyValue('key6'));
     $this->assertEquals(true, $oProperties->isCustomPropertySet('key5'));
     $this->assertEquals(false, $oProperties->isCustomPropertySet('key6'));
     $this->assertEquals(array('key1', 'key2', 'key3', 'key4', 'key5'), $oProperties->getCustomProperties());
 }