/** * Test directory scanning for images to VSMGImage object creation */ static function testGetImagePaths() { $all_images = VSMGFileHelper::getImagePaths("../test/images", FALSE); assert(count($all_images) == 15); $all_images = VSMGFileHelper::getImagePaths("../test/images", TRUE); assert(count($all_images) == 17); }
static function testGenerateGalleryHTML() { $all_images = VSMGFileHelper::getImagePaths("../test/images", TRUE); $gallery = new VSMGGallery($all_images, TestVSMGImageHelper::$username, TestVSMGImageHelper::$password, TestVSMGImageHelper::$database); $gallery_html = $gallery->getThumbnailsHTML(); return "<html>\n {$gallery_html}</html>\n"; }
<?php require_once 'TestVSMGFileHelper.php'; require_once 'TestVSMGImageHelper.php'; TestVSMGFileHelper::run(); TestVSMGImageHelper::run(); $username = '******'; $password = '******'; $database = 'modx'; // Setup a quick html file $all_images = VSMGFileHelper::getImagePaths("../test/images", TRUE); $gallery = new VSMGGallery($all_images, $username, $password, $database); $gallery_html = $gallery->getThumbnailsHTML(); $ind_file = "index-test.html"; $fh = fopen($ind_file, 'w') or die("Erro opening file"); $html = "<html>\n" . ' <link rel="stylesheet" href="../css/vsmg.css" type="text/css"/>' . $gallery_html . "</html>\n"; fwrite($fh, $html); fclose($fh);