summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid <ottodavid@gmx.net>2015-08-10 06:42:01 +0200
committerDavid <ottodavid@gmx.net>2015-08-10 17:22:33 +0200
commit2bf1a517f3edc1bd43b8e3340f0f6fd31b1ba94a (patch)
tree285d7182be15299d8c0cdac1bd8aa1e397fa69d4
parent92ee7558c6b6dd2461b645cb1f19a81ef8c50db5 (diff)
fix unit tests
-rw-r--r--framework/Security/TSecurityManager.php2
-rw-r--r--tests/test_tools/phpunit_bootstrap.php6
-rw-r--r--tests/unit/Caching/TAPCCacheTest.php6
-rw-r--r--tests/unit/Caching/TDirectoryCacheDependencyTest.php2
-rw-r--r--tests/unit/Caching/TFileCacheDependencyTest.php1
-rw-r--r--tests/unit/Caching/TMemCacheTest.php4
-rw-r--r--tests/unit/Caching/TSqliteCacheTest.php4
-rw-r--r--tests/unit/Collections/TAttributeCollectionTest.php4
-rw-r--r--tests/unit/Collections/TListTest.php5
-rw-r--r--tests/unit/Collections/TMapTest.php5
-rw-r--r--tests/unit/Collections/TPagedDataSourceTest.php1
-rw-r--r--tests/unit/Collections/TPagedListTest.php6
-rw-r--r--tests/unit/Collections/TPriorityListTest.php7
-rw-r--r--tests/unit/Collections/TPriorityMapTest.php6
-rw-r--r--tests/unit/Collections/TQueueTest.php5
-rw-r--r--tests/unit/Collections/TStackTest.php5
-rw-r--r--tests/unit/Data/DataGateway/TSqlCriteriaTest.php3
-rw-r--r--tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php4
-rw-r--r--tests/unit/Data/SqlMap/DynamicParameterTest.php7
-rw-r--r--tests/unit/Data/TDbCommandTest.php6
-rw-r--r--tests/unit/Data/TDbConnectionTest.php8
-rw-r--r--tests/unit/Data/TDbDataReaderTest.php5
-rw-r--r--tests/unit/Data/TDbTransactionTest.php4
-rw-r--r--tests/unit/I18N/core/ChoiceFormatTest.php3
-rw-r--r--tests/unit/I18N/core/CultureInfoTest.php3
-rw-r--r--tests/unit/I18N/core/DateFormatTest.php3
-rw-r--r--tests/unit/I18N/core/DateTimeFormatInfoTest.php3
-rw-r--r--tests/unit/I18N/core/NumberFormatInfoTest.php3
-rw-r--r--tests/unit/I18N/core/NumberFormatTest.php3
-rw-r--r--tests/unit/IO/TTarFileExtractorTest.php1
-rw-r--r--tests/unit/IO/TTextWriterTest.php3
-rw-r--r--tests/unit/PradoBaseTest.php40
-rw-r--r--tests/unit/Security/TAuthManagerTest.php10
-rw-r--r--tests/unit/Security/TAuthorizationRuleTest.php1
-rw-r--r--tests/unit/Security/TSecurityManagerTest.php6
-rw-r--r--tests/unit/Security/TUserManagerTest.php9
-rw-r--r--tests/unit/Security/TUserTest.php8
-rw-r--r--tests/unit/TComponentTest.php20
-rw-r--r--tests/unit/Util/TDateTimeStampTest.php3
-rw-r--r--tests/unit/Util/TLoggerTest.php1
-rw-r--r--tests/unit/Util/TSimpleDateFormatterTest.php3
-rw-r--r--tests/unit/Web/TAssetManagerTest.php8
-rw-r--r--tests/unit/Web/TCacheHttpSessionTest.php7
-rw-r--r--tests/unit/Web/THttpCookieCollectionTest.php6
-rw-r--r--tests/unit/Web/THttpCookieTest.php3
-rw-r--r--tests/unit/Web/THttpRequestTest.php14
-rw-r--r--tests/unit/Web/THttpResponseTest.php6
-rw-r--r--tests/unit/Web/THttpSessionTest.php4
-rw-r--r--tests/unit/Web/THttpUtilityTest.php3
-rw-r--r--tests/unit/Web/TUriTest.php4
-rw-r--r--tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php3
-rw-r--r--tests/unit/Web/UI/TClientScriptManagerTest.php1
-rw-r--r--tests/unit/Web/UI/TControlAdapterTest.php1
-rw-r--r--tests/unit/Web/UI/TControlTest.php1
-rw-r--r--tests/unit/Web/UI/TFormTest.php1
-rw-r--r--tests/unit/Web/UI/THtmlWriterTest.php6
-rw-r--r--tests/unit/Web/UI/TPageStatePersisterTest.php1
-rw-r--r--tests/unit/Web/UI/TPageTest.php1
-rw-r--r--tests/unit/Web/UI/TSessionPageStatePersisterTest.php1
-rw-r--r--tests/unit/Web/UI/TTemplateControlTest.php1
-rw-r--r--tests/unit/Web/UI/TTemplateManagerTest.php1
-rw-r--r--tests/unit/Web/UI/TTemplateTest.php1
-rw-r--r--tests/unit/Web/UI/TThemeManagerTest.php1
-rw-r--r--tests/unit/Web/UI/TThemeTest.php1
-rw-r--r--tests/unit/Web/UI/WebControls/TDropDownListTest.php4
-rw-r--r--tests/unit/Web/UI/WebControls/TLabelTest.php4
-rw-r--r--tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php4
-rw-r--r--tests/unit/Web/UI/WebControls/TXmlTransformTest.php7
-rw-r--r--tests/unit/Xml/TXmlDocumentTest.php5
-rw-r--r--tests/unit/Xml/TXmlElementListTest.php5
-rw-r--r--tests/unit/Xml/TXmlElementTest.php4
71 files changed, 256 insertions, 82 deletions
diff --git a/framework/Security/TSecurityManager.php b/framework/Security/TSecurityManager.php
index e0239f8e..e8e355c7 100644
--- a/framework/Security/TSecurityManager.php
+++ b/framework/Security/TSecurityManager.php
@@ -151,7 +151,7 @@ class TSecurityManager extends \Prado\TModule
*/
public function setValidation($value)
{
- $this->_hashAlgorithm = TPropertyValue::ensureEnum($value, 'TSecurityManagerValidationMode');
+ $this->_hashAlgorithm = TPropertyValue::ensureEnum($value, 'Prado\\Security\\TSecurityManagerValidationMode');
}
/**
diff --git a/tests/test_tools/phpunit_bootstrap.php b/tests/test_tools/phpunit_bootstrap.php
index c1cb423f..b3367a57 100644
--- a/tests/test_tools/phpunit_bootstrap.php
+++ b/tests/test_tools/phpunit_bootstrap.php
@@ -6,9 +6,9 @@
* the right package in unit test and code coverage reports.
*/
-define('PRADO_TEST_RUN', true);
-define('PRADO_FRAMEWORK_DIR', dirname(__FILE__).'/../../framework');
-define('VENDOR_DIR', dirname(__FILE__).'/../../vendor');
+defined('PRADO_TEST_RUN') or define('PRADO_TEST_RUN', true);
+defined('PRADO_FRAMEWORK_DIR') or define('PRADO_FRAMEWORK_DIR', dirname(__FILE__).'/../../framework');
+defined('VENDOR_DIR') or define('VENDOR_DIR', dirname(__FILE__).'/../../vendor');
set_include_path(PRADO_FRAMEWORK_DIR.PATH_SEPARATOR.get_include_path());
// coverage tests waste a lot of memory!
ini_set('memory_limit', '1G');
diff --git a/tests/unit/Caching/TAPCCacheTest.php b/tests/unit/Caching/TAPCCacheTest.php
index ccb6ee85..d5ea4f92 100644
--- a/tests/unit/Caching/TAPCCacheTest.php
+++ b/tests/unit/Caching/TAPCCacheTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Caching.TAPCCache');
+use Prado\Caching\TAPCCache;
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TNotSupportedException;
+use Prado\TApplication;
+
/**
* @package System.Caching
diff --git a/tests/unit/Caching/TDirectoryCacheDependencyTest.php b/tests/unit/Caching/TDirectoryCacheDependencyTest.php
index 10da9b58..7a18004f 100644
--- a/tests/unit/Caching/TDirectoryCacheDependencyTest.php
+++ b/tests/unit/Caching/TDirectoryCacheDependencyTest.php
@@ -1,4 +1,6 @@
<?php
+use Prado\Caching\TDirectoryCacheDependency;
+use Prado\Exceptions\TInvalidDataValueException;
/**
* @package System.Caching
diff --git a/tests/unit/Caching/TFileCacheDependencyTest.php b/tests/unit/Caching/TFileCacheDependencyTest.php
index 24f2721b..fa6e8965 100644
--- a/tests/unit/Caching/TFileCacheDependencyTest.php
+++ b/tests/unit/Caching/TFileCacheDependencyTest.php
@@ -1,4 +1,5 @@
<?php
+use Prado\Caching\TFileCacheDependency;
/**
* @package System.Caching
diff --git a/tests/unit/Caching/TMemCacheTest.php b/tests/unit/Caching/TMemCacheTest.php
index 3d0d651f..a5cafc72 100644
--- a/tests/unit/Caching/TMemCacheTest.php
+++ b/tests/unit/Caching/TMemCacheTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Caching.TMemCache');
+use Prado\Caching\TMemCache;
+use Prado\TApplication;
+
/**
* @package System.Caching
diff --git a/tests/unit/Caching/TSqliteCacheTest.php b/tests/unit/Caching/TSqliteCacheTest.php
index b979b0ec..060fcf86 100644
--- a/tests/unit/Caching/TSqliteCacheTest.php
+++ b/tests/unit/Caching/TSqliteCacheTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Caching.TSqliteCache');
+use Prado\Caching\TSqliteCache;
+use Prado\TApplication;
+
/**
* @package System.Caching
diff --git a/tests/unit/Collections/TAttributeCollectionTest.php b/tests/unit/Collections/TAttributeCollectionTest.php
index f61f58b3..9ce5ef82 100644
--- a/tests/unit/Collections/TAttributeCollectionTest.php
+++ b/tests/unit/Collections/TAttributeCollectionTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Collections.TAttributeCollection');
+use Prado\Collections\TAttributeCollection;
+use Prado\Exceptions\TInvalidOperationException;
+
/**
* @package System.Collections
diff --git a/tests/unit/Collections/TListTest.php b/tests/unit/Collections/TListTest.php
index 9d6950b9..be1da09d 100644
--- a/tests/unit/Collections/TListTest.php
+++ b/tests/unit/Collections/TListTest.php
@@ -1,5 +1,10 @@
<?php
+use Prado\Collections\TList;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TInvalidOperationException;
+
class ListItem {
public $data='data';
}
diff --git a/tests/unit/Collections/TMapTest.php b/tests/unit/Collections/TMapTest.php
index da198eb4..b817c1a0 100644
--- a/tests/unit/Collections/TMapTest.php
+++ b/tests/unit/Collections/TMapTest.php
@@ -1,5 +1,10 @@
<?php
+use Prado\Collections\TList;
+use Prado\Collections\TMap;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidOperationException;
+
class TMapTest_MapItem {
public $data='data';
}
diff --git a/tests/unit/Collections/TPagedDataSourceTest.php b/tests/unit/Collections/TPagedDataSourceTest.php
index ebb8e60d..64b0c4be 100644
--- a/tests/unit/Collections/TPagedDataSourceTest.php
+++ b/tests/unit/Collections/TPagedDataSourceTest.php
@@ -1,6 +1,5 @@
<?php
-Prado::using('System.Collections.TPagedDataSource');
/**
* @package System.Collections
diff --git a/tests/unit/Collections/TPagedListTest.php b/tests/unit/Collections/TPagedListTest.php
index a225db61..c20c0319 100644
--- a/tests/unit/Collections/TPagedListTest.php
+++ b/tests/unit/Collections/TPagedListTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Collections.TPagedList');
+use Prado\Collections\TPagedList;
+use Prado\Collections\TPagedListFetchDataEventParameter;
+use Prado\Collections\TPagedListPageChangedEventParameter;
+use Prado\Exceptions\TInvalidDataValueException;
+
class MyPagedList extends TPagedList {
diff --git a/tests/unit/Collections/TPriorityListTest.php b/tests/unit/Collections/TPriorityListTest.php
index d1570302..4219b942 100644
--- a/tests/unit/Collections/TPriorityListTest.php
+++ b/tests/unit/Collections/TPriorityListTest.php
@@ -1,5 +1,11 @@
<?php
+use Prado\Collections\TPriorityList;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\Prado;
+
class PriorityListItem
{
var $data = 'data';
@@ -8,7 +14,6 @@ class PriorityListItem
$this->data = $d;
}
}
-Prado::using('System.Collections.TPriorityList');
/**
* All Test cases for the TList are here. The TPriorityList should act just like a TList when used exactly like a TList
diff --git a/tests/unit/Collections/TPriorityMapTest.php b/tests/unit/Collections/TPriorityMapTest.php
index 847e09fe..8aa9110d 100644
--- a/tests/unit/Collections/TPriorityMapTest.php
+++ b/tests/unit/Collections/TPriorityMapTest.php
@@ -1,10 +1,14 @@
<?php
+use Prado\Collections\TList;
+use Prado\Collections\TPriorityMap;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidOperationException;
+
class TPriorityMapTest_MapItem {
public $data='data';
}
-Prado::using('System.Collections.TPriorityMap');
/**
* @package System.Collections
*/
diff --git a/tests/unit/Collections/TQueueTest.php b/tests/unit/Collections/TQueueTest.php
index da60eae3..531214aa 100644
--- a/tests/unit/Collections/TQueueTest.php
+++ b/tests/unit/Collections/TQueueTest.php
@@ -1,6 +1,9 @@
<?php
-Prado::using('System.Collections.TQueue');
+use Prado\Collections\TQueue;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidOperationException;
+
/**
* @package System.Collections
diff --git a/tests/unit/Collections/TStackTest.php b/tests/unit/Collections/TStackTest.php
index 80dc77c3..39bc50ed 100644
--- a/tests/unit/Collections/TStackTest.php
+++ b/tests/unit/Collections/TStackTest.php
@@ -1,6 +1,9 @@
<?php
-Prado::using('System.Collections.TStack');
+use Prado\Collections\TStack;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidOperationException;
+
/**
* @package System.Collections
diff --git a/tests/unit/Data/DataGateway/TSqlCriteriaTest.php b/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
index ce22ef1d..58796947 100644
--- a/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
+++ b/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.Data.DataGateway.TSqlCriteria');
+use Prado\Data\DataGateway\TSqlCriteria;
+
/**
* @package System.Data.DataGateway
diff --git a/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php b/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
index 3f5493c7..99118927 100644
--- a/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
+++ b/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
@@ -1,8 +1,8 @@
<?php
-Prado::using('System.Data.SqlMap.DataMapper.TSqlMapException');
-Prado::using('System.Data.SqlMap.DataMapper.TPropertyAccess');
+use Prado\Data\SqlMap\DataMapper\TPropertyAccess;
+
/**
* @package System.Data.SqlMap.DataMapper
diff --git a/tests/unit/Data/SqlMap/DynamicParameterTest.php b/tests/unit/Data/SqlMap/DynamicParameterTest.php
index 136111db..414f819f 100644
--- a/tests/unit/Data/SqlMap/DynamicParameterTest.php
+++ b/tests/unit/Data/SqlMap/DynamicParameterTest.php
@@ -1,8 +1,11 @@
<?php
-Prado::using('System.Data.*');
-Prado::using('System.Data.SqlMap.*');
+use Prado\Data\SqlMap\TSqlMapManager;
+use Prado\Data\TDbConnection;
+use Prado\Prado;
+use Prado\TApplication;
+
/**
* @package System.Data.SqlMap
diff --git a/tests/unit/Data/TDbCommandTest.php b/tests/unit/Data/TDbCommandTest.php
index 87bbbf05..f9ae25b7 100644
--- a/tests/unit/Data/TDbCommandTest.php
+++ b/tests/unit/Data/TDbCommandTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Data.*');
+use Prado\Data\TDbConnection;
+use Prado\Data\TDbDataReader;
+use Prado\Exceptions\TDbException;
+use Prado\TApplication;
+
if(!defined('TEST_DB_FILE'))
define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
diff --git a/tests/unit/Data/TDbConnectionTest.php b/tests/unit/Data/TDbConnectionTest.php
index 4b32300c..e6d47f39 100644
--- a/tests/unit/Data/TDbConnectionTest.php
+++ b/tests/unit/Data/TDbConnectionTest.php
@@ -1,6 +1,12 @@
<?php
-Prado::using('System.Data.*');
+use Prado\Data\TDbColumnCaseMode;
+use Prado\Data\TDbCommand;
+use Prado\Data\TDbConnection;
+use Prado\Data\TDbNullConversionMode;
+use Prado\Exceptions\TDbException;
+use Prado\TApplication;
+
if(!defined('TEST_DB_FILE'))
define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
diff --git a/tests/unit/Data/TDbDataReaderTest.php b/tests/unit/Data/TDbDataReaderTest.php
index 2e31245e..67fc6f29 100644
--- a/tests/unit/Data/TDbDataReaderTest.php
+++ b/tests/unit/Data/TDbDataReaderTest.php
@@ -1,6 +1,9 @@
<?php
-Prado::using('System.Data.*');
+use Prado\Data\TDbConnection;
+use Prado\Exceptions\TDbException;
+use Prado\TApplication;
+
if(!defined('TEST_DB_FILE'))
define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
diff --git a/tests/unit/Data/TDbTransactionTest.php b/tests/unit/Data/TDbTransactionTest.php
index b51fda04..ee8f7c4c 100644
--- a/tests/unit/Data/TDbTransactionTest.php
+++ b/tests/unit/Data/TDbTransactionTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Data.*');
+use Prado\Data\TDbConnection;
+use Prado\TApplication;
+
if(!defined('TEST_DB_FILE'))
define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
diff --git a/tests/unit/I18N/core/ChoiceFormatTest.php b/tests/unit/I18N/core/ChoiceFormatTest.php
index 2c8ab5cb..8833a5a2 100644
--- a/tests/unit/I18N/core/ChoiceFormatTest.php
+++ b/tests/unit/I18N/core/ChoiceFormatTest.php
@@ -1,6 +1,7 @@
<?php
-Prado::using('System.I18N.core.ChoiceFormat');
+use Prado\I18N\core\ChoiceFormat;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/I18N/core/CultureInfoTest.php b/tests/unit/I18N/core/CultureInfoTest.php
index 58c8f235..94a3c66c 100644
--- a/tests/unit/I18N/core/CultureInfoTest.php
+++ b/tests/unit/I18N/core/CultureInfoTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.I18N.core.CultureInfo');
+use Prado\I18N\core\CultureInfo;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/I18N/core/DateFormatTest.php b/tests/unit/I18N/core/DateFormatTest.php
index d8350204..b6a8667a 100644
--- a/tests/unit/I18N/core/DateFormatTest.php
+++ b/tests/unit/I18N/core/DateFormatTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.I18N.core.DateFormat');
+use Prado\I18N\core\DateFormat;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/I18N/core/DateTimeFormatInfoTest.php b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
index ac93e1c7..b9717ac4 100644
--- a/tests/unit/I18N/core/DateTimeFormatInfoTest.php
+++ b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.I18N.core.DateTimeFormatInfo');
+use Prado\I18N\core\DateTimeFormatInfo;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/I18N/core/NumberFormatInfoTest.php b/tests/unit/I18N/core/NumberFormatInfoTest.php
index 6243095a..fb1b7a8a 100644
--- a/tests/unit/I18N/core/NumberFormatInfoTest.php
+++ b/tests/unit/I18N/core/NumberFormatInfoTest.php
@@ -2,7 +2,8 @@
//NOTE: This page require UTF-8 aware editors
-Prado::using('System.I18N.core.NumberFormatInfo');
+use Prado\I18N\core\NumberFormatInfo;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/I18N/core/NumberFormatTest.php b/tests/unit/I18N/core/NumberFormatTest.php
index ef8add77..d43c0248 100644
--- a/tests/unit/I18N/core/NumberFormatTest.php
+++ b/tests/unit/I18N/core/NumberFormatTest.php
@@ -2,7 +2,8 @@
//NOTE: This page require UTF-8 aware editors
-Prado::using('System.I18N.core.NumberFormat');
+use Prado\I18N\core\NumberFormat;
+
/**
* @package System.I18N.core
diff --git a/tests/unit/IO/TTarFileExtractorTest.php b/tests/unit/IO/TTarFileExtractorTest.php
index 860560b1..9a511476 100644
--- a/tests/unit/IO/TTarFileExtractorTest.php
+++ b/tests/unit/IO/TTarFileExtractorTest.php
@@ -1,6 +1,5 @@
<?php
-Prado::using('System.IO.TTarFileExtractor');
/**
* @package System.IO
diff --git a/tests/unit/IO/TTextWriterTest.php b/tests/unit/IO/TTextWriterTest.php
index 087812d7..2ef149e4 100644
--- a/tests/unit/IO/TTextWriterTest.php
+++ b/tests/unit/IO/TTextWriterTest.php
@@ -1,6 +1,7 @@
<?php
-Prado::using('System.IO.TTextWriter');
+use Prado\IO\TTextWriter;
+
/**
* @package System.IO
diff --git a/tests/unit/PradoBaseTest.php b/tests/unit/PradoBaseTest.php
new file mode 100644
index 00000000..94abb25e
--- /dev/null
+++ b/tests/unit/PradoBaseTest.php
@@ -0,0 +1,40 @@
+<?php
+
+use Prado\Prado;
+
+/**
+ * @runTestsInSeparateProcesses
+ */
+class PradoBaseTest extends PHPUnit_Framework_TestCase
+{
+ const INTERFACE_FQN = 'Prado\\Web\\UI\\IValidatable';
+ const INTERFACE_SHORT_NAME = 'IValidatable';
+ const CLASS_FQN = 'Prado\\Web\\UI\\WebControls\\TButton';
+ const CLASS_PRADO_FULLNAME = 'System.Web.UI.WebControls.TButton';
+
+ public function testUsingNamespace()
+ {
+ $this->assertFalse(class_exists(self::CLASS_FQN, false));
+ Prado::using(self::CLASS_FQN);
+ $this->assertTrue(class_exists(self::CLASS_FQN, false));
+ }
+
+ public function testUsingInterface()
+ {
+ $this->assertFalse(interface_exists(self::INTERFACE_SHORT_NAME, false));
+ Prado::using(self::INTERFACE_FQN);
+ $this->assertTrue(interface_exists(self::INTERFACE_SHORT_NAME, false));
+ }
+
+ public function testCreateComponentWithNamespace()
+ {
+ $this->assertInstanceOf(self::CLASS_FQN, Prado::createComponent(self::CLASS_FQN));
+ }
+
+ public function testCreateComponentWithPradoNamespace()
+ {
+ $this->assertInstanceOf(self::CLASS_FQN, Prado::createComponent(self::CLASS_PRADO_FULLNAME));
+ }
+
+
+}
diff --git a/tests/unit/Security/TAuthManagerTest.php b/tests/unit/Security/TAuthManagerTest.php
index 3b8b9305..b61953e5 100644
--- a/tests/unit/Security/TAuthManagerTest.php
+++ b/tests/unit/Security/TAuthManagerTest.php
@@ -1,8 +1,12 @@
<?php
-Prado::using('System.Security.TAuthManager');
-Prado::using('System.Security.TUserManager');
-Prado::using('System.Xml.TXmlDocument');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\Security\TAuthManager;
+use Prado\Security\TUserManager;
+use Prado\TApplication;
+use Prado\Xml\TXmlDocument;
+
/**
* @package System.Security
diff --git a/tests/unit/Security/TAuthorizationRuleTest.php b/tests/unit/Security/TAuthorizationRuleTest.php
index 5bfa6c2c..8e8a3fde 100644
--- a/tests/unit/Security/TAuthorizationRuleTest.php
+++ b/tests/unit/Security/TAuthorizationRuleTest.php
@@ -1,6 +1,5 @@
<?php
-Prado::using('System.Security.TAuthorizationRule');
/**
* @package System.Security
diff --git a/tests/unit/Security/TSecurityManagerTest.php b/tests/unit/Security/TSecurityManagerTest.php
index 9c319a5a..29850f29 100644
--- a/tests/unit/Security/TSecurityManagerTest.php
+++ b/tests/unit/Security/TSecurityManagerTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Security.TSecurityManager');
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TNotSupportedException;
+use Prado\Security\TSecurityManager;
+use Prado\TApplication;
+
/**
* @package System.Security
diff --git a/tests/unit/Security/TUserManagerTest.php b/tests/unit/Security/TUserManagerTest.php
index 91b9d0c6..146e590b 100644
--- a/tests/unit/Security/TUserManagerTest.php
+++ b/tests/unit/Security/TUserManagerTest.php
@@ -1,6 +1,13 @@
<?php
-Prado::using('System.Security.TUserManager');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\Prado;
+use Prado\Security\TUserManager;
+use Prado\TApplication;
+use Prado\Xml\TXmlDocument;
+
/**
* @package System.Security
diff --git a/tests/unit/Security/TUserTest.php b/tests/unit/Security/TUserTest.php
index 3692b97c..c707cb25 100644
--- a/tests/unit/Security/TUserTest.php
+++ b/tests/unit/Security/TUserTest.php
@@ -1,7 +1,11 @@
<?php
-Prado::using('System.Security.TUser');
-Prado::using('System.Security.TUserManager');
+use Prado\Prado;
+use Prado\Security\TUser;
+use Prado\Security\TUserManager;
+use Prado\TApplication;
+use Prado\Xml\TXmlDocument;
+
/**
* @package System.Security
diff --git a/tests/unit/TComponentTest.php b/tests/unit/TComponentTest.php
index 9a2299da..66b90684 100644
--- a/tests/unit/TComponentTest.php
+++ b/tests/unit/TComponentTest.php
@@ -1,8 +1,16 @@
<?php
-Prado::using('System.Util.*');
-Prado::using('System.Collections.TPriorityList');
-Prado::using('System.Collections.TPriorityMap');
+use Prado\Collections\TPriorityList;
+use Prado\Exceptions\TApplicationException;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\TComponent;
+use Prado\TEventResults;
+use Prado\Util\IDynamicMethods;
+use Prado\Util\IInstanceCheck;
+use Prado\Util\TBehavior;
+use Prado\Util\TClassBehavior;
+
class NewComponent extends TComponent {
private $_object = null;
@@ -624,9 +632,9 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
public function testGetClassHierarchy() {
$component = new DynamicCatchingComponent;
- $this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy());
- $this->assertEquals(array('TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy(false));
- $this->assertEquals(array('tcomponent', 'newcomponent', 'newcomponentnolisten', 'dynamiccatchingcomponent'), $component->getClassHierarchy(true));
+ $this->assertEquals(array('Prado\TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy());
+ $this->assertEquals(array('Prado\TComponent', 'NewComponent', 'NewComponentNoListen', 'DynamicCatchingComponent'), $component->getClassHierarchy(false));
+ $this->assertEquals(array('prado\tcomponent', 'newcomponent', 'newcomponentnolisten', 'dynamiccatchingcomponent'), $component->getClassHierarchy(true));
}
diff --git a/tests/unit/Util/TDateTimeStampTest.php b/tests/unit/Util/TDateTimeStampTest.php
index 37784ef3..6d2a7c24 100644
--- a/tests/unit/Util/TDateTimeStampTest.php
+++ b/tests/unit/Util/TDateTimeStampTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.Util.TDateTimeStamp');
+use Prado\Util\TDateTimeStamp;
+
/**
* @package System.Util
diff --git a/tests/unit/Util/TLoggerTest.php b/tests/unit/Util/TLoggerTest.php
index 03b36c5b..fef1d95b 100644
--- a/tests/unit/Util/TLoggerTest.php
+++ b/tests/unit/Util/TLoggerTest.php
@@ -1,6 +1,5 @@
<?php
-Prado::using('System.Util.TLogger');
/**
* @package System.Util
diff --git a/tests/unit/Util/TSimpleDateFormatterTest.php b/tests/unit/Util/TSimpleDateFormatterTest.php
index ce6f1234..a400a86e 100644
--- a/tests/unit/Util/TSimpleDateFormatterTest.php
+++ b/tests/unit/Util/TSimpleDateFormatterTest.php
@@ -1,6 +1,7 @@
<?php
-Prado::using('System.Util.TSimpleDateFormatter');
+use Prado\Util\TSimpleDateFormatter;
+
/**
* @package System.Util
diff --git a/tests/unit/Web/TAssetManagerTest.php b/tests/unit/Web/TAssetManagerTest.php
index 13d2d6c1..31837ca7 100644
--- a/tests/unit/Web/TAssetManagerTest.php
+++ b/tests/unit/Web/TAssetManagerTest.php
@@ -1,6 +1,12 @@
<?php
-Prado::using('System.Web.TAssetManager');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\Prado;
+use Prado\TApplication;
+use Prado\Web\TAssetManager;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/TCacheHttpSessionTest.php b/tests/unit/Web/TCacheHttpSessionTest.php
index 8475cd37..4bfd3b1a 100644
--- a/tests/unit/Web/TCacheHttpSessionTest.php
+++ b/tests/unit/Web/TCacheHttpSessionTest.php
@@ -1,7 +1,10 @@
<?php
-Prado::using('System.Web.TCacheHttpSession');
-Prado::using('System.Caching.TMemCache');
+use Prado\Caching\TMemCache;
+use Prado\Exceptions\TConfigurationException;
+use Prado\TApplication;
+use Prado\Web\TCacheHttpSession;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/THttpCookieCollectionTest.php b/tests/unit/Web/THttpCookieCollectionTest.php
index aa091788..14b3f923 100644
--- a/tests/unit/Web/THttpCookieCollectionTest.php
+++ b/tests/unit/Web/THttpCookieCollectionTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Web.THttpRequest');
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Web\THttpCookie;
+use Prado\Web\THttpCookieCollection;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/THttpCookieTest.php b/tests/unit/Web/THttpCookieTest.php
index 206ef105..5eb3496d 100644
--- a/tests/unit/Web/THttpCookieTest.php
+++ b/tests/unit/Web/THttpCookieTest.php
@@ -1,6 +1,7 @@
<?php
-Prado::using('System.Web.THttpRequest');
+use Prado\Web\THttpCookie;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/THttpRequestTest.php b/tests/unit/Web/THttpRequestTest.php
index 7f5da17d..9b8168c3 100644
--- a/tests/unit/Web/THttpRequestTest.php
+++ b/tests/unit/Web/THttpRequestTest.php
@@ -1,7 +1,17 @@
<?php
-Prado::using('System.Web.THttpRequest');
-Prado::using('System.Security.TSecurityManager');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Prado;
+use Prado\Security\TSecurityManager;
+use Prado\TApplication;
+use Prado\Web\TAssetManager;
+use Prado\Web\THttpRequest;
+use Prado\Web\THttpRequestUrlFormat;
+use Prado\Web\TUrlManager;
+use Prado\Web\TUrlMapping;
+use Prado\Xml\TXmlDocument;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/THttpResponseTest.php b/tests/unit/Web/THttpResponseTest.php
index 0855bf4d..9af89900 100644
--- a/tests/unit/Web/THttpResponseTest.php
+++ b/tests/unit/Web/THttpResponseTest.php
@@ -1,6 +1,10 @@
<?php
-Prado::using('System.Web.THttpResponse');
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\TApplication;
+use Prado\Web\THttpResponse;
+
/**
diff --git a/tests/unit/Web/THttpSessionTest.php b/tests/unit/Web/THttpSessionTest.php
index eb1ec4df..f0988fd6 100644
--- a/tests/unit/Web/THttpSessionTest.php
+++ b/tests/unit/Web/THttpSessionTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Web.THttpSession');
+use Prado\Web\THttpSession;
+use Prado\Web\THttpSessionCookieMode;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/THttpUtilityTest.php b/tests/unit/Web/THttpUtilityTest.php
index 7f4e6705..0f001ad8 100644
--- a/tests/unit/Web/THttpUtilityTest.php
+++ b/tests/unit/Web/THttpUtilityTest.php
@@ -1,6 +1,7 @@
<?php
-Prado::using('System.Web.THttpUtility');
+use Prado\Web\THttpUtility;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/TUriTest.php b/tests/unit/Web/TUriTest.php
index b610cd1b..29489842 100644
--- a/tests/unit/Web/TUriTest.php
+++ b/tests/unit/Web/TUriTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Web.THttpRequest');
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Web\TUri;
+
/**
* @package System.Web
diff --git a/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php b/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
index 6e80bd12..5a8e12c9 100644
--- a/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
+++ b/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
@@ -1,7 +1,8 @@
<?php
-Prado::using('System.Web.UI.ActiveControls.TActiveHiddenField');
+use Prado\Web\UI\ActiveControls\TActiveHiddenField;
+
/**
* @package System.Web.UI.ActiveControls
diff --git a/tests/unit/Web/UI/TClientScriptManagerTest.php b/tests/unit/Web/UI/TClientScriptManagerTest.php
index efce0009..b3b02b7c 100644
--- a/tests/unit/Web/UI/TClientScriptManagerTest.php
+++ b/tests/unit/Web/UI/TClientScriptManagerTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TClientScriptManager');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TControlAdapterTest.php b/tests/unit/Web/UI/TControlAdapterTest.php
index ff687cc8..be8ac797 100644
--- a/tests/unit/Web/UI/TControlAdapterTest.php
+++ b/tests/unit/Web/UI/TControlAdapterTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TControlAdapter');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TControlTest.php b/tests/unit/Web/UI/TControlTest.php
index b6741167..5fe4a33a 100644
--- a/tests/unit/Web/UI/TControlTest.php
+++ b/tests/unit/Web/UI/TControlTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TControl');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TFormTest.php b/tests/unit/Web/UI/TFormTest.php
index 7fb6d2b7..c90cec76 100644
--- a/tests/unit/Web/UI/TFormTest.php
+++ b/tests/unit/Web/UI/TFormTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TForm');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/THtmlWriterTest.php b/tests/unit/Web/UI/THtmlWriterTest.php
index cf3b27e3..e99238ad 100644
--- a/tests/unit/Web/UI/THtmlWriterTest.php
+++ b/tests/unit/Web/UI/THtmlWriterTest.php
@@ -1,7 +1,11 @@
<?php
-Prado::using('System.Web.UI.THtmlWriter');
+use Prado\IO\ITextWriter;
+use Prado\TComponent;
+use Prado\Web\THttpUtility;
+use Prado\Web\UI\THtmlWriter;
+
/**
* Implement a writer that flush the content to a variable, to simulate a real flush
diff --git a/tests/unit/Web/UI/TPageStatePersisterTest.php b/tests/unit/Web/UI/TPageStatePersisterTest.php
index 8ee1cfc9..f70dd0cc 100644
--- a/tests/unit/Web/UI/TPageStatePersisterTest.php
+++ b/tests/unit/Web/UI/TPageStatePersisterTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TPageStatePersister');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TPageTest.php b/tests/unit/Web/UI/TPageTest.php
index c1593816..b30a7762 100644
--- a/tests/unit/Web/UI/TPageTest.php
+++ b/tests/unit/Web/UI/TPageTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TPage');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TSessionPageStatePersisterTest.php b/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
index 9153ad42..6e5d0ab0 100644
--- a/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
+++ b/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TSessionPageStatePersister');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TTemplateControlTest.php b/tests/unit/Web/UI/TTemplateControlTest.php
index 7276a2b0..6d377882 100644
--- a/tests/unit/Web/UI/TTemplateControlTest.php
+++ b/tests/unit/Web/UI/TTemplateControlTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TTemplateControl');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TTemplateManagerTest.php b/tests/unit/Web/UI/TTemplateManagerTest.php
index dfe452bf..46edbb56 100644
--- a/tests/unit/Web/UI/TTemplateManagerTest.php
+++ b/tests/unit/Web/UI/TTemplateManagerTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TTemplateManager');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TTemplateTest.php b/tests/unit/Web/UI/TTemplateTest.php
index 2d802094..600ecebc 100644
--- a/tests/unit/Web/UI/TTemplateTest.php
+++ b/tests/unit/Web/UI/TTemplateTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TTemplateManager');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TThemeManagerTest.php b/tests/unit/Web/UI/TThemeManagerTest.php
index 028b222a..ccba749c 100644
--- a/tests/unit/Web/UI/TThemeManagerTest.php
+++ b/tests/unit/Web/UI/TThemeManagerTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TThemeManager');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/TThemeTest.php b/tests/unit/Web/UI/TThemeTest.php
index aeeeee65..4cf7d202 100644
--- a/tests/unit/Web/UI/TThemeTest.php
+++ b/tests/unit/Web/UI/TThemeTest.php
@@ -1,7 +1,6 @@
<?php
-Prado::using('System.Web.UI.TThemeManager');
/**
* @package System.Web.UI
diff --git a/tests/unit/Web/UI/WebControls/TDropDownListTest.php b/tests/unit/Web/UI/WebControls/TDropDownListTest.php
index d27ebb9c..3331aee6 100644
--- a/tests/unit/Web/UI/WebControls/TDropDownListTest.php
+++ b/tests/unit/Web/UI/WebControls/TDropDownListTest.php
@@ -1,7 +1,9 @@
<?php
-Prado::using('System.Web.UI.WebControls.TDropDownList');
+use Prado\Collections\TListItemCollection;
+use Prado\Web\UI\WebControls\TDropDownList;
+
/**
* @package System.Web.UI.WebControls
diff --git a/tests/unit/Web/UI/WebControls/TLabelTest.php b/tests/unit/Web/UI/WebControls/TLabelTest.php
index 88d8aec8..b0e8e7a6 100644
--- a/tests/unit/Web/UI/WebControls/TLabelTest.php
+++ b/tests/unit/Web/UI/WebControls/TLabelTest.php
@@ -1,8 +1,8 @@
<?php
-Prado::using('System.Web.UI.WebControls.TLabel');
-Prado::using('System.Web.UI.THtmlWriter');
+use Prado\Web\UI\WebControls\TLabel;
+
/**
* @package System.Web.UI.WebControls
diff --git a/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
index 43ed2c9d..86516d90 100644
--- a/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
+++ b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
@@ -1,7 +1,9 @@
<?php
-Prado::using('System.Web.UI.WebControls.TRequiredFieldValidator');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Web\UI\WebControls\TRequiredFieldValidator;
+
/**
* @package System.Web.UI.WebControls
diff --git a/tests/unit/Web/UI/WebControls/TXmlTransformTest.php b/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
index f93e9897..c8b8264c 100644
--- a/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
+++ b/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
@@ -1,8 +1,11 @@
<?php
-Prado::using('System.Web.UI.WebControls.TXmlTransform');
-Prado::using('System.Web.UI.THtmlWriter');
+use Prado\IO\TTextWriter;
+use Prado\Prado;
+use Prado\Web\UI\THtmlWriter;
+use Prado\Web\UI\WebControls\TXmlTransform;
+
/**
* @package System.Web.UI.WebControls
diff --git a/tests/unit/Xml/TXmlDocumentTest.php b/tests/unit/Xml/TXmlDocumentTest.php
index 54e4b5aa..a04402d8 100644
--- a/tests/unit/Xml/TXmlDocumentTest.php
+++ b/tests/unit/Xml/TXmlDocumentTest.php
@@ -1,6 +1,9 @@
<?php
-Prado::using('System.Xml.TXmlDocument');
+use Prado\Exceptions\TIOException;
+use Prado\Xml\TXmlDocument;
+use Prado\Xml\TXmlElement;
+
/**
* @package System.Xml
diff --git a/tests/unit/Xml/TXmlElementListTest.php b/tests/unit/Xml/TXmlElementListTest.php
index 7667c64d..1f42285d 100644
--- a/tests/unit/Xml/TXmlElementListTest.php
+++ b/tests/unit/Xml/TXmlElementListTest.php
@@ -1,6 +1,9 @@
<?php
-Prado::using('System.Xml.TXmlDocument');
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Xml\TXmlElement;
+use Prado\Xml\TXmlElementList;
+
/**
* @package System.Xml
diff --git a/tests/unit/Xml/TXmlElementTest.php b/tests/unit/Xml/TXmlElementTest.php
index 49cae36f..49bd41ec 100644
--- a/tests/unit/Xml/TXmlElementTest.php
+++ b/tests/unit/Xml/TXmlElementTest.php
@@ -1,6 +1,8 @@
<?php
-Prado::using('System.Xml.TXmlDocument');
+use Prado\Collections\TMap;
+use Prado\Xml\TXmlElement;
+
/**
* @package System.Xml