xml = new DomDocument("1.0", "UTF-8"); $xml = ' '.date('Y-m-d\TH:i:s\Z').' '; $this->xml->loadXML($xml); $this->uri = 'test.oai_pmh'; } function testIdentify() { $xml = 'test.oai_pmh OAI2 PMH Test http://198.199.108.242/~neis/oai_pmh/oai2.php 2.0 danielneis@gmail.com 2013-01-01T12:00:00Z no YYYY-MM-DDThh:mm:ssZ '; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'Identify'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testIdentifyIllegalParameter() { $verb = 'Identify'; $args = array('test' => 'test'); } function testListMetadataFormats() { $xml = 'test.oai_pmh rif http://services.ands.org.au/sandbox/orca/schemata/registryObjects.xsd http://ands.org.au/standards/rif-cs/registryObjects/ oai_dc http://www.openarchives.org/OAI/2.0/oai_dc.xsd http://www.openarchives.org/OAI/2.0/oai_dc/ '; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'ListMetadataFormats'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testListMetadataFormatsIdentifier() { $verb = 'ListMetadataFormats'; $args = array('identifier' => 'a.b.c'); } function testListMetadataFormatsIllegalIdentifier() { $verb = 'ListMetadataFormats'; $args = array('identifier' => 'illegalIdentifier'); } function testListSets() { $xml = 'test.oai_pmh class:collection Collections math Mathematics phys Physics phdthesis PHD Thesis This set contains metadata describing electronic music recordings made during the 1950ies '; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'ListSets'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testListSetsResumptionToken() { $verb = 'ListSets'; $args = array('resumptionToken' => '????'); } function testListIdentifiersMetadataPrefix() { $xml = 'test.oai_pmh
dev.testing.pmh 2013-05-14T18:41:00Z class:activity
'; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testListIdentifiers() { $args = array('verb' => 'ListIdentifiers'); } function testListIdentifiersResumptionToken() { $args = array('verb' => 'ListIdentifiers', 'resumptionToken' => '????'); } function testListIdentifiersResumptionTokenMetadataPrefix() { $args = array('verb' => 'ListIdentifiers', 'resumptionToken' => '????', 'metadataPrefix' => 'oai_dc'); } function testListIdentifiersMetadataPrefixSet() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'set' => 'someSet'); } function testListIdentifiersMetadataPrefixFromUntil() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'from' => '2000-01-01', 'until' => '2000-01-01'); } function testListIdentifiersMetadataPrefixSetFromUntil() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'set' => '????', 'from' => '2000-01-01', 'until' => '2000-01-01'); } function testListIdentifiersMetadataPrefixIllegalSetIllegalFromUntil() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'set' => 'really_wrong_set', 'from' => 'some_random_from', 'until' => 'some_random_until'); } function testListIdentifiersDifferentGranularity() { $args = array('verb' => 'ListIdentifiers', 'resumptionToken' => '????', 'metadataPrefix' => 'oai_dc', 'from' => '2000-01-01', 'until' => '2000-01-01T00:00:00Z'); } function testListIdentifiersFromGreaterThanUntil() { $args = array('verb' => 'ListIdentifiers', 'resumptionToken' => '????', 'metadataPrefix' => 'oai_dc', 'from' => '2013-01-01', 'until' => '2000-01-01T00:00:00Z'); } function testListIdentifiersIllegalMetadataPrefix() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'illegalPrefix'); } function testListIdentifiersMetadataPrefixMetadataPrefix() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'metadataPrefix' => 'oai_dc'); } function testListIdentifiersIllegalResumptionToken() { $args = array('verb' => 'ListIdentifiers', 'resumptionToken' => 'illegalToken'); } function testListIdentifiersMetadataPrefixFrom() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'from' => '2001-01-01T00:00:00Z'); } function testListIdentifiersMetadataPrefixFromYear() { $args = array('verb' => 'ListIdentifiers', 'metadataPrefix' => 'oai_dc', 'from' => '2001'); } function testListRecords() { $verb = 'ListRecords'; $args = array('verb' => 'ListRecords'); } function testListRecordsMetadataPrefix() { $xml = 'test.oai_pmh
dev.testing.pmh 2013-05-14T18:11:00Z class:activity
Testing records Neis
'; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'ListRecords', 'metadataPrefix' => 'oai_dc'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testListRecordsMetadataPrefixFromUntil() { $args = array('verb' => 'ListRecords', 'metadataPrefix' => 'oai_dc', 'from' => '2000-01-01', 'until' => '2000-01-01'); } function testListRecordsResumptionToken() { $args = array('verb' => 'ListRecords', 'resumptionToken' => '????'); } function testListRecordsMetadataPrefixIllegalSetIllegalFromUntil() { $args = array('verb' => 'ListRecords', 'metadataPrefix' => 'oai_dc', 'set' => 'illegalSet', 'from' => 'some_random_from', 'until' => 'some_random_until'); } function testListRecordsDifferentGranularity() { $args = array('verb' => 'ListRecords', 'resumptionToken' => '????', 'metadataPrefix' => 'oai_dc', 'from' => '2000-01-01', 'until' => '2000-01-01T00:00:00Z'); } function testListRecordsUntilBeforeEarliestDatestamp() { $args = array('verb' => 'ListRecords', 'metadataPrefix' => 'oai_dc', 'until' => '1969-01-01T00:00:00Z'); } function testListRecordsIllegalResumptionToken() { $args = array('verb' => 'ListRecords', 'resumptionToken' => 'illegalToken'); } function testGetRecord() { $args = array('verb' => 'GetRecord'); } function testGetRecordIdentifier() { $args = array('verb' => 'GetRecord', 'identifier' => 'a.b.c'); } function testGetRecordIdentifierMetadataPrefix() { $xml = 'test.oai_pmh
a.b.c 2013-05-14T18:08:00Z class:activity
Testing records Neis
'; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'GetRecord', 'identifier' => 'a.b.c', 'metadataPrefix' => 'oai_dc'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testGetRecordIdentifierIllegalMetadataPrefix() { $args = array('verb' => 'GetRecord', 'identifier' => 'a.b.c', 'metadataPrefix' => 'illegalPrefix'); } function testGetRecordMetadataPrefix() { $args = array('verb' => 'GetRecord', 'metadataPrefix' => 'oai_dc'); } function testGetRecordIllegalIdentifierMetadataPrefix() { $args = array('verb' => 'GetRecord', 'identifier' => 'illegalID', 'metadataPrefix' => 'oai_dc'); } function testGetRecordInvalidIdentifierMetadataPrefix() { $args = array('verb' => 'GetRecord', 'identifier' => 'invalidID', 'metadataPrefix' => 'oai_dc'); } function testIllegalVerb() { $xml = 'test.oai_pmh Illegal OAI verb'; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array('verb' => 'IllegalVerb'); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } function testNoVerb() { $xml = 'test.oai_pmh Illegal OAI verb'; $f = $this->xml->createDocumentFragment(); $f->appendXML($xml); $this->xml->documentElement->appendChild($f); $return = true; $uri = $this->uri; $args = array(); $response = require('oai2.php'); $this->assertEqualXMLStructure($this->xml->firstChild, $response->firstChild); } }