From 5f8adabb6286fdcb0ff8a0ea5d1d58f40eef51f4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 27 Aug 2012 03:28:16 -0400 Subject: [PATCH] Add simple (constructor) tests for Framework classes --- tests/Framework/Image.php | 20 ++ tests/Framework/ResultSet.php | 20 ++ tests/Framework/BaseReplacer.php | 20 ++ tests/Framework/Html.php | 20 ++ tests/Framework/Rcube.php | 20 ++ tests/Framework/ResultThread.php | 20 ++ tests/Framework/StringReplacer.php | 20 ++ tests/Framework/ContentFilter.php | 20 ++ tests/Framework/MessageHeader.php | 20 ++ tests/Framework/Cache.php | 20 ++ tests/Framework/ResultIndex.php | 20 ++ tests/Framework/Charset.php | 28 ++++ tests/Framework/Spellchecker.php | 20 ++ tests/Framework/ImapGeneric.php | 20 ++ tests/Framework/Browser.php | 20 ++ tests/Framework/MessagePart.php | 20 ++ tests/Framework/Imap.php | 20 ++ tests/phpunit.xml | 19 ++ tests/Framework/User.php | 20 ++ tests/Framework/Smtp.php | 20 ++ 20 files changed, 407 insertions(+), 0 deletions(-) diff --git a/tests/Framework/BaseReplacer.php b/tests/Framework/BaseReplacer.php new file mode 100644 index 0000000..e00b9e5 --- /dev/null +++ b/tests/Framework/BaseReplacer.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_base_replacer class + * + * @package Tests + */ +class Framework_BaseReplacer extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_base_replacer('test'); + + $this->assertInstanceOf('rcube_base_replacer', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Browser.php b/tests/Framework/Browser.php new file mode 100644 index 0000000..c3860d8 --- /dev/null +++ b/tests/Framework/Browser.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_browser class + * + * @package Tests + */ +class Framework_Browser extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_browser(); + + $this->assertInstanceOf('rcube_browser', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Cache.php b/tests/Framework/Cache.php new file mode 100644 index 0000000..dc026a6 --- /dev/null +++ b/tests/Framework/Cache.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_cache class + * + * @package Tests + */ +class Framework_Cache extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_cache('db', 1); + + $this->assertInstanceOf('rcube_cache', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Charset.php b/tests/Framework/Charset.php new file mode 100644 index 0000000..9e3fad4 --- /dev/null +++ b/tests/Framework/Charset.php @@ -0,0 +1,28 @@ +<?php + +/** + * Test class to test rcube_charset class + * + * @package Tests + */ +class Framework_Charset extends PHPUnit_Framework_TestCase +{ + + /** + * Data for test_clean() + */ + function data_clean() + { + return array( + array('', '', 'Empty string'), + ); + } + + /** + * @dataProvider data_clean + */ + function test_clean($input, $output, $title) + { + $this->assertEquals(rcube_charset::clean($input), $output, $title); + } +} diff --git a/tests/Framework/ContentFilter.php b/tests/Framework/ContentFilter.php new file mode 100644 index 0000000..9bee936 --- /dev/null +++ b/tests/Framework/ContentFilter.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_content_filter class + * + * @package Tests + */ +class Framework_ContentFilter extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_content_filter(); + + $this->assertInstanceOf('rcube_content_filter', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Html.php b/tests/Framework/Html.php new file mode 100644 index 0000000..107f828 --- /dev/null +++ b/tests/Framework/Html.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_html class + * + * @package Tests + */ +class Framework_Html extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new html; + + $this->assertInstanceOf('html', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Image.php b/tests/Framework/Image.php new file mode 100644 index 0000000..31e8520 --- /dev/null +++ b/tests/Framework/Image.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_image class + * + * @package Tests + */ +class Framework_Image extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_image('test'); + + $this->assertInstanceOf('rcube_image', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Imap.php b/tests/Framework/Imap.php new file mode 100644 index 0000000..3f52e07 --- /dev/null +++ b/tests/Framework/Imap.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_imap class + * + * @package Tests + */ +class Framework_Imap extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_imap; + + $this->assertInstanceOf('rcube_imap', $object, "Class constructor"); + } +} diff --git a/tests/Framework/ImapGeneric.php b/tests/Framework/ImapGeneric.php new file mode 100644 index 0000000..0b2cc3d --- /dev/null +++ b/tests/Framework/ImapGeneric.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_imap_generic class + * + * @package Tests + */ +class Framework_ImapGeneric extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_imap_generic; + + $this->assertInstanceOf('rcube_imap_generic', $object, "Class constructor"); + } +} diff --git a/tests/Framework/MessageHeader.php b/tests/Framework/MessageHeader.php new file mode 100644 index 0000000..e5bc175 --- /dev/null +++ b/tests/Framework/MessageHeader.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_message_header class + * + * @package Tests + */ +class Framework_MessageHeader extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_message_header; + + $this->assertInstanceOf('rcube_message_header', $object, "Class constructor"); + } +} diff --git a/tests/Framework/MessagePart.php b/tests/Framework/MessagePart.php new file mode 100644 index 0000000..deb4260 --- /dev/null +++ b/tests/Framework/MessagePart.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_message_part class + * + * @package Tests + */ +class Framework_MessagePart extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_message_part; + + $this->assertInstanceOf('rcube_message_part', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Rcube.php b/tests/Framework/Rcube.php new file mode 100644 index 0000000..637558d --- /dev/null +++ b/tests/Framework/Rcube.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube class + * + * @package Tests + */ +class Framework_Rcube extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = rcube::get_instance(); + + $this->assertInstanceOf('rcube', $object, "Class singleton"); + } +} diff --git a/tests/Framework/ResultIndex.php b/tests/Framework/ResultIndex.php new file mode 100644 index 0000000..efbba6d --- /dev/null +++ b/tests/Framework/ResultIndex.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_result_index class + * + * @package Tests + */ +class Framework_ResultIndex extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_result_index; + + $this->assertInstanceOf('rcube_result_index', $object, "Class constructor"); + } +} diff --git a/tests/Framework/ResultSet.php b/tests/Framework/ResultSet.php new file mode 100644 index 0000000..2d04e53 --- /dev/null +++ b/tests/Framework/ResultSet.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_result_set class + * + * @package Tests + */ +class Framework_ResultSet extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_result_set; + + $this->assertInstanceOf('rcube_result_set', $object, "Class constructor"); + } +} diff --git a/tests/Framework/ResultThread.php b/tests/Framework/ResultThread.php new file mode 100644 index 0000000..f980845 --- /dev/null +++ b/tests/Framework/ResultThread.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_result_thread class + * + * @package Tests + */ +class Framework_ResultThread extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_result_thread; + + $this->assertInstanceOf('rcube_result_thread', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Smtp.php b/tests/Framework/Smtp.php new file mode 100644 index 0000000..4bd78d0 --- /dev/null +++ b/tests/Framework/Smtp.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_smtp class + * + * @package Tests + */ +class Framework_Smtp extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_smtp; + + $this->assertInstanceOf('rcube_smtp', $object, "Class constructor"); + } +} diff --git a/tests/Framework/Spellchecker.php b/tests/Framework/Spellchecker.php new file mode 100644 index 0000000..9c3e92f --- /dev/null +++ b/tests/Framework/Spellchecker.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_spellchecker class + * + * @package Tests + */ +class Framework_Spellchecker extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $object = new rcube_spellchecker; + + $this->assertInstanceOf('rcube_spellchecker', $object, "Class constructor"); + } +} diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php new file mode 100644 index 0000000..11210c0 --- /dev/null +++ b/tests/Framework/StringReplacer.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_string_replacer class + * + * @package Tests + */ +class Framework_StringReplacer extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $sr = new rcube_string_replacer; + + $this->assertInstanceOf('rcube_string_replacer', $sr, "Class constructor"); + } +} diff --git a/tests/Framework/User.php b/tests/Framework/User.php new file mode 100644 index 0000000..3b1983c --- /dev/null +++ b/tests/Framework/User.php @@ -0,0 +1,20 @@ +<?php + +/** + * Test class to test rcube_user class + * + * @package Tests + */ +class Framework_User extends PHPUnit_Framework_TestCase +{ + + /** + * Class constructor + */ + function test_class() + { + $user = new rcube_user; + + $this->assertInstanceOf('rcube_user', $user, "Class constructor"); + } +} diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 1bde91b..28f7e74 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -3,8 +3,27 @@ colors="true"> <testsuites> <testsuite name="All Tests"> + <file>Framework/BaseReplacer.php</file> + <file>Framework/Browser.php</file> + <file>Framework/Cache.php</file> + <file>Framework/Charset.php</file> + <file>Framework/ContentFilter.php</file> + <file>Framework/Html.php</file> + <file>Framework/Imap.php</file> + <file>Framework/ImapGeneric.php</file> + <file>Framework/Image.php</file> + <file>Framework/MessageHeader.php</file> + <file>Framework/MessagePart.php</file> <file>Framework/Mime.php</file> + <file>Framework/Rcube.php</file> + <file>Framework/ResultIndex.php</file> + <file>Framework/ResultSet.php</file> + <file>Framework/ResultThread.php</file> <file>Framework/Shared.php</file> + <file>Framework/Smtp.php</file> + <file>Framework/Spellchecker.php</file> + <file>Framework/StringReplacer.php</file> + <file>Framework/User.php</file> <file>Framework/Utils.php</file> <file>Framework/VCard.php</file> <file>HtmlToText.php</file> -- Gitblit v1.9.1