1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
<?php
Prado::using('System.Web.UI.WebControls.TXmlTransform');
Prado::using('System.Web.UI.THtmlWriter');
/**
* @package System.Web.UI.WebControls
*/
class TXmlTransformTest extends PHPUnit_Framework_TestCase {
private $documentContent;
private $transformContent;
private $documentPath;
private $transformPath;
public function setUp() {
$this->documentPath = dirname(__FILE__).'/data/hello.xml';
$this->documentContent = file_get_contents($this->documentPath);
$this->transformPath = dirname(__FILE__).'/data/hello.xsl';
$this->transformContent = file_get_contents($this->transformPath);
}
public function testSetDocumentContent() {
$expected = $this->documentContent;
$transform = new TXmlTransform();
$transform->setDocumentContent($expected);
$this->assertEquals($expected, $transform->getDocumentContent());
}
public function testSetDocumentPathAsFile() {
$expected = $this->documentPath;
$transform = new TXmlTransform();
$transform->setDocumentPath($expected);
$this->assertEquals($expected, $transform->getDocumentPath());
}
public function testSetDocumentPathAsNamespace() {
if(Prado::getPathOfAlias('UnitTest') === null) {
Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data');
}
$expected = $this->documentPath;
$transform = new TXmlTransform();
$transform->setDocumentPath('UnitTest.hello');
$this->assertEquals($expected, $transform->getDocumentPath());
}
public function testSetTransformContent() {
$expected = $this->transformContent;
$transform = new TXmlTransform();
$transform->setTransformContent($expected);
$this->assertEquals($expected, $transform->getTransformContent());
}
public function testSetTransformPathAsFile() {
$expected = $this->transformPath;
$transform = new TXmlTransform();
$transform->setTransformPath($expected);
$this->assertEquals($expected, $transform->getTransformPath());
}
public function testSetTransformPathAsNamespace() {
if(Prado::getPathOfAlias('UnitTest') === null) {
Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data');
}
$expected = $this->transformPath;
$transform = new TXmlTransform();
$transform->setTransformPath('UnitTest.hello');
$this->assertEquals($expected, $transform->getTransformPath());
}
public function testAddParameter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
public function testRenderWithDocumentContentAndTransformContent() {
$expected = "<b>Hello World!</b>\n";
$transform = new TXmlTransform();
$transform->setDocumentContent($this->documentContent);
$transform->setTransformContent($this->transformContent);
$textWriter = new TTextWriter();
$htmlWriter = new THtmlWriter($textWriter);
$transform->render($htmlWriter);
$actual = $textWriter->flush();
self::assertEquals($expected, $actual);
}
public function testRenderWithDocumentPathAndTransformContent() {
$expected = "<b>Hello World!</b>\n";
$transform = new TXmlTransform();
$transform->setDocumentPath($this->documentPath);
$transform->setTransformContent($this->transformContent);
$textWriter = new TTextWriter();
$htmlWriter = new THtmlWriter($textWriter);
$transform->render($htmlWriter);
$actual = $textWriter->flush();
self::assertEquals($expected, $actual);
}
public function testRenderWithDocumentContentAndTransformPath() {
$expected = "<b>Hello World!</b>\n";
$transform = new TXmlTransform();
$transform->setDocumentContent($this->documentContent);
$transform->setTransformPath($this->transformPath);
$textWriter = new TTextWriter();
$htmlWriter = new THtmlWriter($textWriter);
$transform->render($htmlWriter);
$actual = $textWriter->flush();
self::assertEquals($expected, $actual);
}
public function testRenderWithDocumentPathAndTransformPath() {
$expected = "<b>Hello World!</b>\n";
$transform = new TXmlTransform();
$transform->setDocumentPath($this->documentPath);
$transform->setTransformPath($this->transformPath);
$textWriter = new TTextWriter();
$htmlWriter = new THtmlWriter($textWriter);
$transform->render($htmlWriter);
$actual = $textWriter->flush();
self::assertEquals($expected, $actual);
}
public function testRenderWithBodyAsDocumentAndTransformPath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
?>
|