Login   Register  
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: 2008-04-24 08:39
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 ($d4515400400) ;
        
$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 ($d4515400400) ;
        
$m->setNonCompatible (new HtmlBlock ("oops, maps don't work!")) ;
        
$m->addMarker (552"test1") ;
        
$m->addMarker (550"test2") ;
        
$m->addMarker (352"test3") ;
        
$m->addMarker (350"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) ;
    }

} ;

?>