From f3931ef17118868d89103b54549345c5cb0f86bb Mon Sep 17 00:00:00 2001 From: knut <> Date: Tue, 29 May 2007 20:43:14 +0000 Subject: added tests for TextWriter and added IO test suite --- .gitattributes | 2 ++ tests/unit/AllTests.php | 2 ++ tests/unit/IO/AllTests.php | 27 +++++++++++++++++++++++++++ tests/unit/IO/TTextWriterTest.php | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 tests/unit/IO/AllTests.php create mode 100644 tests/unit/IO/TTextWriterTest.php diff --git a/.gitattributes b/.gitattributes index df3eb8d5..77e682e5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2808,6 +2808,8 @@ tests/unit/I18N/core/DateFormatTest.php -text tests/unit/I18N/core/DateTimeFormatInfoTest.php -text tests/unit/I18N/core/NumberFormatInfoTest.php -text tests/unit/I18N/core/NumberFormatTest.php -text +tests/unit/IO/AllTests.php -text +tests/unit/IO/TTextWriterTest.php -text tests/unit/SQLMap/BaseTest.php -text tests/unit/SQLMap/CacheTest.php -text tests/unit/SQLMap/ConfigureTest.php -text diff --git a/tests/unit/AllTests.php b/tests/unit/AllTests.php index 38096801..e097247b 100644 --- a/tests/unit/AllTests.php +++ b/tests/unit/AllTests.php @@ -6,6 +6,7 @@ if(!defined('PHPUnit_MAIN_METHOD')) { } require_once 'Xml/AllTests.php'; +require_once 'IO/AllTests.php'; require_once 'Collections/AllTests.php'; require_once 'I18N/core/AllTests.php'; require_once 'Web/AllTests.php'; @@ -22,6 +23,7 @@ class AllTests { $suite = new PHPUnit_Framework_TestSuite('PRADO PHP Framework'); $suite->addTest(Xml_AllTests::suite()); + $suite->addTest(IO_AllTests::suite()); $suite->addTest(Collections_AllTests::suite()); $suite->addTest(I18N_core_AllTests::suite()); $suite->addTest(Web_AllTests::suite()); 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 @@ +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 @@ +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()); + } +} + +?> -- cgit v1.2.3