entry = new Zend_Gdata_Health_ProfileEntry(); $this->entryText = file_get_contents( 'Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample.xml', true); } public function testEmptyProfileEntry() { $this->assertTrue(is_array($this->entry->extensionElements)); $this->assertTrue(count($this->entry->extensionElements) == 0); $this->assertTrue($this->entry->getCcr() === null); } public function testEmptyProfileEntryToAndFromStringShouldMatch() { $this->entry->transferFromXML($this->entryText); $entryXml = $this->entry->saveXML(); $newProfileEntry = new Zend_Gdata_Health_ProfileEntry(); $newProfileEntry->transferFromXML($entryXml); $newProfileEntryXML = $newProfileEntry->saveXML(); $this->assertTrue($entryXml == $newProfileEntryXML); } public function testGetAllCcrFromProfileEntry() { $this->entry->transferFromXML($this->entryText); $ccr = $this->entry->getCcr(); $this->assertTrue($ccr instanceof Zend_Gdata_Health_Extension_Ccr); $this->assertXmlStringEqualsXmlString(file_get_contents( 'Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_just_ccr.xml', true), $ccr->getXML()); } public function testSetCcrInProfileEntry() { $this->entry->transferFromXML($this->entryText); $ccrXML = file_get_contents( 'Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_just_ccr.xml', true); $ccrElement = $this->entry->setCcr($ccrXML); $this->assertTrue($ccrElement instanceof Zend_Gdata_Health_Extension_Ccr); $this->assertXmlStringEqualsXmlString(file_get_contents( 'Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_just_ccr.xml', true), $this->entry->getCcr()->getXML()); } /* * These functions test the magic _call method within Zend_Gdata_Health_Extension_Ccr */ public function testGetCcrMedicationsFromProfileEntry() { $this->entry->transferFromXML($this->entryText); $medications = $this->entry->getCcr()->getMedications(); $this->assertEquals(1, count($medications)); foreach ($medications as $med) { $this->assertXmlStringEqualsXmlString(file_get_contents( "Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_medications_all.xml", true), $med->ownerDocument->saveXML($med)); } } public function testGetCcrConditionsFromProfileEntry() { $this->entry->transferFromXML($this->entryText); $problems = $this->entry->getCcr()->getProblems(); $conditions = $this->entry->getCcr()->getConditions(); $this->assertEquals($problems, $conditions); $this->assertEquals(1, count($conditions)); foreach ($conditions as $index => $condition) { $this->assertXmlStringEqualsXmlString(file_get_contents( "Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_condition_all.xml", true), $condition->ownerDocument->saveXML($condition)); } } public function testGetCcrAllerigiesFromProfileEntry() { $this->entry->transferFromXML($this->entryText); $allergies = $this->entry->getCcr()->getAllergies(); $alerts = $this->entry->getCcr()->getAlerts(); $this->assertEquals($allergies, $alerts); $this->assertEquals(1, count($alerts)); foreach ($alerts as $index => $alert) { $this->assertXmlStringEqualsXmlString(file_get_contents( "Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_allergy_all.xml", true), $alert->ownerDocument->saveXML($alert)); } } public function testGetCcrLabResultsFromProfileEntry() { $this->entry->transferFromXML($this->entryText); $labresults = $this->entry->getCcr()->getLabResults(); $results = $this->entry->getCcr()->getResults(); $this->assertEquals($labresults, $results); $this->assertEquals(1, count($results)); foreach ($results as $index => $result) { $this->assertXmlStringEqualsXmlString(file_get_contents( "Zend/Gdata/Health/_files/TestDataHealthProfileEntrySample_results0.xml", true), $result->ownerDocument->saveXML($result)); } } }