public function testGetProfileFeedByQuery() { $this->setupProfileID(); $profileID = $this->health->getProfileID(); // with direct query string $feed1 = $this->health->getHealthProfileFeed("https://www.google.com/health/feeds/profile/ui/{$profileID}?digest=true"); $this->assertTrue($feed1 instanceof Zend_Gdata_Health_ProfileFeed); $this->assertTrue(count($feed1->entry) === 1, 'digest=true, expected a single <entry> element'); foreach ($feed1->entry as $entry) { $this->assertTrue($entry instanceof Zend_Gdata_Health_ProfileEntry); $ccr = $entry->getCcr(); $this->assertTrue($ccr instanceof Zend_Gdata_Health_Extension_Ccr); $this->assertEquals($entry->getHttpClient(), $feed1->getHttpClient()); } // with query object $query = new Zend_Gdata_Health_Query("https://www.google.com/health/feeds/profile/ui/{$profileID}"); $query->setDigest('true'); $feed2 = $this->health->getHealthProfileFeed($query); $this->assertTrue($feed2 instanceof Zend_Gdata_Health_ProfileFeed); $this->assertTrue(count($feed2->entry) === 1, 'digest=true, expected a single <entry> element'); foreach ($feed2->entry as $entry) { $this->assertTrue($entry instanceof Zend_Gdata_Health_ProfileEntry); $ccr = $entry->getCcr(); $this->assertTrue($ccr instanceof Zend_Gdata_Health_Extension_Ccr); $this->assertEquals($entry->getHttpClient(), $feed2->getHttpClient()); } $this->assertEquals($feed1->saveXML(), $feed2->saveXML()); }
// closing tag, decrease indent } if ($indent < 0) { $indent += $level; } $pretty[] = str_repeat(' ', $indent) . $el; } } $xml = implode("\n", $pretty); return $html_output ? htmlentities($xml) : $xml; } $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']); $client = Zend_Gdata_AuthSub::getHttpClient($sessionToken); $useH9Sandbox = true; $healthService = new Zend_Gdata_Health($client, 'MyGHAppNamev1.0', $useH9Sandbox); $query = new Zend_Gdata_Health_Query(); $query->setDigest("true"); $profileFeed = $healthService->getHealthProfileFeed($query); $entry = $profileFeed->entry[0]; //To print ccr $ccr = $entry->getCcr(); $xmlStr = $ccr->saveXML($ccr); echo '<p>' . xmlpp($xmlStr, true) . '</p>'; // digest=true was set so we only have 1 entry $allergies = $entry->getCcr()->getAllergies(); $conditions = $entry->getCcr()->getConditions(); $immunizations = $entry->getCcr()->getImmunizations(); $lab_results = $entry->getCcr()->getLabResults(); $medications = $entry->getCcr()->getMedications(); $procedures = $entry->getCcr()->getProcedures(); //An example of using the medications data