G2EmbedTestUtilities.class

kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Mon, 2006-03-13 11:51

In a similar vein to G2EmbedDiscoveryUtilities, here is a first version of G2EmbedTestUtilities.class which tries to make life easier for integration authors by checking locations and running a series of tests (inspired by the WPG integration code).

The standard usage would be to call G2EmbedTestUtilities::checkLocations first which uses G2EmbedDiscoveryUtilities to normalise the variables and does a few checks. Then call preInitTests which checks for enough PHP memory (and could be expanded for others later). If this passes it should be OK to call GalleryEmbed::Init. Once that passes, call postInitTests which checks for ImageBlock, ImageFrame, URL rewrite etc.

The test functions return an array of results in a similar format to the Gallery2 installer. These can then be formatted as needed and displayed.

There are 2 functions which need to be rewritten for each integration (at the end) as they call Drupal functions. Not sure if there is an ideal way to do this (callback?)

Not the greatest code, but hopefully useful. Any comments (or rewrite!) welcome.

AttachmentSize
G2EmbedTestUtilities.class.txt14.09 KB