diff options
author | knut <> | 2007-06-04 23:33:06 +0000 |
---|---|---|
committer | knut <> | 2007-06-04 23:33:06 +0000 |
commit | 996bb8664856b302c96e19c6899010ea72ababe6 (patch) | |
tree | 0daad116697c7c9f58bc74244277457ede412348 /tests | |
parent | b7d5fc392611f0cb7f1ff6d87b758cb9572c7806 (diff) |
added more unit test stubs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/AllTests.php | 6 | ||||
-rw-r--r-- | tests/unit/Caching/AllTests.php | 27 | ||||
-rw-r--r-- | tests/unit/Caching/TCacheTest.php | 51 | ||||
-rw-r--r-- | tests/unit/Collections/AllTests.php | 2 | ||||
-rw-r--r-- | tests/unit/Collections/TPagedDataSourceTest.php | 71 | ||||
-rw-r--r-- | tests/unit/Security/AllTests.php | 35 | ||||
-rw-r--r-- | tests/unit/Security/TAuthManagerTest.php | 67 | ||||
-rw-r--r-- | tests/unit/Security/TAuthorizationRuleTest.php | 51 | ||||
-rw-r--r-- | tests/unit/Security/TSecurityManagerTest.php | 59 | ||||
-rw-r--r-- | tests/unit/Security/TUserManagerTest.php | 55 | ||||
-rw-r--r-- | tests/unit/Security/TUserTest.php | 59 | ||||
-rw-r--r-- | tests/unit/Util/AllTests.php | 29 | ||||
-rw-r--r-- | tests/unit/Util/TDateTimeStampTest.php (renamed from tests/unit/Util/DateTimeStampTestCase.php) | 47 | ||||
-rw-r--r-- | tests/unit/Util/TLoggerTest.php | 27 |
14 files changed, 556 insertions, 30 deletions
diff --git a/tests/unit/AllTests.php b/tests/unit/AllTests.php index e097247b..6917ac71 100644 --- a/tests/unit/AllTests.php +++ b/tests/unit/AllTests.php @@ -11,6 +11,9 @@ require_once 'Collections/AllTests.php'; require_once 'I18N/core/AllTests.php'; require_once 'Web/AllTests.php'; require_once 'Web/UI/WebControls/AllTests.php'; +require_once 'Security/AllTests.php'; +require_once 'Caching/AllTests.php'; +require_once 'Util/AllTests.php'; require_once 'TComponentTest.php'; @@ -28,6 +31,9 @@ class AllTests { $suite->addTest(I18N_core_AllTests::suite()); $suite->addTest(Web_AllTests::suite()); $suite->addTest(Web_UI_WebControls_AllTests::suite()); + $suite->addTest(Security_AllTests::suite()); + $suite->addTest(Caching_AllTests::suite()); + $suite->addTest(Util_AllTests::suite()); $suite->addTestSuite('TComponentTest'); diff --git a/tests/unit/Caching/AllTests.php b/tests/unit/Caching/AllTests.php new file mode 100644 index 00000000..072a6182 --- /dev/null +++ b/tests/unit/Caching/AllTests.php @@ -0,0 +1,27 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +if(!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Caching_AllTests::main'); +} + +require_once 'TCacheTest.php'; + +class Caching_AllTests { + public static function main() { + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + public static function suite() { + $suite = new PHPUnit_Framework_TestSuite('System.Caching'); + + $suite->addTestSuite('TCacheTest'); + + return $suite; + } +} + +if(PHPUnit_MAIN_METHOD == 'Caching_AllTests::main') { + Caching_AllTests::main(); +} +?> diff --git a/tests/unit/Caching/TCacheTest.php b/tests/unit/Caching/TCacheTest.php new file mode 100644 index 00000000..76df7903 --- /dev/null +++ b/tests/unit/Caching/TCacheTest.php @@ -0,0 +1,51 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Caching.TCache'); + +/** + * @package System.Caching + */ +class TCacheTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testInit() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testPrimaryCache() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testKeyPrefix() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testGet() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testSet() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testAdd() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testDelete() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testFlush() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Collections/AllTests.php b/tests/unit/Collections/AllTests.php index a8a4e7f8..efa7eb21 100644 --- a/tests/unit/Collections/AllTests.php +++ b/tests/unit/Collections/AllTests.php @@ -11,6 +11,7 @@ require_once 'TQueueTest.php'; require_once 'TStackTest.php'; require_once 'TAttributeCollectionTest.php'; require_once 'TPagedListTest.php'; +require_once 'TPagedDataSourceTest.php'; class Collections_AllTests { public static function main() { @@ -26,6 +27,7 @@ class Collections_AllTests { $suite->addTestSuite('TStackTest'); $suite->addTestSuite('TAttributeCollectionTest'); $suite->addTestSuite('TPagedListTest'); + $suite->addTestSuite('TPagedDataSourceTest'); return $suite; } diff --git a/tests/unit/Collections/TPagedDataSourceTest.php b/tests/unit/Collections/TPagedDataSourceTest.php new file mode 100644 index 00000000..f016c275 --- /dev/null +++ b/tests/unit/Collections/TPagedDataSourceTest.php @@ -0,0 +1,71 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Collections.TPagedDataSource'); + +/** + * @package System.Collections + */ +class TPagedDataSourceTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testDataSource() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testPageSize() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testCurrentPageIndex() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testAllowPaging() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testAllowCustomPaging() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testVirtualItemCount() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testCount() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testPageCount() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIsFirstPage() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIsLastPage() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testFirstIndexInPage() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testDataSourceCount() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIterator() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Security/AllTests.php b/tests/unit/Security/AllTests.php new file mode 100644 index 00000000..7de0996f --- /dev/null +++ b/tests/unit/Security/AllTests.php @@ -0,0 +1,35 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +if(!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Security_AllTests::main'); +} + +require_once 'TAuthManagerTest.php'; +require_once 'TAuthorizationRuleTest.php'; +require_once 'TSecurityManagerTest.php'; +require_once 'TUserManagerTest.php'; +require_once 'TUserTest.php'; + +class Security_AllTests { + public static function main() { + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + public static function suite() { + $suite = new PHPUnit_Framework_TestSuite('System.Security'); + + $suite->addTestSuite('TAuthManagerTest'); + $suite->addTestSuite('TAuthorizationRuleTest'); + $suite->addTestSuite('TSecurityManagerTest'); + $suite->addTestSuite('TUserManagerTest'); + $suite->addTestSuite('TUserTest'); + + return $suite; + } +} + +if(PHPUnit_MAIN_METHOD == 'Security_AllTests::main') { + Security_AllTests::main(); +} +?> diff --git a/tests/unit/Security/TAuthManagerTest.php b/tests/unit/Security/TAuthManagerTest.php new file mode 100644 index 00000000..6e3c05a9 --- /dev/null +++ b/tests/unit/Security/TAuthManagerTest.php @@ -0,0 +1,67 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Security.TAuthManager'); + +/** + * @package System.Security + */ +class TAuthManagerTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testInit() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUserManager() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testLoginPage() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testDoAuthentication() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testDoAuthorization() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testLeave() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testReturnUrl() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testOnAuthenticate() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testOnAuthorize() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUpdateSessionUser() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testLogin() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testLogout() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Security/TAuthorizationRuleTest.php b/tests/unit/Security/TAuthorizationRuleTest.php new file mode 100644 index 00000000..e20542dc --- /dev/null +++ b/tests/unit/Security/TAuthorizationRuleTest.php @@ -0,0 +1,51 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Security.TAuthorizationRule'); + +/** + * @package System.Security + */ +class TAuthorizationRuleTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testConstruct() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testAction() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUsers() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testRoles() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testVerb() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testGuestApplied() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testEveryoneApplied() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIsUserAllowed() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Security/TSecurityManagerTest.php b/tests/unit/Security/TSecurityManagerTest.php new file mode 100644 index 00000000..76029bde --- /dev/null +++ b/tests/unit/Security/TSecurityManagerTest.php @@ -0,0 +1,59 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Security.TSecurityManager'); + +/** + * @package System.Security + */ +class TSecurityManagerTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testInit() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testValidationKey() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testEncryptionKey() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testValidation() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testEncryption() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testEncrypt() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testDecrypt() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testHashData() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testValidateData() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testComputeHMAC() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Security/TUserManagerTest.php b/tests/unit/Security/TUserManagerTest.php new file mode 100644 index 00000000..8937ba22 --- /dev/null +++ b/tests/unit/Security/TUserManagerTest.php @@ -0,0 +1,55 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Security.TUserManager'); + +/** + * @package System.Security + */ +class TUserManagerTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testInit() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUsers() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testRoles() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUserFile() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testGuestName() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testPasswordMode() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testValidateUser() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testUser() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testSwitchToGuest() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Security/TUserTest.php b/tests/unit/Security/TUserTest.php new file mode 100644 index 00000000..67ac6eb4 --- /dev/null +++ b/tests/unit/Security/TUserTest.php @@ -0,0 +1,59 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Security.TUser'); + +/** + * @package System.Security + */ +class TUserTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testConstruct() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testManager() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testName() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIsGuest() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testRoles() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testIsInRole() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testSaveToString() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testLoadFromString() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testState() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testStateChanged() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> diff --git a/tests/unit/Util/AllTests.php b/tests/unit/Util/AllTests.php new file mode 100644 index 00000000..4a9ce809 --- /dev/null +++ b/tests/unit/Util/AllTests.php @@ -0,0 +1,29 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +if(!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Util_AllTests::main'); +} + +require_once 'TDateTimeStampTest.php'; +require_once 'TLoggerTest.php'; + +class Util_AllTests { + public static function main() { + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + public static function suite() { + $suite = new PHPUnit_Framework_TestSuite('System.Util'); + + $suite->addTestSuite('TDateTimeStampTest'); + $suite->addTestSuite('TLoggerTest'); + + return $suite; + } +} + +if(PHPUnit_MAIN_METHOD == 'Util_AllTests::main') { + Util_AllTests::main(); +} +?> diff --git a/tests/unit/Util/DateTimeStampTestCase.php b/tests/unit/Util/TDateTimeStampTest.php index de1413f7..5d296a83 100644 --- a/tests/unit/Util/DateTimeStampTestCase.php +++ b/tests/unit/Util/TDateTimeStampTest.php @@ -1,13 +1,12 @@ <?php
-require_once dirname(__FILE__).'/../phpunit2.php';
+require_once dirname(__FILE__).'/../phpunit.php';
Prado::using('System.Util.TDateTimeStamp');
-class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase
-{
- function testGetTimeStampAndFormat()
- {
+class TDateTimeStampTest extends PHPUnit_Framework_TestCase {
+
+ public function testGetTimeStampAndFormat() {
$s = new TDateTimeStamp;
$t = $s->getTimeStamp(0,0,0);
$this->assertEquals($s->formatDate('Y-m-d'), date('Y-m-d'));
@@ -19,8 +18,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase $this->assertEquals($s->formatDate('Y-m-d',$t), '2102-02-01');
}
- function testGregorianToJulianConversion()
- {
+ public function testGregorianToJulianConversion() {
$s = new TDateTimeStamp;
$t = $s->getTimeStamp(0,0,0,10,11,1492);
@@ -35,8 +33,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase }
- function testGregorianCorrection()
- {
+ public function testGregorianCorrection() {
$s = new TDateTimeStamp;
$diff = $s->getTimeStamp(0,0,0,10,15,1582) - $s->getTimeStamp(0,0,0,10,4,1582);
@@ -48,8 +45,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase $this->assertEquals($s->getDayOfWeek(1582,10,4), 4.0);
}
- function testOverFlow()
- {
+ public function testOverFlow() {
$s = new TDateTimeStamp;
$t = $s->getTimeStamp(0,0,0,3,33,1965);
$this->assertEquals($s->formatDate('Y-m-d',$t), '1965-04-02', 'Error in day overflow 1');
@@ -66,8 +62,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase $this->assertEquals($s->formatDate('Y-m-d',$t), '1966-01-03', 'Error in mth overflow 1');
}
- function test2DigitTo4DigitYearConversion()
- {
+ public function test2DigitTo4DigitYearConversion() {
$s = new TDateTimeStamp;
$this->assertEquals($s->get4DigitYear(00), 2000, "Err 2-digit 2000");
$this->assertEquals($s->get4DigitYear(10), 2010, "Err 2-digit 2010");
@@ -78,16 +73,14 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase $this->assertEquals($s->get4DigitYear(90), 1990, "Err 2-digit 1990");
}
- function testStringFormating()
- {
+ public function testStringFormating() {
$s = new TDateTimeStamp;
$fmt = '\d\a\t\e T Y-m-d H:i:s a A d D F g G h H i j l L m M n O \R\F\C2822 r s t U w y Y z Z 2003';
$s1 = date($fmt,0);
$s2 = $s->formatDate($fmt,0);
$this->assertEquals($s1, $s2);//, " date() 0 failed \n $s1 \n $s2");
- for ($i=100; --$i > 0; )
- {
+ for ($i=10; --$i > 0; ) {
$ts = 3600.0*((rand()%60000)+(rand()%60000))+(rand()%60000);
$s1 = date($fmt,$ts);
$s2 = $s->formatDate($fmt,$ts);
@@ -100,12 +93,10 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase }
}
- function testRandomDatesBetween100And4000()
- {
+ public function testRandomDatesBetween100And4000() {
$this->assertIsValidDate(100,1);
//echo "Testing year ";
- for ($i=100; --$i >= 0;)
- {
+ for ($i=10; --$i >= 0;) {
$y1 = 100+rand(0,1970-100);
//echo $y1." ";
$m = rand(1,12);
@@ -117,8 +108,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase }
}
- function assertIsValidDate($y1,$m,$d=13)
- {
+ public function assertIsValidDate($y1,$m,$d=13) {
$s = new TDateTimeStamp;
$t = $s->getTimeStamp(0,0,0,$m,$d,$y1);
$rez = $s->formatDate('Y-n-j H:i:s',$t);
@@ -126,8 +116,7 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase $this->assertEquals("$y1-$m-$d 00:00:00", $rez);
}
- function testRandomDates()
- {
+ function testRandomDates() {
$start = 1960+rand(0,10);
$yrs = 12;
$i = 365.25*86400*($start-1970);
@@ -140,16 +129,14 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase // and check if the roundtrip broke the original timestamp value.
//print "Testing $start to ".($start+$yrs).", or $max seconds, offset=$offset: ";
$fails = 0;
- for ($max += $i; $i < $max; $i += $offset)
- {
+ for ($max += $i; $i < $max; $i += $offset) {
$ret = $s->formatDate('m,d,Y,H,i,s',$i);
$arr = explode(',',$ret);
if ($lastyear != $arr[2])
$lastyear = $arr[2];
$newi = $s->getTimestamp($arr[3],$arr[4],$arr[5],$arr[0],$arr[1],$arr[2]);
- if ($i != $newi)
- {
+ if ($i != $newi) {
$fails++;
//$j = mktime($arr[3],$arr[4],$arr[5],$arr[0],$arr[1],$arr[2]);
//print "Error at $i, $j, getTimestamp() returned $newi ($ret)\n";
@@ -159,4 +146,4 @@ class DateTimeStampTestCase extends PHPUnit2_Framework_TestCase }
}
-?>
\ No newline at end of file +?>
diff --git a/tests/unit/Util/TLoggerTest.php b/tests/unit/Util/TLoggerTest.php new file mode 100644 index 00000000..4da5aaa1 --- /dev/null +++ b/tests/unit/Util/TLoggerTest.php @@ -0,0 +1,27 @@ +<?php +require_once dirname(__FILE__).'/../phpunit.php'; + +Prado::using('System.Util.TLogger'); + +/** + * @package System.Util + */ +class TLoggerTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + } + + public function tearDown() { + } + + public function testLog() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + + public function testGetLogs() { + throw new PHPUnit_Framework_IncompleteTestError(); + } + +} + +?> |