diff options
| -rw-r--r-- | .gitattributes | 2 | ||||
| -rw-r--r-- | tests/unit/AllTests.php | 2 | ||||
| -rw-r--r-- | tests/unit/IO/AllTests.php | 27 | ||||
| -rw-r--r-- | tests/unit/IO/TTextWriterTest.php | 32 | 
4 files changed, 63 insertions, 0 deletions
| 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 @@ +<?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()); +	} +} + +?> | 
