/**
  *
  * checking CIOnlineResources_WebAddresses,
  * CIOnlineResources_HasFirstWebAddress and CIOnlineResources_FirstWebAddress
  *
  */
 function testCIOnlineResources_WebAddresses()
 {
     MDMetadata::set_online_resource_web_url_filter(array('WWW:LINK-1.0-http--link'));
     $metadata = new MDMetadata();
     $item = $this->getTestItem();
     $metadata->loadData($item);
     //check the initial values
     $adresses = $metadata->CIOnlineResources_WebAddresses();
     //We should have 1 entry with the correct protocol 'WWW:LINK-1.0-http--link'
     $this->assertEquals($adresses->Count(), 1, ' one initial value');
     $address = $adresses->First();
     $this->assertEquals($address->CIOnlineLinkage, 'http://www.mysite.com', 'initial linkage value');
     $this->assertEquals($address->CIOnlineProtocol, 'WWW:LINK-1.0-http--link', 'initial protocol value');
     // getting the first entry via the methods
     $this->assertTrue($metadata->CIOnlineResources_HasFirstWebAddress(), 'checking initial value with CIOnlineResources_HasFirstWebAddress');
     $address = $metadata->CIOnlineResources_FirstWebAddress();
     $this->assertEquals($address->CIOnlineLinkage, 'http://www.mysite.com', 'getting initial url via CIOnlineResources_FirstWebAddress');
     // now the same with invalid adresses;
     $address->CIOnlineLinkage = 'about:config';
     $address->CIOnlineProtocol = 'SomeInvalidProtocol';
     $adresses = $metadata->CIOnlineResources_WebAddresses();
     //We should have an empty DataObjectSet
     $this->assertTrue(is_a($adresses, "DataObjectSet"), 'get a DataObjectSet on invalid data');
     //We should have 0 entry with the correct protocol 'WWW:LINK-1.0-http--link'
     $this->assertEquals($adresses->Count(), 0, 'Empty DataObjectSet due invalid data');
     // testing the methods
     $this->assertFalse($metadata->CIOnlineResources_HasFirstWebAddress(), 'CIOnlineResources_HasFirstWebAddress on empty DataObjectSet');
     $address = $metadata->CIOnlineResources_FirstWebAddress();
     $this->assertEquals($address, null, 'CIOnlineResources_FirstWebAddress on empty DataObjectSet');
     // doing the same without CIOnlineResources
     $metadata->CIOnlineResources = null;
     $adresses = $metadata->CIOnlineResources_WebAddresses();
     //We should have an empty DataObjectSet
     $this->assertTrue(is_a($adresses, "DataObjectSet"), 'get a DataObjectSet on no data');
     //We should have 0 entry with the correct protocol 'WWW:LINK-1.0-http--link'
     $this->assertEquals($adresses->Count(), 0);
     // testing the methods
     $this->assertFalse($metadata->CIOnlineResources_HasFirstWebAddress(), 'CIOnlineResources_HasFirstWebAddress on no data');
     $address = $metadata->CIOnlineResources_FirstWebAddress();
     $this->assertEquals($address, null, 'CIOnlineResources_FirstWebAddress on no data');
 }