/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/test/unittest3.php
ViewVC logotype

Annotation of /nfo/php/libs/com.newsblob.phphtmllib/test/unittest3.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Thu May 6 16:57:33 2004 UTC (20 years, 2 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
 updated all to v2.4.1 - Apr 01, 2004

1 jonen 1.1 <?php
2     /**
3     * This is a Unit Test script for the
4     * HTMLTagClass class. It is used to make sure
5     * everything works from build to build.
6     *
7     *
8     * $Id: unittest3.php,v 1.1 2003/08/16 00:40:43 hemna Exp $
9     *
10     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
11     * @package phpHtmlLib
12     */
13    
14     $phphtmllib = "..";
15     require_once($phphtmllib."/includes.inc");
16     /**
17     * You have to have PEAR's PHPUnit installed
18     *
19     * pear install PHPUnit
20     */
21     require_once("PHPUnit.php");
22    
23    
24     /**
25     * Test the Container class
26     */
27     class HTMLTagClassTest extends PHPUnit_TestCase {
28    
29     function HTMLTagClassTest($name) {
30     $this->PHPUnit_TestCase($name);
31     }
32    
33     function test_Constructor() {
34     $tag = new HTMLTagClass(array("src" => "http://www.slashdot.org"));
35     $tag->set_tag_name("a");
36     $this->assertEquals("a", $tag->_tag, "Test tag name");
37     $this->assertEquals(0, $tag->count_content(), "Test content count");
38     $this->assertEquals("http://www.slashdot.org",
39     $tag->_attributes["src"], "Test tag attribute");
40     }
41    
42     function test_set_style() {
43     $tag = new DIVtag();
44     $str = "color:blue;";
45     $tag->set_style($str);
46     $this->assertEquals($str, $tag->_attributes["style"], "Test style attribute");
47     }
48    
49     function test_set_class() {
50     $tag = new DIVtag();
51     $str = "foo";
52     $tag->set_class($str);
53     $this->assertEquals($str, $tag->_attributes["class"], "Test class attribute");
54     }
55    
56     function test_set_id() {
57     $tag = new DIVtag();
58     $str = "foo";
59     $tag->set_id($str);
60     $this->assertEquals($str, $tag->_attributes["id"], "Test id attribute");
61     }
62     }
63    
64     $suite = new PHPUnit_TestSuite('HTMLTagClassTest');
65     $result = PHPUnit::run($suite);
66     if (isset($_SERVER["PHP_SELF"]) && strlen($_SERVER["PHP_SELF"]) > 0) {
67     echo $result->toHTML();
68     } else {
69     echo $result->toString();
70     }
71     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed