Added by Gavin, last edited by Trevor Johns on Jan 14, 2008  (view change) show comment

Labels

 
(None)

Zend_Gdata is a client library to interact with Google's APIs using the Google data protocol. This document contains information for Zend Framework developers about maintaining this module, including design decisions, development tips, and directions for future work.

This information is not intended to replace information available in the issue tracker, manual, or API guide.

Architecture

Needs to be written!

Unit Test Configuration

General Configuration

In order to enable the online unit tests for Zend_Gdata, you will first want to obtain a Google account which you can use for testing purposes. Once that's done, make the following changes to tests/TestConfiguration.php:

  • TESTS_ZEND_GDATA_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED => true
  • TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL => 'you@gmail.com'
  • TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD => 'your_password_goes_here'

Blogger

Next, log into Blogger with your username and password and create a new blog. It will be publicly visible, so be careful what you name it. Once that's done, go to the Manage Posts menu. Notice that this menu has a URL of the form:

http://www.blogger.com/posts.g?blogID=1111111111111111111

This last number is your blog ID. Add this to your configuration:

  • TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_BLOG_ID => '1111111111111111111'

Note that if the unit tests are run too frequently, Blogger will begin to treat posts to this blog via the API as spam, causing the tests to fail. If this happens, you will need to delete your blog and recreate it, generating a new blog ID.

Spreadsheets

Log into Google Docs and create a new spreadsheet, making sure that it has a name and is saved. View the spreadsheet's source in your browser and search for the line that looks like this:

var TX_id = "o11111111111111111111.2222222222222222222.3333333333333333333.4444444444444444444";

The first two sets of numbers (separated by periods/full stops) constitute the spreadsheet's key. Enter this into the test configuration:

  • TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY => o11111111111111111111.2222222222222222222

TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID can be left set to 'default'.

Google Apps

The Google Apps test suite needs to know a domain which can be modified for testing:

  • TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_GAPPS_DOMAIN => 'your-domain.tld'

Be aware that this test will create several hundred users. Do not enable this test unless you are willing to take responsibility for any charges associated with this!

The Google Apps test suite uses a separate username and password from that stored in TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL and TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD, since a Google Apps administrator account is may not always be associated with other Google services:

  • TESTS_ZEND_GDATA_GAPPS_EMAIL => 'you@your-domain.tld'
  • TESTS_ZEND_GDATA_GAPPS_PASSWORD => 'your_password_goes_here'

YouTube

The YouTube API needs to know the name of a valid YouTube user for certain tests as TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT. Since no modifications are made to this account, you can leave it set to it's default value of 'zfgdata' unless there is a particular set of data you wish to test against. Other than this, just make sure this test is enabled.

  • TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED => true

Others

The tests for Calendar, Base, Docs, and Photos do not need any special configuration, simply enable them as desired:

  • TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED => true
  • TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED => true

Common Issues

Time Zone Not Set

If you receive the following error while truing to run the Zend_Gdata test suite:

monspaced}}strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead{{monspaced

then your timezone is not set. To resolve this, edit your php.ini and set the date.timezone property:

date.timezone = America/Los_Angeles

Future Work

Needs to be written!