source: trunk/tests/CSSTest.php @ 1

Last change on this file since 1 was 1, checked in by scdev, 19 years ago

Initial import.

File size: 1.5 KB
Line 
1<?php
2/**
3 * PHPUnit test case for CSS
4 *
5 * The method skeletons below need to be filled in with
6 * real data so that the tests will run correctly. Replace
7 * all EXPECTED_VAL and PARAM strings with real data.
8 *
9 * Created with PHPUnit_Skeleton on 2005-08-09
10 */
11require_once 'PHPUnit.php';
12class CSSTest extends PHPUnit_TestCase {
13
14    var $CSS;
15    var $test_css_file;
16
17    function CSSTest($name)
18    {
19        $this->PHPUnit_TestCase($name);
20    }
21
22    function setUp()
23    {
24        require dirname(__FILE__) . '/_config.inc.php';
25        $this->test_css_file = dirname(__FILE__) . '/../css/codebase.inc.css';
26        require_once '../lib/CSS.inc.php';
27        $this->CSS =& new CSS();
28        $this->CSS->setFile($this->test_css_file);
29    }
30
31    function tearDown()
32    {
33        unset($this->CSS);
34    }
35
36    function test_setparam()
37    {
38        $this->CSS->setparam(array('asdf' => 123));
39    }
40
41    function test_getparam()
42    {
43        $this->CSS->getparam('asdf');
44    }
45
46    function test_setfile()
47    {
48        $this->CSS->setfile(dirname(__FILE__) . '/../css/codebase.inc.css');
49    }
50
51    function test_headers()
52    {
53        ob_start();
54        $this->CSS->headers();
55        $result = ob_get_clean();
56    }
57
58    function test_output()
59    {
60        ob_start();
61        $this->CSS->output();
62        $result = ob_get_clean();
63        $this->assertEquals(file_get_contents($this->test_css_file), $result);
64    }
65
66}
67// Running the test.
68$suite = new PHPUnit_TestSuite('CSSTest');
69$result = PHPUnit::run($suite);
70echo $result->toString();
71?>
Note: See TracBrowser for help on using the repository browser.