summaryrefslogtreecommitdiff
path: root/tests/unit/IO
diff options
context:
space:
mode:
authorknut <>2007-05-29 20:43:14 +0000
committerknut <>2007-05-29 20:43:14 +0000
commitf3931ef17118868d89103b54549345c5cb0f86bb (patch)
tree0b49f7cb30bb30e732abf2bac65aa5da8c00f5f1 /tests/unit/IO
parent376a5af2d258f87e2be75b667850436987c68a55 (diff)
added tests for TextWriter and added IO test suite
Diffstat (limited to 'tests/unit/IO')
-rw-r--r--tests/unit/IO/AllTests.php27
-rw-r--r--tests/unit/IO/TTextWriterTest.php32
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/unit/IO/AllTests.php b/tests/unit/IO/AllTests.php
new file mode 100644
index 00000000..da8d91a0
--- /dev/null
+++ b/tests/unit/IO/AllTests.php
@@ -0,0 +1,27 @@
+<?php
+require_once dirname(__FILE__).'/../phpunit.php';
+
+if(!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'IO_AllTests::main');
+}
+
+require_once 'TTextWriterTest.php';
+
+class IO_AllTests {
+ public static function main() {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite() {
+ $suite = new PHPUnit_Framework_TestSuite('System.IO');
+
+ $suite->addTestSuite('TTextWriterTest');
+
+ return $suite;
+ }
+}
+
+if(PHPUnit_MAIN_METHOD == 'IO_AllTests::main') {
+ IO_AllTests::main();
+}
+?>
diff --git a/tests/unit/IO/TTextWriterTest.php b/tests/unit/IO/TTextWriterTest.php
new file mode 100644
index 00000000..c011acae
--- /dev/null
+++ b/tests/unit/IO/TTextWriterTest.php
@@ -0,0 +1,32 @@
+<?php
+require_once dirname(__FILE__).'/../phpunit.php';
+
+Prado::using('System.IO.TTextWriter');
+
+/**
+ * @package System.IO
+ */
+class TTextWriterTest extends PHPUnit_Framework_TestCase {
+
+ public function testFlush() {
+ $writer = new TTextWriter();
+ self::assertEquals('', $writer->flush());
+ $writer->write('some text');
+ self::assertEquals('some text', $writer->flush());
+ }
+
+ public function testWrite() {
+ $writer = new TTextWriter();
+ $writer->write("some text\n");
+ $writer->write("more text\n");
+ self::assertEquals("some text\nmore text\n", $writer->flush());
+ }
+
+ public function testWriteLine() {
+ $writer = new TTextWriter();
+ $writer->writeLine('some text');
+ self::assertEquals("some text\n", $writer->flush());
+ }
+}
+
+?>