public function testStrings() { $xml = "<entry>\n\t<title> Using C++ Intrinsic Functions for Pipelined Text Processing</title>\n\t<id>http://www.oreillynet.com/pub/wlg/8356</id>\n\t<link rel='alternate' href='http://www.oreillynet.com/pub/wlg/8356'/>\n\t<summary type='xhtml'>\n\t<div xmlns='http://www.w3.org/1999/xhtml'>\n\tA good C++ programming technique that has almost no published material available on the WWW relates to using the special pipeline instructions in modern CPUs for faster text processing. Here's example code using C++ intrinsic functions to give a fourfold speed increase for a UTF-8 to UTF-16 converter compared to the original C/C++ code.\n\t</div>\n\t</summary>\n\t<author><name>Rick Jelliffe</name></author>\n\t<updated>2005-11-07T08:15:57-08:00</updated>\n</entry>"; $entry = new Zend_Feed_Entry_Atom('uri', $xml); $this->assertTrue($entry->summary instanceof Zend_Feed_Element, '__get access should return an Zend_Feed_Element instance'); $this->assertFalse($entry->summary() instanceof Zend_Feed_Element, 'method access should not return an Zend_Feed_Element instance'); $this->assertTrue(is_string($entry->summary()), 'method access should return a string'); $this->assertFalse(is_string($entry->summary), '__get access should not return a string'); }
public function testEdit() { Zend_Feed::setHttpClient(new TestClient()); $contents = file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-before-update.xml'); /* The base feed URI is the same as the POST URI, so just supply the * Zend_Feed_Entry_Atom object with that. */ $entry = new Zend_Feed_Entry_Atom($this->_uri, $contents); /* Initial state. */ $this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match'); $this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Initial state of edit link does not match'); /* Just change the entry's properties directly. */ $entry->content = '1.2'; /* Then save the changes. */ $entry->save(); /* New state. */ $this->assertEquals('1.2', $entry->content(), 'Content change did not stick'); $this->assertEquals('2005-05-23T16:27:00-08:00', $entry->updated(), 'New updated link is not correct'); $this->assertEquals('http://fubar.com/myFeed/1/2/', $entry->link('edit'), 'New edit link is not correct'); }
/** * @group ZF-2606 */ public function testValuesWithXmlSpecialChars() { $testAmp = '&'; $testLt = '<'; $testGt = '>'; $e = new Zend_Feed_Entry_Atom(); $e->testAmp = $testAmp; $e->{'namespace1:lt'} = $testLt; $e->{'namespace1:gt'} = $testGt; $this->assertEquals($testAmp, $e->testAmp()); $this->assertEquals($testLt, $e->{'namespace1:lt'}()); $this->assertEquals($testGt, $e->{'namespace1:gt'}()); }
/** * Creates an event on the authenticated user's default calendar with the * specified event details. * * @param Zend_Http_Client $client The authenticated client object * @param string $title The event title * @param string $desc The detailed description of the event * @param string $startDate The start date of the event in YYYY-MM-DD format * @param string $startTime The start time of the event in HH:MM 24hr format * @param string $endTime The end time of the event in HH:MM 24hr format * @param string $tzOffset The offset from GMT/UTC in [+-]DD format (eg -08) * @return void */ function createEvent($client, $title = 'Tennis with Beth', $desc = 'Meet for a quick lesson', $where = 'On the courts', $startDate = '2008-01-20', $startTime = '10:00', $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08') { $gdataCal = new Zend_Gdata_Calendar($client); Zend_Feed::registerNamespace('gd', 'http://schemas.google.com/g/2005'); $newEntry = new Zend_Feed_Entry_Atom(); $newEntry->title = trim($title); $newEntry->{'gd:where'}['valueString'] = $where; $newEntry->content = $desc; $newEntry->content['type'] = 'text'; $when = $newEntry->{'gd:when'}; $when['startTime'] = "{$startDate}T{$startTime}:00.000{$tzOffset}:00"; $when['endTime'] = "{$endDate}T{$endTime}:00.000{$tzOffset}:00"; $gdataCal->post($newEntry->saveXML()); }