private function assertionsForHTMLConcept($response, $prefLabel, $altLabel, $hiddenLabel, $lang, $definition, $notation, $topConceptOf, $inScheme) { $dom = new Zend_Dom_Query(); $dom->setDocumentHtml($response->getBody()); //does not work because of . : $results1 = $dom->query('dl > dd > a[href="http://hdl.handle.net/11148/CCR_C-4046_944cc750-1c29-ccf0-fb68-4d00385d7b42"]'); $resultsUri1 = $dom->query('dl > dt'); $propertyName = RequestResponse::getByIndex($resultsUri1, 2)->nodeValue; $this->AssertEquals("SKOS Class:", $propertyName); $resultsUri2 = $dom->query('dl > dd > a'); $property = RequestResponse::getByIndex($resultsUri2, 2); $this->AssertEquals("http://www.w3.org/2004/02/skos/core#Concept", $property->nodeValue); $this->AssertEquals("http://www.w3.org/2004/02/skos/core#Concept", $property->getAttribute('href')); $h3s = $dom->query('h3'); $inSchemeName = RequestResponse::getByIndex($h3s, 0)->nodeValue; $this->AssertEquals("inScheme", $inSchemeName); $lexLabels = RequestResponse::getByIndex($h3s, 2)->nodeValue; $this->AssertEquals("LexicalLabels", $lexLabels); $h4s = $dom->query('h4'); $altLabelName = RequestResponse::getByIndex($h4s, 2)->nodeValue; $this->AssertEquals("skos:http://www.w3.org/2004/02/skos/core#altLabel", $altLabelName); $prefLabelName = RequestResponse::getByIndex($h4s, 4)->nodeValue; $this->AssertEquals("skos:http://www.w3.org/2004/02/skos/core#prefLabel", $prefLabelName); $notationName = RequestResponse::getByIndex($h4s, 5)->nodeValue; $this->AssertEquals("skos:http://www.w3.org/2004/02/skos/core#notation", $notationName); $list = $dom->query('ul > li > a > span'); $prefLabelVal = RequestResponse::getByIndex($list, 4)->nodeValue; $this->AssertEquals($prefLabel, $prefLabelVal); }
private function assertionsHTMLAllInstitutions($response) { $dom = new Zend_Dom_Query(); $dom->setDocumentHTML($response->getBody()); $institutions = $dom->query('ul > li > a > strong'); // fetches institutions and formats together $this->AssertEquals(NUMBER_INSTITUTIONS, count($institutions)); for ($i = 0; $i < NUMBER_INSTITUTIONS; $i++) { $title = RequestResponse::getByIndex($institutions, $i)->nodeValue; if ($i === 0) { $this->AssertEquals(INSTITUTION_NAME, $title); } else { $this->AssertEquals(1, 0); } } $list = $dom->query('ul > li > a'); // fetches institutions and formats together $this->AssertEquals(3, count($list) - NUMBER_INSTITUTIONS); }
private function assertionsHTMLCollection(Zend_Dom_Query $dom, $i) { $institution = $dom->query('dl > dd > a'); $schemata = $dom->query('ul > li > a'); // also grabs 3 items for formats if ($i == 0) { $this->AssertEquals(NUMBER_INSTITUTIONS, count($institution)); $title = RequestResponse::getByIndex($institution, 0)->nodeValue; $this->AssertEquals(INSTITUTION_NAME, $title); $this->AssertEquals(NUMBER_SCHEMATA, count($schemata) - 3); } }