Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Unit Tests for serializing arrays
4
 *
5
 * @package    XML_Serializer
6
 * @subpackage tests
7
 * @author     Stephan Schmidt <schst@php-tools.net>
8
 * @author     Chuck Burgess <ashnazg@php.net>
9
 */
10
 
11
/**
12
 * PHPUnit main() hack
13
 *
14
 * "Call class::main() if this source file is executed directly."
15
 */
16
if (!defined('PHPUnit_MAIN_METHOD')) {
17
    define('PHPUnit_MAIN_METHOD', 'XML_Unserializer_Scalars_TestCase::main');
18
}
19
require_once 'PHPUnit/Framework/TestCase.php';
20
require_once 'PHPUnit/Framework/TestSuite.php';
21
require_once 'PHPUnit/TextUI/TestRunner.php';
22
 
23
require_once 'XML/Unserializer.php';
24
 
25
/**
26
 * Unit Tests for serializing arrays
27
 *
28
 * @package    XML_Serializer
29
 * @subpackage tests
30
 * @author     Stephan Schmidt <schst@php-tools.net>
31
 * @author     Chuck Burgess <ashnazg@php.net>
32
 */
33
class XML_Unserializer_Scalars_TestCase extends PHPUnit_Framework_TestCase {
34
 
35
    public static function main() {
36
        $suite  = new PHPUnit_Framework_TestSuite('XML_Unserializer_Scalars_TestCase');
37
        $result = PHPUnit_TextUI_TestRunner::run($suite);
38
    }
39
 
40
    protected function setUp() {}
41
 
42
    protected function tearDown() {}
43
 
44
   /**
45
    * Test unserializing simple data
46
    */
47
    public function testData()
48
    {
49
        $u = new XML_Unserializer();
50
        $xml = '<xml>data</xml>';
51
        $u->unserialize($xml);
52
        $this->assertEquals('data', $u->getUnserializedData());
53
    }
54
 
55
   /**
56
    * Test extracting the root name
57
    */
58
    public function testRootName()
59
    {
60
        $u = new XML_Unserializer();
61
        $xml = '<xml>data</xml>';
62
        $u->unserialize($xml);
63
        $this->assertEquals('xml', $u->getRootName());
64
    }
65
 
66
}
67
 
68
/**
69
 * PHPUnit main() hack
70
 * "Call class::main() if this source file is executed directly."
71
 */
72
if (PHPUnit_MAIN_METHOD == 'XML_Unserializer_Scalars_TestCase::main') {
73
    XML_Unserializer_Scalars_TestCase::main();
74
}
75
?>