-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick
committed
Jan 5, 2016
1 parent
f41f041
commit 070a9d0
Showing
6 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
class CultureFeed_Cdb_Item_ActorTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->actor = new CultureFeed_Cdb_Item_Actor(); | ||
} | ||
|
||
/** | ||
* @param $fileName | ||
* @param $cdbScheme | ||
* @return SimpleXMLElement | ||
*/ | ||
public function loadSample($fileName, $cdbScheme = '3.2') | ||
{ | ||
$sampleDir = __DIR__ . '/samples/ActorTest/cdbxml-' . $cdbScheme . '/'; | ||
$filePath = $sampleDir . $fileName; | ||
|
||
$xml = simplexml_load_file( | ||
$filePath, | ||
'SimpleXMLElement', | ||
0, | ||
'http://www.cultuurdatabank.com/XMLSchema/CdbXSD/' . $cdbScheme . '/FINAL' | ||
); | ||
|
||
return $xml; | ||
} | ||
|
||
/** | ||
* Integration test for parsing cdbxml version 3.2 | ||
*/ | ||
public function testParseCdbXml() | ||
{ | ||
$xml = $this->loadSample('actor.xml'); | ||
$actor = CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xml); | ||
|
||
$this->assertInstanceOf('CultureFeed_Cdb_Item_Actor', $actor); | ||
|
||
$this->assertEquals('a761b5d6-0349-4dd4-a39f-c471b0fb64e8', $actor->getCdbId()); | ||
$this->assertEquals('SKB Import:Organisation_488', $actor->getExternalId()); | ||
$this->assertEquals('2011-01-03T10:39:18', $actor->getAvailableFrom()); | ||
$this->assertEquals('2100-01-01T00:00:00', $actor->getAvailableTo()); | ||
$this->assertEquals('admin ferranti', $actor->getCreatedBy()); | ||
$this->assertEquals('2010-01-19T04:59:14', $actor->getCreationDate()); | ||
$this->assertEquals('2011-01-03T10:39:18', $actor->getLastUpdated()); | ||
$this->assertEquals('soetkin.vanassche@cultuurnet.be', $actor->getLastUpdatedBy()); | ||
$this->assertEquals('Invoerders Algemeen ', $actor->getOwner()); | ||
} | ||
|
||
/** | ||
* @expectedException CultureFeed_Cdb_ParseException | ||
* @expectedExceptionMessage Categories missing for actor element | ||
*/ | ||
public function testParseCdbXmlWithoutCategories() | ||
{ | ||
$xml = $this->loadSample('actor-no-categories.xml'); | ||
CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xml); | ||
} | ||
|
||
/** | ||
* @expectedException CultureFeed_Cdb_ParseException | ||
* @expectedExceptionMessage Actordetails missing for actor element | ||
*/ | ||
public function testParseCdbXmlWithoutActorDetails() | ||
{ | ||
$xml = $this->loadSample('actor-no-actordetails.xml'); | ||
CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xml); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/CultureFeed/Cdb/Item/samples/ActorTest/cdbxml-3.2/actor-no-actordetails.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actor xmlns:cdb="http://www.cultuurdatabank.com/XMLSchema/CdbXSD/3.2/FINAL" asset="true" availablefrom="2011-01-03T10:39:18" availableto="2100-01-01T00:00:00" createdby="admin ferranti" creationdate="2010-01-19T04:59:14" cdbid="a761b5d6-0349-4dd4-a39f-c471b0fb64e8" externalid="SKB Import:Organisation_488" lastupdated="2011-01-03T10:39:18" lastupdatedby="soetkin.vanassche@cultuurnet.be" owner="Invoerders Algemeen "> | ||
<actordetails/> | ||
<categories> | ||
<category catid="8.15.0.0.0" type="actortype">Locatie</category> | ||
<category catid="8.11.0.0.0" type="actortype">Organisator(en)</category> | ||
<category catid="6.4.0.0.0" type="publicscope">Internationaal</category> | ||
<category catid="8.3.0.0.0" type="actortype">Museum</category> | ||
</categories> | ||
<contactinfo> | ||
<address> | ||
<physical> | ||
<city>Brussel</city> | ||
<country>BE</country> | ||
<gis> | ||
<xcoordinate>4.358241</xcoordinate> | ||
<ycoordinate>50.841680</ycoordinate> | ||
</gis> | ||
<housenr>3</housenr> | ||
<street>Regentschapsstr.</street> | ||
<zipcode>1000</zipcode> | ||
</physical> | ||
</address> | ||
<mail>info@fine-arts-museum.be</mail> | ||
<phone type="phone">02-508.32.11</phone> | ||
<phone type="fax">02-508.32.32</phone> | ||
<url main="true">http://www.fine-arts-museum.be</url> | ||
</contactinfo> | ||
</actor> |
43 changes: 43 additions & 0 deletions
43
tests/CultureFeed/Cdb/Item/samples/ActorTest/cdbxml-3.2/actor-no-categories.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actor xmlns:cdb="http://www.cultuurdatabank.com/XMLSchema/CdbXSD/3.2/FINAL" asset="true" availablefrom="2011-01-03T10:39:18" availableto="2100-01-01T00:00:00" createdby="admin ferranti" creationdate="2010-01-19T04:59:14" cdbid="a761b5d6-0349-4dd4-a39f-c471b0fb64e8" externalid="SKB Import:Organisation_488" lastupdated="2011-01-03T10:39:18" lastupdatedby="soetkin.vanassche@cultuurnet.be" owner="Invoerders Algemeen "> | ||
<actordetails> | ||
<actordetail lang="nl"> | ||
<media> | ||
<file creationdate="3/01/2011 10:38:42" main="true"> | ||
<copyright>KMSKB - MRBAB 2001</copyright> | ||
<filename>35a1c617-0685-49a1-af8f-17b93bbe749d.jpg</filename> | ||
<filetype>jpeg</filetype> | ||
<hlink> | ||
//test-media.uitdatabank.be/images/20100119/35a1c617-0685-49a1-af8f-17b93bbe749d.jpg | ||
</hlink> | ||
</file> | ||
</media> | ||
<shortdescription> | ||
In de Koninklijke Musea voor Schone Kunsten van België, die twee eeuwen oud zijn, worden ongeveer twintigduizend schilderijen, sculpturen en tekeningen bewaard. Ze zijn gevestigd in Brussel en bestaan uit het Museum voor Oude Kunst (15de-18de eeuw), het Museum voor Moderne Kunst (19de-20ste eeuw), het Wiertzmuseum, het Meuniermuseum en het Musée Magritte Museum. | ||
</shortdescription> | ||
<title> | ||
Koninklijke Musea voor Schone Kunsten van België (KMSKB) | ||
</title> | ||
</actordetail> | ||
</actordetails> | ||
<categories /> | ||
<contactinfo> | ||
<address> | ||
<physical> | ||
<city>Brussel</city> | ||
<country>BE</country> | ||
<gis> | ||
<xcoordinate>4.358241</xcoordinate> | ||
<ycoordinate>50.841680</ycoordinate> | ||
</gis> | ||
<housenr>3</housenr> | ||
<street>Regentschapsstr.</street> | ||
<zipcode>1000</zipcode> | ||
</physical> | ||
</address> | ||
<mail>info@fine-arts-museum.be</mail> | ||
<phone type="phone">02-508.32.11</phone> | ||
<phone type="fax">02-508.32.32</phone> | ||
<url main="true">http://www.fine-arts-museum.be</url> | ||
</contactinfo> | ||
</actor> |
48 changes: 48 additions & 0 deletions
48
tests/CultureFeed/Cdb/Item/samples/ActorTest/cdbxml-3.2/actor.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actor xmlns:cdb="http://www.cultuurdatabank.com/XMLSchema/CdbXSD/3.2/FINAL" asset="true" availablefrom="2011-01-03T10:39:18" availableto="2100-01-01T00:00:00" createdby="admin ferranti" creationdate="2010-01-19T04:59:14" cdbid="a761b5d6-0349-4dd4-a39f-c471b0fb64e8" externalid="SKB Import:Organisation_488" lastupdated="2011-01-03T10:39:18" lastupdatedby="soetkin.vanassche@cultuurnet.be" owner="Invoerders Algemeen "> | ||
<actordetails> | ||
<actordetail lang="nl"> | ||
<media> | ||
<file creationdate="3/01/2011 10:38:42" main="true"> | ||
<copyright>KMSKB - MRBAB 2001</copyright> | ||
<filename>35a1c617-0685-49a1-af8f-17b93bbe749d.jpg</filename> | ||
<filetype>jpeg</filetype> | ||
<hlink> | ||
//test-media.uitdatabank.be/images/20100119/35a1c617-0685-49a1-af8f-17b93bbe749d.jpg | ||
</hlink> | ||
</file> | ||
</media> | ||
<shortdescription> | ||
In de Koninklijke Musea voor Schone Kunsten van België, die twee eeuwen oud zijn, worden ongeveer twintigduizend schilderijen, sculpturen en tekeningen bewaard. Ze zijn gevestigd in Brussel en bestaan uit het Museum voor Oude Kunst (15de-18de eeuw), het Museum voor Moderne Kunst (19de-20ste eeuw), het Wiertzmuseum, het Meuniermuseum en het Musée Magritte Museum. | ||
</shortdescription> | ||
<title> | ||
Koninklijke Musea voor Schone Kunsten van België (KMSKB) | ||
</title> | ||
</actordetail> | ||
</actordetails> | ||
<categories> | ||
<category catid="8.15.0.0.0" type="actortype">Locatie</category> | ||
<category catid="8.11.0.0.0" type="actortype">Organisator(en)</category> | ||
<category catid="6.4.0.0.0" type="publicscope">Internationaal</category> | ||
<category catid="8.3.0.0.0" type="actortype">Museum</category> | ||
</categories> | ||
<contactinfo> | ||
<address> | ||
<physical> | ||
<city>Brussel</city> | ||
<country>BE</country> | ||
<gis> | ||
<xcoordinate>4.358241</xcoordinate> | ||
<ycoordinate>50.841680</ycoordinate> | ||
</gis> | ||
<housenr>3</housenr> | ||
<street>Regentschapsstr.</street> | ||
<zipcode>1000</zipcode> | ||
</physical> | ||
</address> | ||
<mail>info@fine-arts-museum.be</mail> | ||
<phone type="phone">02-508.32.11</phone> | ||
<phone type="fax">02-508.32.32</phone> | ||
<url main="true">http://www.fine-arts-museum.be</url> | ||
</contactinfo> | ||
</actor> |