From 60284479936d65443bd5dc14456bc0b692eab500 Mon Sep 17 00:00:00 2001 From: Jozef Selesi Date: Sat, 22 Nov 2008 18:22:53 +0000 Subject: An Atom library prototype. Its purpose is to explore the cost of us supporting Atom as the default input and output format of RESTful controllers. Only the constructs necessary for representing comment feeds and entries have been implemented. Its output are valid Atom 1.0 documents. The test contains examples of how to make feeds and entries. --- modules/atom/tests/Atom_Test.php | 97 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 modules/atom/tests/Atom_Test.php (limited to 'modules/atom/tests') diff --git a/modules/atom/tests/Atom_Test.php b/modules/atom/tests/Atom_Test.php new file mode 100644 index 00000000..28192419 --- /dev/null +++ b/modules/atom/tests/Atom_Test.php @@ -0,0 +1,97 @@ +id("http://gallery.example.com/comments") + ->title("Comments on Ocean Beach Sunset", "text") + ->updated("2008-11-15T12:00:00Z"); + + $feed->link() + ->rel("self") + ->href("http://gallery.example.com/comments"); + $feed->link() + ->rel("related") + ->type("application/atom+xml") + ->title("Get photo meta data") + ->href("http://gallery.example.com/photos/23"); + $feed->link() + ->rel("related") + ->type("image/jpeg") + ->title("Download photo") + ->href("http://gallery.example.com/photos/SanFran/sunset.jpg"); + + $feed->entry() + ->id("http://gallery.example.com/comments/32") + ->updated("2008-11-15T12:00:00Z") + ->title("") + ->content("Wow, that's <b>beautiful<b>!", "html") + ->author() + ->name("Jonathan Doe") + ->email("jdoe@example.com") + ->uri("http://gallery.example.com"); + + $xml = $feed->as_xml(); +// file_put_contents("atom-feed.xml", $xml); +// Kohana::log("debug", "{$xml}"); + } + + public function atom_entry_test() { + $entry = new Atom_Entry("entry"); + $entry->id("http://gallery.example.com/comments/32") + ->title("Comment on Ocean Beach Sunset", "text") + ->updated("2008-11-15T12:00:00Z") + ->content("Wow, that's <b>beautiful<b>!", "html") + ->author() + ->name("Jonathan Doe") + ->email("jdoe@example.com") + ->uri("http://gallery.example.com"); + $entry->link() + ->rel("self") + ->href("http://gallery.example.com/comments/32"); + $entry->link() + ->rel("related") + ->type("application/atom+xml") + ->title("Get photo meta data") + ->href("http://gallery.example.com/photos/23"); + $entry->link() + ->rel("related") + ->type("text/html") + ->title("View photo in Gallery") + ->href("http://gallery.example.com/photos/23"); + $entry->link() + ->rel("related") + ->type("image/jpeg") + ->title("Download photo") + ->href("http://gallery.example.com/photos/SanFran/sunset.jpg"); + + $xml = $entry->as_xml(); +// file_put_contents("atom-entry.xml", $xml); +// Kohana::log("debug", "{$xml}"); + } +} -- cgit v1.2.3