PHP Classes
elePHPant
Icontem

File: HtmlMapTests.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bruyndonckx  >  HTML Generator Class  >  HtmlMapTests.php  >  Download  
File: HtmlMapTests.php
Role: Unit test script
Content type: text/plain
Description: Test HTML Google Maps
Class: HTML Generator Class
Generate HTML documents programmatically
Author: By
Last change:
Date: 7 years ago
Size: 1,346 bytes
 

Contents

Class file image Download
<?php
require_once ('lib/simpletest/unit_tester.php');
require_once (
'html/HtmlMap.inc') ;


class
HtmlMapTests extends UnitTestCase {

    public function
testSimpleMap () {

       
$d = new HtmlDocument ('test') ;
       
$m = new HtmlMap ($d, 4, 51, 5, 400, 400) ;
       
$d->setBody ($m) ;

       
$s = $d->build() ;

       
$this->assertPattern ('/maps.google.com/', $s) ;
       
$this->assertPattern ('/GUnload()/', $s) ;
       
$this->assertNoPattern ('/GBrowserIsCompatible()/', $s) ;

        echo (
$s) ;
    }

    public function
testMarkedMap () {

       
$d = new HtmlDocument ('test') ;
       
$m = new HtmlMap ($d, 4, 51, 5, 400, 400) ;
       
$m->setNonCompatible (new HtmlBlock ("oops, maps don't work!")) ;
       
$m->addMarker (5, 52, "test1") ;
       
$m->addMarker (5, 50, "test2") ;
       
$m->addMarker (3, 52, "test3") ;
       
$m->addMarker (3, 50, "test4") ;

       
$d->setBody ($m) ;

       
$s = $d->build() ;

       
$this->assertPattern ('/maps.google.com/', $s) ;
       
$this->assertPattern ('/GUnload()/', $s) ;
       
$this->assertPattern ('/52,5/', $s) ;
       
$this->assertPattern ('/50,5/', $s) ;
       
$this->assertPattern ('/52,3/', $s) ;
       
$this->assertPattern ('/50,3/', $s) ;
       
$this->assertPattern ("/oops, maps don't work!/", $s) ;

        echo (
$s) ;
    }

} ;

?>