summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-01-15 19:05:25 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-08-23 12:30:22 +0200
commit9733613002b664ec9cbdc6dec9d6fd57ee901f1e (patch)
treeca20722ae61a4ff9046c58cef4d2e374801800da /tests/unit
parent21a909f819cc340564770ea63e383ee6013fc167 (diff)
Removed ?> from tests
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/AllTests.php2
-rw-r--r--tests/unit/Caching/AllTests.php7
-rw-r--r--tests/unit/Caching/TAPCCacheTest.php15
-rw-r--r--tests/unit/Caching/TDirectoryCacheDependencyTest.php2
-rw-r--r--tests/unit/Caching/TFileCacheDependencyTest.php2
-rw-r--r--tests/unit/Caching/TMemCacheTest.php13
-rw-r--r--tests/unit/Caching/TSqliteCacheTest.php17
-rw-r--r--tests/unit/Collections/AllTests.php7
-rw-r--r--tests/unit/Collections/TAttributeCollectionTest.php19
-rw-r--r--tests/unit/Collections/TListTest.php68
-rw-r--r--tests/unit/Collections/TMapTest.php3
-rw-r--r--tests/unit/Collections/TPagedDataSourceTest.php25
-rw-r--r--tests/unit/Collections/TPagedListTest.php53
-rw-r--r--tests/unit/Collections/TPriorityMapTest.php161
-rw-r--r--tests/unit/Collections/TQueueTest.php13
-rw-r--r--tests/unit/Collections/TStackTest.php13
-rw-r--r--tests/unit/Data/DataGateway/AllTests.php7
-rw-r--r--tests/unit/Data/DataGateway/TSqlCriteriaTest.php25
-rw-r--r--tests/unit/Data/SqlMap/AllTests.php1
-rw-r--r--tests/unit/Data/SqlMap/DataMapper/AllTests.php3
-rw-r--r--tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php2
-rw-r--r--tests/unit/Data/SqlMap/DynamicParameterTest.php2
-rw-r--r--tests/unit/Data/TDbCommandTest.php2
-rw-r--r--tests/unit/Data/TDbConnectionTest.php2
-rw-r--r--tests/unit/Data/TDbDataReaderTest.php2
-rw-r--r--tests/unit/Data/TDbTransactionTest.php2
-rw-r--r--tests/unit/I18N/core/AllTests.php7
-rw-r--r--tests/unit/I18N/core/ChoiceFormatTest.php2
-rw-r--r--tests/unit/I18N/core/CultureInfoTest.php22
-rw-r--r--tests/unit/I18N/core/DateFormatTest.php56
-rw-r--r--tests/unit/I18N/core/DateTimeFormatInfoTest.php67
-rw-r--r--tests/unit/I18N/core/NumberFormatInfoTest.php36
-rw-r--r--tests/unit/I18N/core/NumberFormatTest.php52
-rw-r--r--tests/unit/IO/AllTests.php7
-rw-r--r--tests/unit/IO/TTarFileExtractorTest.php5
-rw-r--r--tests/unit/IO/TTextWriterTest.php3
-rw-r--r--tests/unit/Security/AllTests.php7
-rw-r--r--tests/unit/Security/TAuthManagerTest.php35
-rw-r--r--tests/unit/Security/TAuthorizationRuleTest.php15
-rw-r--r--tests/unit/Security/TSecurityManagerTest.php31
-rw-r--r--tests/unit/Security/TUserManagerTest.php31
-rw-r--r--tests/unit/Security/TUserTest.php21
-rw-r--r--tests/unit/TComponentTest.php970
-rw-r--r--tests/unit/Util/AllTests.php7
-rw-r--r--tests/unit/Util/TDateTimeStampTest.php3
-rw-r--r--tests/unit/Util/TLoggerTest.php3
-rw-r--r--tests/unit/Util/TSimpleDateFormatterTest.php21
-rw-r--r--tests/unit/Web/AllTests.php9
-rw-r--r--tests/unit/Web/TAssetManagerTest.php57
-rw-r--r--tests/unit/Web/TCacheHttpSessionTest.php31
-rw-r--r--tests/unit/Web/THttpCookieCollectionTest.php5
-rw-r--r--tests/unit/Web/THttpCookieTest.php3
-rw-r--r--tests/unit/Web/THttpRequestTest.php3
-rw-r--r--tests/unit/Web/THttpResponseTest.php21
-rw-r--r--tests/unit/Web/THttpSessionTest.php3
-rw-r--r--tests/unit/Web/THttpUtilityTest.php3
-rw-r--r--tests/unit/Web/TUriTest.php13
-rw-r--r--tests/unit/Web/UI/ActiveControls/AllTests.php7
-rw-r--r--tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php2
-rw-r--r--tests/unit/Web/UI/AllTests.php7
-rw-r--r--tests/unit/Web/UI/TClientScriptManagerTest.php3
-rw-r--r--tests/unit/Web/UI/TControlAdapterTest.php23
-rw-r--r--tests/unit/Web/UI/TControlTest.php133
-rw-r--r--tests/unit/Web/UI/TFormTest.php11
-rw-r--r--tests/unit/Web/UI/THtmlWriterTest.php13
-rw-r--r--tests/unit/Web/UI/TPageStatePersisterTest.php9
-rw-r--r--tests/unit/Web/UI/TPageTest.php83
-rw-r--r--tests/unit/Web/UI/TSessionPageStatePersisterTest.php11
-rw-r--r--tests/unit/Web/UI/TTemplateControlTest.php17
-rw-r--r--tests/unit/Web/UI/TTemplateManagerTest.php11
-rw-r--r--tests/unit/Web/UI/TTemplateTest.php23
-rw-r--r--tests/unit/Web/UI/TThemeManagerTest.php13
-rw-r--r--tests/unit/Web/UI/TThemeTest.php17
-rw-r--r--tests/unit/Web/UI/WebControls/AllTests.php7
-rw-r--r--tests/unit/Web/UI/WebControls/TDropDownListTest.php1
-rw-r--r--tests/unit/Web/UI/WebControls/TLabelTest.php2
-rw-r--r--tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php2
-rw-r--r--tests/unit/Web/UI/WebControls/TXmlTransformTest.php5
-rw-r--r--tests/unit/Xml/AllTests.php7
-rw-r--r--tests/unit/Xml/TXmlDocumentTest.php7
-rw-r--r--tests/unit/Xml/TXmlElementListTest.php3
-rw-r--r--tests/unit/Xml/TXmlElementTest.php3
82 files changed, 1168 insertions, 1269 deletions
diff --git a/tests/unit/AllTests.php b/tests/unit/AllTests.php
index 7b8027b3..eb08a5f7 100644
--- a/tests/unit/AllTests.php
+++ b/tests/unit/AllTests.php
@@ -50,5 +50,3 @@ class AllTests {
if(PHPUnit_MAIN_METHOD == 'AllTests::main') {
AllTests::main();
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Caching/AllTests.php b/tests/unit/Caching/AllTests.php
index bffe3b2f..179840fc 100644
--- a/tests/unit/Caching/AllTests.php
+++ b/tests/unit/Caching/AllTests.php
@@ -12,14 +12,14 @@ 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('TSqliteCacheTest');
$suite->addTestSuite('TAPCCacheTest');
$suite->addTestSuite('TMemCacheTest');
-
+
return $suite;
}
}
@@ -27,4 +27,3 @@ class Caching_AllTests {
if(PHPUnit_MAIN_METHOD == 'Caching_AllTests::main') {
Caching_AllTests::main();
}
-?>
diff --git a/tests/unit/Caching/TAPCCacheTest.php b/tests/unit/Caching/TAPCCacheTest.php
index 3cb04361..ccb6ee85 100644
--- a/tests/unit/Caching/TAPCCacheTest.php
+++ b/tests/unit/Caching/TAPCCacheTest.php
@@ -26,7 +26,7 @@ class TAPCCacheTest extends PHPUnit_Framework_TestCase {
} catch(TConfigurationException $e) {
self::markTestSkipped($e->getMessage());
}
-
+
}
}
@@ -38,24 +38,24 @@ class TAPCCacheTest extends PHPUnit_Framework_TestCase {
public function testInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testPrimaryCache() {
self::$cache->PrimaryCache = true;
self::assertEquals(true, self::$cache->PrimaryCache);
self::$cache->PrimaryCache = false;
self::assertEquals(false, self::$cache->PrimaryCache);
}
-
+
public function testKeyPrefix() {
self::$cache->KeyPrefix = 'prefix';
self::assertEquals('prefix', self::$cache->KeyPrefix);
}
-
+
public function testSetAndGet() {
self::$cache->set('key', 'value');
self::assertEquals('value', self::$cache->get('key'));
}
-
+
public function testAdd() {
try {
self::$cache->add('anotherkey', 'value');
@@ -65,12 +65,12 @@ class TAPCCacheTest extends PHPUnit_Framework_TestCase {
}
self::assertEquals('value', self::$cache->get('anotherkey'));
}
-
+
public function testDelete() {
self::$cache->delete('key');
self::assertEquals(false, self::$cache->get('key'));
}
-
+
public function testFlush() {
$this->testSetAndGet();
self::assertEquals(true, self::$cache->flush());
@@ -78,4 +78,3 @@ class TAPCCacheTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Caching/TDirectoryCacheDependencyTest.php b/tests/unit/Caching/TDirectoryCacheDependencyTest.php
index c5c75dec..10da9b58 100644
--- a/tests/unit/Caching/TDirectoryCacheDependencyTest.php
+++ b/tests/unit/Caching/TDirectoryCacheDependencyTest.php
@@ -78,5 +78,3 @@ class TDirectoryCacheDependencyTest extends PHPUnit_Framework_TestCase
@unlink($tempFile);
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Caching/TFileCacheDependencyTest.php b/tests/unit/Caching/TFileCacheDependencyTest.php
index b4bc89d3..24f2721b 100644
--- a/tests/unit/Caching/TFileCacheDependencyTest.php
+++ b/tests/unit/Caching/TFileCacheDependencyTest.php
@@ -54,5 +54,3 @@ class TFileCacheDependencyTest extends PHPUnit_Framework_TestCase
@unlink($tempFile);
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Caching/TMemCacheTest.php b/tests/unit/Caching/TMemCacheTest.php
index 8c1fa934..3d0d651f 100644
--- a/tests/unit/Caching/TMemCacheTest.php
+++ b/tests/unit/Caching/TMemCacheTest.php
@@ -33,34 +33,34 @@ class TMemCacheTest extends PHPUnit_Framework_TestCase {
public function testInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testPrimaryCache() {
self::$cache->PrimaryCache = true;
self::assertEquals(true, self::$cache->PrimaryCache);
self::$cache->PrimaryCache = false;
self::assertEquals(false, self::$cache->PrimaryCache);
}
-
+
public function testKeyPrefix() {
self::$cache->KeyPrefix = 'prefix';
self::assertEquals('prefix', self::$cache->KeyPrefix);
}
-
+
public function testSetAndGet() {
self::$cache->set('key', 'value');
self::assertEquals('value', self::$cache->get('key'));
}
-
+
public function testAdd() {
self::$cache->add('anotherkey', 'value');
self::assertEquals('value', self::$cache->get('anotherkey'));
}
-
+
public function testDelete() {
self::$cache->delete('key');
self::assertEquals(false, self::$cache->get('key'));
}
-
+
public function testFlush() {
$this->testSetAndGet();
self::assertEquals(true, self::$cache->flush());
@@ -68,4 +68,3 @@ class TMemCacheTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Caching/TSqliteCacheTest.php b/tests/unit/Caching/TSqliteCacheTest.php
index fd4ab1bf..b979b0ec 100644
--- a/tests/unit/Caching/TSqliteCacheTest.php
+++ b/tests/unit/Caching/TSqliteCacheTest.php
@@ -15,7 +15,7 @@ class TSqliteCacheTest extends PHPUnit_Framework_TestCase {
self::markTestSkipped('The SQLite extension is not available');
} else {
if(self::$app === null) {
-
+
$basePath = dirname(__FILE__).'/mockapp';
$runtimePath = $basePath.'/runtime';
if(!is_writable($runtimePath)) {
@@ -37,38 +37,38 @@ class TSqliteCacheTest extends PHPUnit_Framework_TestCase {
public function testInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testPrimaryCache() {
self::$cache->PrimaryCache = true;
self::assertEquals(true, self::$cache->PrimaryCache);
self::$cache->PrimaryCache = false;
self::assertEquals(false, self::$cache->PrimaryCache);
}
-
+
public function testKeyPrefix() {
self::$cache->KeyPrefix = 'prefix';
self::assertEquals('prefix', self::$cache->KeyPrefix);
}
-
+
public function testDbFile() {
self::assertEquals('sqlite.cache', basename(self::$cache->DbFile));
}
-
+
public function testSetAndGet() {
self::$cache->set('key', 'value');
self::assertEquals('value', self::$cache->get('key'));
}
-
+
public function testAdd() {
self::$cache->add('key', 'value');
self::assertEquals('value', self::$cache->get('key'));
}
-
+
public function testDelete() {
self::$cache->delete('key');
self::assertEquals(false, self::$cache->get('key'));
}
-
+
public function testFlush() {
$this->testAdd();
self::assertEquals(true, self::$cache->flush());
@@ -76,4 +76,3 @@ class TSqliteCacheTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Collections/AllTests.php b/tests/unit/Collections/AllTests.php
index f290be31..3c286132 100644
--- a/tests/unit/Collections/AllTests.php
+++ b/tests/unit/Collections/AllTests.php
@@ -16,10 +16,10 @@ class Collections_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Collections');
-
+
$suite->addTestSuite('TListTest');
$suite->addTestSuite('TMapTest');
$suite->addTestSuite('TQueueTest');
@@ -27,7 +27,7 @@ class Collections_AllTests {
$suite->addTestSuite('TAttributeCollectionTest');
$suite->addTestSuite('TPagedListTest');
$suite->addTestSuite('TPagedDataSourceTest');
-
+
return $suite;
}
}
@@ -35,4 +35,3 @@ class Collections_AllTests {
if(PHPUnit_MAIN_METHOD == 'Collections_AllTests::main') {
Collections_AllTests::main();
}
-?>
diff --git a/tests/unit/Collections/TAttributeCollectionTest.php b/tests/unit/Collections/TAttributeCollectionTest.php
index 5805f2d0..f61f58b3 100644
--- a/tests/unit/Collections/TAttributeCollectionTest.php
+++ b/tests/unit/Collections/TAttributeCollectionTest.php
@@ -19,7 +19,7 @@ class TAttributeCollectionTest extends PHPUnit_Framework_TestCase {
self::assertEquals('value', $collection->Property);
self::assertEquals(true, $collection->canGetProperty('Property'));
}
-
+
public function testCanNotGetUndefinedProperty() {
$collection = new TAttributeCollection(array(), true);
self::assertEquals(false, $collection->canGetProperty('Property'));
@@ -37,7 +37,7 @@ class TAttributeCollectionTest extends PHPUnit_Framework_TestCase {
self::assertEquals('value', $collection->itemAt('Property'));
self::assertEquals(true, $collection->canSetProperty('Property'));
}
-
+
public function testCanNotSetPropertyIfReadOnly() {
$collection = new TAttributeCollection(array(), true);
try {
@@ -47,7 +47,7 @@ class TAttributeCollectionTest extends PHPUnit_Framework_TestCase {
}
self::fail('An expected TInvalidOperationException was not raised');
}
-
+
public function testGetCaseSensitive() {
$collection = new TAttributeCollection();
$collection->setCaseSensitive(false);
@@ -55,40 +55,40 @@ class TAttributeCollectionTest extends PHPUnit_Framework_TestCase {
$collection->setCaseSensitive(true);
self::assertEquals(true, $collection->getCaseSensitive());
}
-
+
public function testSetCaseSensitive() {
$collection = new TAttributeCollection();
$collection->Property = 'value';
$collection->setCaseSensitive(false);
self::assertEquals('value', $collection->itemAt('property'));
}
-
+
public function testItemAt() {
$collection = new TAttributeCollection();
$collection->Property = 'value';
self::assertEquals('value', $collection->itemAt('Property'));
}
-
+
public function testAdd() {
$collection = new TAttributeCollection();
$collection->add('Property', 'value');
self::assertEquals('value', $collection->itemAt('Property'));
}
-
+
public function testRemove() {
$collection = new TAttributeCollection();
$collection->add('Property', 'value');
$collection->remove('Property');
self::assertEquals(0, count($collection));
}
-
+
public function testContains() {
$collection = new TAttributeCollection();
self::assertEquals(false, $collection->contains('Property'));
$collection->Property = 'value';
self::assertEquals(true, $collection->contains('Property'));
}
-
+
public function testHasProperty() {
$collection = new TAttributeCollection();
self::assertEquals(false, $collection->hasProperty('Property'));
@@ -98,4 +98,3 @@ class TAttributeCollectionTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Collections/TListTest.php b/tests/unit/Collections/TListTest.php
index 349d87ed..9d6950b9 100644
--- a/tests/unit/Collections/TListTest.php
+++ b/tests/unit/Collections/TListTest.php
@@ -8,7 +8,7 @@ class ListItem {
* @package System.Collections
*/
class TListTest extends PHPUnit_Framework_TestCase {
-
+
protected $list;
protected $item1, $item2, $item3, $item4;
@@ -21,7 +21,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
$this->list->add($this->item1);
$this->list->add($this->item2);
}
-
+
public function tearDown() {
$this->list=null;
$this->item1=null;
@@ -29,7 +29,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
$this->item3=null;
$this->item4=null;
}
-
+
public function testConstruct() {
$a=array(1,2,3);
$list=new TList($a);
@@ -37,19 +37,19 @@ class TListTest extends PHPUnit_Framework_TestCase {
$list2=new TList($this->list);
$this->assertEquals(2,$list2->getCount());
}
-
+
public function testGetReadOnly() {
$list = new TList(null, true);
self::assertEquals(true, $list->getReadOnly(), 'List is not read-only');
$list = new TList(null, false);
self::assertEquals(false, $list->getReadOnly(), 'List is read-only');
}
-
+
public function testGetCount() {
$this->assertEquals(2,$this->list->getCount());
$this->assertEquals(2,$this->list->Count);
}
-
+
public function testItemAt() {
$this->assertTrue($this->list->itemAt(0) === $this->item1);
$this->assertTrue($this->list->itemAt(1) === $this->item2);
@@ -59,14 +59,14 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataValueException $e) {
}
}
-
+
public function testAdd() {
$this->assertEquals(2,$this->list->add(null));
$this->assertEquals(3,$this->list->add($this->item3));
$this->assertEquals(4,$this->list->getCount());
$this->assertEquals(3,$this->list->indexOf($this->item3));
}
-
+
public function testCanNotAddWhenReadOnly() {
$list = new TList(array(), true);
try {
@@ -75,7 +75,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testInsertAt() {
$this->assertNull($this->list->insertAt(0,$this->item3));
$this->assertEquals(3,$this->list->getCount());
@@ -88,7 +88,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataValueException $e) {
}
}
-
+
public function testCanNotInsertAtWhenReadOnly() {
$list = new TList(array(), true);
try {
@@ -102,7 +102,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testInsertBefore() {
try {
$this->list->insertBefore($this->item4,$this->item3);
@@ -116,7 +116,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(1,$this->list->indexOf($this->item1));
$this->assertEquals(2,$this->list->indexOf($this->item2));
}
-
+
public function testCanNotInsertBeforeWhenReadOnly() {
$list = new TList(array(5), true);
try {
@@ -130,7 +130,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testInsertAfter() {
try {
$this->list->insertAfter($this->item4,$this->item3);
@@ -144,7 +144,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(1,$this->list->indexOf($this->item2));
$this->assertEquals(2,$this->list->indexOf($this->item3));
}
-
+
public function testCanNotInsertAfterWhenReadOnly() {
$list = new TList(array(5), true);
try {
@@ -158,7 +158,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testRemove() {
$this->assertEquals(0,$this->list->remove($this->item1));
$this->assertEquals(1,$this->list->getCount());
@@ -170,7 +170,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(Exception $e) {
}
}
-
+
public function testCanNotRemoveWhenReadOnly() {
$list = new TList(array(1, 2, 3), true);
try {
@@ -178,7 +178,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
self::fail('An expected TInvalidOperationException was not raised');
} catch(TInvalidOperationException $e) {
}
-
+
$list = new TList(array(1, 2, 3), true);
try {
$list->remove(10);
@@ -186,7 +186,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testRemoveAt() {
$this->list->add($this->item3);
$this->assertEquals($this->item2, $this->list->removeAt(1));
@@ -199,7 +199,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataValueException $e) {
}
}
-
+
public function testCanNotRemoveAtWhenReadOnly() {
$list = new TList(array(1, 2, 3), true);
try {
@@ -207,7 +207,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
self::fail('An expected TInvalidOperationException was not raised');
} catch(TInvalidOperationException $e) {
}
-
+
$list = new TList(array(1, 2, 3), true);
try {
$list->removeAt(10);
@@ -215,14 +215,14 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
}
-
+
public function testClear() {
$this->list->clear();
$this->assertEquals(0,$this->list->getCount());
$this->assertEquals(-1,$this->list->indexOf($this->item1));
$this->assertEquals(-1,$this->list->indexOf($this->item2));
}
-
+
public function testCanNotClearWhenReadOnly() {
$list = new TList(array(1, 2, 3), true);
try {
@@ -232,19 +232,19 @@ class TListTest extends PHPUnit_Framework_TestCase {
}
self::fail('An expected TInvalidOperationException was not raised');
}
-
+
public function testContains() {
$this->assertTrue($this->list->contains($this->item1));
$this->assertTrue($this->list->contains($this->item2));
$this->assertFalse($this->list->contains($this->item3));
}
-
+
public function testIndexOf() {
$this->assertEquals(0,$this->list->indexOf($this->item1));
$this->assertEquals(1,$this->list->indexOf($this->item2));
$this->assertEquals(-1,$this->list->indexOf($this->item3));
}
-
+
public function testCopyFrom() {
$array=array($this->item3,$this->item1);
$this->list->copyFrom($array);
@@ -255,7 +255,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataTypeException $e) {
}
}
-
+
public function testMergeWith() {
$array=array($this->item3,$this->item1);
$this->list->mergeWith($array);
@@ -266,12 +266,12 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataTypeException $e) {
}
}
-
+
public function testToArray() {
$array=$this->list->toArray();
$this->assertTrue(count($array)==2 && $array[0]===$this->item1 && $array[1]===$this->item2);
}
-
+
public function testArrayRead() {
$this->assertTrue($this->list[0]===$this->item1);
$this->assertTrue($this->list[1]===$this->item2);
@@ -281,7 +281,7 @@ class TListTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidDataValueException $e) {
}
}
-
+
public function testGetIterator() {
$n=0;
$found=0;
@@ -295,25 +295,25 @@ class TListTest extends PHPUnit_Framework_TestCase {
}
$this->assertTrue($n==2 && $found==2);
}
-
+
public function testArrayMisc() {
$this->assertEquals($this->list->Count,count($this->list));
$this->assertTrue(isset($this->list[1]));
$this->assertFalse(isset($this->list[2]));
}
-
+
public function testOffsetSetAdd() {
$list = new TList(array(1, 2, 3));
$list->offsetSet(null, 4);
self::assertEquals(array(1, 2, 3, 4), $list->toArray());
}
-
+
public function testOffsetSetReplace() {
$list = new TList(array(1, 2, 3));
$list->offsetSet(1, 4);
self::assertEquals(array(1, 4, 3), $list->toArray());
}
-
+
public function testOffsetUnset() {
$list = new TList(array(1, 2, 3));
$list->offsetUnset(1);
@@ -321,5 +321,3 @@ class TListTest extends PHPUnit_Framework_TestCase {
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Collections/TMapTest.php b/tests/unit/Collections/TMapTest.php
index 0634a2a3..da198eb4 100644
--- a/tests/unit/Collections/TMapTest.php
+++ b/tests/unit/Collections/TMapTest.php
@@ -176,11 +176,10 @@ class TMapTest extends PHPUnit_Framework_TestCase {
$this->assertTrue(isset($this->map['key1']));
$this->assertFalse(isset($this->map['unknown key']));
}
-
+
public function testToArray() {
$map = new TMap(array('key' => 'value'));
self::assertEquals(array('key' => 'value'), $map->toArray());
}
}
-?>
diff --git a/tests/unit/Collections/TPagedDataSourceTest.php b/tests/unit/Collections/TPagedDataSourceTest.php
index 92f4061b..ebb8e60d 100644
--- a/tests/unit/Collections/TPagedDataSourceTest.php
+++ b/tests/unit/Collections/TPagedDataSourceTest.php
@@ -16,55 +16,54 @@ class TPagedDataSourceTest extends PHPUnit_Framework_TestCase {
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/Collections/TPagedListTest.php b/tests/unit/Collections/TPagedListTest.php
index 2d884736..a225db61 100644
--- a/tests/unit/Collections/TPagedListTest.php
+++ b/tests/unit/Collections/TPagedListTest.php
@@ -3,26 +3,26 @@
Prado::using('System.Collections.TPagedList');
class MyPagedList extends TPagedList {
-
+
private $_isPageIndexChanged = false;
private $_hasFetchedData = false;
-
+
public function pageIndexChanged($sender, $param) {
$this->_isPageIndexChanged = true;
}
-
+
public function fetchData($sender, $param) {
$this->_hasFetchedData = true;
}
-
+
public function isPageIndexChanged() {
return $this->_isPageIndexChanged;
}
-
+
public function hasFetchedData() {
return $this->_hasFetchedData;
}
-
+
}
/**
@@ -58,7 +58,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->PageSize = 5;
self::assertEquals(5, $list->PageSize);
}
-
+
public function testCanNotSetInvalidPageSize() {
$list = new TPagedList();
try {
@@ -68,14 +68,14 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
}
self::fail('An expected TInvalidDataValueException was not raised');
}
-
+
public function testCurrentPageIndex() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
$list->CurrentPageIndex = 2;
self::assertEquals(2, $list->CurrentPageIndex);
}
-
+
public function testOnPageIndexChanged() {
$list = new TPagedList(array(1, 2, 3, 4, 5));
$list->PageSize = 1;
@@ -87,7 +87,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage));
self::assertEquals(true, $myList->isPageIndexChanged());
}
-
+
public function testOnFetchData() {
$list = new TPagedList(array(1, 2, 3, 4));
$list->CustomPaging = true;
@@ -95,18 +95,18 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->gotoPage(0);
$myList = new MyPagedList();
$list->attachEventHandler('OnFetchData', array($myList, 'fetchData'));
- self::assertEquals(false, $myList->hasFetchedData());
+ self::assertEquals(false, $myList->hasFetchedData());
$list->onFetchData(new TPagedListFetchDataEventParameter($list->CurrentPageIndex, $list->PageSize*$list->CurrentPageIndex, $list->PageSize));
self::assertEquals(true, $myList->hasFetchedData());
}
-
+
public function testGotoPage() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
self::assertEquals(2, $list->gotoPage(2));
self::assertEquals(false, $list->gotoPage(4));
}
-
+
public function testNextPage() {
$list = new TPagedList(array(1, 2));
$list->PageSize = 1;
@@ -114,7 +114,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
self::assertEquals(1, $list->nextPage());
self::assertEquals(false, $list->nextPage());
}
-
+
public function testPreviousPage() {
$list = new TPagedList(array(1, 2));
$list->PageSize = 1;
@@ -122,7 +122,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
self::assertEquals(0, $list->previousPage());
self::assertEquals(false, $list->previousPage());
}
-
+
public function testVirtualCount() {
$list = new TPagedList(array(1, 2));
$list->VirtualCount = -10;
@@ -130,7 +130,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->VirtualCount = 5;
self::assertEquals(5, $list->VirtualCount);
}
-
+
public function testPageCount() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
@@ -141,7 +141,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->CustomPaging = false;
self::assertEquals(3, $list->PageCount);
}
-
+
public function testIsFirstPage() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
@@ -150,7 +150,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->gotoPage(1);
self::assertEquals(false, $list->IsFirstPage);
}
-
+
public function testIsLastPage() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
@@ -159,7 +159,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->gotoPage(2);
self::assertEquals(true, $list->IsLastPage);
}
-
+
public function testGetCount() {
$list = new TPagedList(array(1, 2, 3));
$list->PageSize = 1;
@@ -167,7 +167,7 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->CustomPaging = true;
self::assertEquals(3, $list->Count);
}
-
+
public function testGetIterator() {
$list = new TPagedList(array(1, 2));
$list->CustomPaging = true;
@@ -181,12 +181,12 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$found++;
}
if($index === 1 && $item === 2) {
- $found++;
+ $found++;
}
}
self::assertTrue($n == 2 && $found == 2);
}
-
+
public function testItemAt() {
$list = new TPagedList(array(1, 2, 3));
$list->CustomPaging = true;
@@ -196,27 +196,27 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
$list->CurrentPageIndex = 0;
self::assertEquals(1, $list[0]);
}
-
+
public function testIndexOf() {
$list = new TPagedList(array(1, 2, 3));
$list->CustomPaging = true;
self::assertEquals(0, $list->indexOf(1));
self::assertEquals(-1, $list->indexOf(0));
}
-
+
public function testOffsetExists() {
$list = new TPagedList(array(1, 2, 3));
$list->CustomPaging = true;
self::assertEquals(true, isset($list[0]));
self::assertEquals(false, isset($list[4]));
}
-
+
public function testOffsetGet() {
$list = new TPagedList(array(1, 2, 3));
$list->CustomPaging = true;
self::assertEquals(2, $list[1]);
}
-
+
public function testToArray() {
$list = new TPagedList(array(1, 2, 3));
$list->CustomPaging = true;
@@ -225,4 +225,3 @@ class TPagedListTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Collections/TPriorityMapTest.php b/tests/unit/Collections/TPriorityMapTest.php
index 7c6ed498..847e09fe 100644
--- a/tests/unit/Collections/TPriorityMapTest.php
+++ b/tests/unit/Collections/TPriorityMapTest.php
@@ -22,10 +22,10 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->item5=new TPriorityMapTest_MapItem;
$this->map->add('key1',$this->item1);
$this->map->add('key2',$this->item2);
-
+
//Test the priority capabilities
}
-
+
public function setUpPriorities() {
$this->map->add('key3', $this->item3, 0);
$this->map->add('key4', $this->item4, 100);
@@ -45,16 +45,16 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(3,$map->getCount());
$map2=new TPriorityMap($this->map);
$this->assertEquals(2,$map2->getCount());
-
+
/* Test the priority functionality of TPriorityMap */
-
+
$map3=new TPriorityMap($this->map, false, 100, -1);
$this->assertEquals(100,$map3->getDefaultPriority());
$this->assertEquals(-1,$map3->getPrecision());
}
-
+
/* Test that TPriorityMap complies with TMap */
-
+
public function testGetReadOnly() {
$map = new TPriorityMap(null, true);
@@ -202,46 +202,46 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertTrue(isset($this->map['key1']));
$this->assertFalse(isset($this->map['unknown key']));
}
-
+
public function testToArray() {
$map = new TPriorityMap(array('key' => 'value'));
self::assertEquals(array('key' => 'value'), $map->toArray());
}
-
-
-
-
+
+
+
+
/* Test the priority functionality of TPriorityMap */
-
-
+
+
public function testDefaultPriorityAndPrecision() {
-
+
$this->assertEquals(10, $this->map->DefaultPriority);
-
+
$this->map->DefaultPriority = 5;
$this->assertEquals(5, $this->map->getDefaultPriority());
-
+
$this->assertEquals(8, $this->map->Precision);
-
+
$this->map->Precision = 0;
$this->assertEquals(0, $this->map->getPrecision());
-
+
;
-
+
$this->assertEquals(5, $this->map->add('key3', $this->item3));
$this->assertEquals(10, $this->map->add('key4', $this->item1, 10));
$this->assertTrue(10 == $this->map->add('key4', $this->item1, 10.01));
$this->assertTrue(100 == $this->map->add('key4', $this->item1, 100));
$this->map->Precision = 1;
$this->assertTrue(10.1 == $this->map->add('key5', $this->item1, 10.1));
-
+
$this->assertEquals(5, $this->map->getCount());
}
-
+
public function testAddWithPriorityAndPriorityOfAt() {
-
+
$this->setUpPriorities();
-
+
$this->assertEquals(5, $this->map->getCount());
$this->assertEquals(10, $this->map->priorityOf($this->item1));
$this->assertEquals(0, $this->map->priorityOf($this->item3));
@@ -249,74 +249,74 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(1, $this->map->priorityOf($this->item5));
$this->assertEquals(false, $this->map->priorityOf(null));
$this->assertEquals(false, $this->map->priorityOf('foo'));
-
+
$this->assertEquals(10, $this->map->priorityAt('key1'));
$this->assertEquals(0, $this->map->priorityAt('key3'));
$this->assertEquals(100, $this->map->priorityAt('key4'));
$this->assertEquals(1, $this->map->priorityAt('key5'));
$this->assertEquals(false, $this->map->priorityAt(null));
$this->assertEquals(false, $this->map->priorityAt('foo'));
-
+
}
-
+
public function testRemoveWithPriorityAndItemsAtWithPriority() {
-
+
$this->setUpPriorities();
-
+
$this->assertEquals(5, $this->map->getCount());
$this->map->remove('key6');
$this->assertEquals(5, $this->map->getCount());
$this->map->remove('key6', null);
$this->assertEquals(5, $this->map->getCount());
-
-
+
+
// key5 is at priority 1... not the default priority defined by null... nothing should happen here
$this->map->remove('key5', null);
$this->assertEquals(5, $this->map->getCount());
-
+
// key5 is at priority 1... not 50... nothing should happen here
$this->map->remove('key5', 50);
$this->assertEquals(5, $this->map->getCount());
-
-
-
+
+
+
$this->assertEquals(array('key3'=>$this->item3), $this->map->itemsAtPriority(0));
$this->assertEquals(array('key1'=>$this->item1, 'key2'=>$this->item2), $this->map->itemsAtPriority($this->map->DefaultPriority));
-
+
$this->assertEquals($this->item2, $this->map->itemAt('key2'));
$this->assertEquals($this->item2, $this->map->itemAt('key2', 10));
$this->assertNull($this->map->itemAt('key2', 11)); //'key2' doesn't exist and priority 11... it is only at priority 10
$this->assertNull($this->map->itemAt('key2', 10.1)); //'key2' doesn't exist and priority 10.1... it is only at priority 10
-
+
$this->assertEquals($this->item4, $this->map->remove('key4'));
$this->assertEquals(4, $this->map->getCount());
-
+
$this->assertEquals($this->item5, $this->map->remove('key5'));
$this->assertEquals(3, $this->map->getCount());
}
public function testIteratorAndArrayWithPriorities() {
-
+
$this->setUpPriorities();
-
+
// This is the primary reason for a TPriorityMap
$array = $this->map->toArray();
-
+
$ordered_keys = array_keys($array);
$this->assertEquals('key3', $ordered_keys[0]);
$this->assertEquals('key5', $ordered_keys[1]);
$this->assertEquals('key1', $ordered_keys[2]);
$this->assertEquals('key2', $ordered_keys[3]);
$this->assertEquals('key4', $ordered_keys[4]);
-
+
$ordered_values = array_values($array);
$this->assertEquals($this->item3, $ordered_values[0]);
$this->assertEquals($this->item5, $ordered_values[1]);
$this->assertEquals($this->item1, $ordered_values[2]);
$this->assertEquals($this->item2, $ordered_values[3]);
$this->assertEquals($this->item4, $ordered_values[4]);
-
+
$iter = $this->map->getIterator();
-
+
$this->assertTrue($iter->valid());
$this->assertEquals('key3', $iter->key());
$this->assertEquals($this->item1, $iter->current());
@@ -341,31 +341,31 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(null, $iter->key());
$this->assertEquals(null, $iter->current());
}
-
-
+
+
public function testGetPriorities() {
$this->setUpPriorities();
-
+
$priorities = $this->map->getPriorities();
-
+
$this->assertEquals(0, $priorities[0]);
$this->assertEquals(1, $priorities[1]);
$this->assertEquals(10, $priorities[2]);
$this->assertEquals(100, $priorities[3]);
$this->assertEquals(false, isset($priorities[4]));
}
-
-
+
+
public function testCopyAndMergeWithPriorities() {
$this->setUpPriorities();
-
+
$map1 = new TPriorityMap();
$map1->add('key1', $this->item1);
$map1->add('keyc', 'valuec');
$map1->copyFrom($this->map);
-
+
$this->assertEquals(5, $map1->getCount());
-
+
$array = $map1->toArray();
$ordered_keys = array_keys($array);
$this->assertEquals('key3', $ordered_keys[0]);
@@ -373,24 +373,24 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('key1', $ordered_keys[2]);
$this->assertEquals('key2', $ordered_keys[3]);
$this->assertEquals('key4', $ordered_keys[4]);
-
+
$ordered_values = array_values($array);
$this->assertEquals($this->item3, $ordered_values[0]);
$this->assertEquals($this->item5, $ordered_values[1]);
$this->assertEquals($this->item1, $ordered_values[2]);
$this->assertEquals($this->item2, $ordered_values[3]);
$this->assertEquals($this->item4, $ordered_values[4]);
-
-
-
+
+
+
$map2 = new TPriorityMap();
$map2->add('startkey', 'startvalue', -1000);
$map2->add('key5', 'value5', 40);
$map2->add('endkey', 'endvalue', 1000);
$map2->mergeWith($this->map);
-
+
$this->assertEquals(7, $map2->getCount());
-
+
$array = $map2->toArray();
$ordered_keys = array_keys($array);
$this->assertEquals('startkey', $ordered_keys[0]);
@@ -400,7 +400,7 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('key2', $ordered_keys[4]);
$this->assertEquals('key4', $ordered_keys[5]);
$this->assertEquals('endkey', $ordered_keys[6]);
-
+
$ordered_values = array_values($array);
$this->assertEquals('startvalue', $ordered_values[0]);
$this->assertEquals($this->item3, $ordered_values[1]);
@@ -409,81 +409,80 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($this->item2, $ordered_values[4]);
$this->assertEquals($this->item4, $ordered_values[5]);
$this->assertEquals('endvalue', $ordered_values[6]);
-
+
$this->assertEquals(1, $map2->priorityAt('key5'));
$this->assertEquals(1, $map2->priorityOf($this->item5));
}
-
+
public function testSetPriorityAt() {
-
+
$this->assertEquals(10, $this->map->priorityAt('key2'));
$this->assertEquals(10, $this->map->setPriorityAt('key2', 1));
$this->assertEquals(1, $this->map->priorityAt('key2'));
$this->assertEquals(1, $this->map->setPriorityAt('key2'));
$this->assertEquals(10, $this->map->priorityAt('key2'));
}
-
+
public function testToArrayBelowPriority() {
$this->setUpPriorities();
-
+
$array = $this->map->toArrayBelowPriority(1);
$this->assertEquals(array('key3'=> $this->item3), $array);
$this->assertEquals(1, count($array));
-
+
$array = $this->map->toArrayBelowPriority(1, true);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5), $array);
$this->assertEquals(2, count($array));
-
+
$array = $this->map->toArrayBelowPriority(2);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5), $array);
$this->assertEquals(2, count($array));
-
+
$array = $this->map->toArrayBelowPriority(10);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5), $array);
$this->assertEquals(2, count($array));
-
+
$array = $this->map->toArrayBelowPriority(10, true);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5, 'key1' => $this->item1, 'key2' => $this->item2), $array);
$this->assertEquals(4, count($array));
-
+
$array = $this->map->toArrayBelowPriority(100);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5, 'key1' => $this->item1, 'key2' => $this->item2), $array);
$this->assertEquals(4, count($array));
-
+
$array = $this->map->toArrayBelowPriority(100, true);
$this->assertEquals(array('key3'=> $this->item3, 'key5'=> $this->item5, 'key1' => $this->item1, 'key2' => $this->item2, 'key4' => $this->item4), $array);
$this->assertEquals(5, count($array));
}
-
+
public function testToArrayAbovePriority() {
$this->setUpPriorities();
-
+
$array = $this->map->toArrayAbovePriority(100, false);
$this->assertEquals(0, count($array));
-
+
$array = $this->map->toArrayAbovePriority(100, true);
$this->assertEquals(1, count($array));
$this->assertEquals(array('key4' => $this->item4), $array);
-
+
$array = $this->map->toArrayAbovePriority(11);
$this->assertEquals(array('key4' => $this->item4), $array);
$this->assertEquals(1, count($array));
-
+
$array = $this->map->toArrayAbovePriority(10, false);
$this->assertEquals(array('key4' => $this->item4), $array);
$this->assertEquals(1, count($array));
-
+
$array = $this->map->toArrayAbovePriority(10);
$this->assertEquals(array('key1' => $this->item1, 'key2' => $this->item2, 'key4' => $this->item4), $array);
$this->assertEquals(3, count($array));
-
+
$array = $this->map->toArrayAbovePriority(0);
$this->assertEquals(array('key3' => $this->item3, 'key5' => $this->item5, 'key1' => $this->item1, 'key2' => $this->item2, 'key4' => $this->item4), $array);
$this->assertEquals(5, count($array));
}
-
-
-
+
+
+
}
-?>
diff --git a/tests/unit/Collections/TQueueTest.php b/tests/unit/Collections/TQueueTest.php
index efee7cb7..da60eae3 100644
--- a/tests/unit/Collections/TQueueTest.php
+++ b/tests/unit/Collections/TQueueTest.php
@@ -31,7 +31,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
$queue->copyFrom($data);
self::assertEquals(array(4, 5, 6), $queue->toArray());
}
-
+
public function testCanNotCopyFromNonTraversableTypes() {
$queue = new TQueue();
$data = new stdClass();
@@ -42,7 +42,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
}
self::fail('An expected TInvalidDataTypeException was not raised');
}
-
+
public function testClear() {
$queue = new TQueue(array(1, 2, 3));
$queue->clear();
@@ -59,7 +59,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
$queue = new TQueue(array(1,2,3));
self::assertEquals(1, $queue->peek());
}
-
+
public function testCanNotPeekAnEmptyQueue() {
$queue = new TQueue();
try {
@@ -76,7 +76,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
self::assertEquals(1, $first);
self::assertEquals(array(2, 3), $queue->toArray());
}
-
+
public function testCanNotDequeueAnEmptyQueue() {
$queue = new TQueue();
try {
@@ -105,7 +105,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
$found++;
}
if($index === 1 && $item === 2) {
- $found++;
+ $found++;
}
}
self::assertTrue($n == 2 && $found == 2);
@@ -117,7 +117,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
$queue = new TQueue(array(1, 2, 3));
self::assertEquals(3, $queue->getCount());
}
-
+
public function testCountable() {
$queue = new TQueue();
self::assertEquals(0, count($queue));
@@ -127,4 +127,3 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Collections/TStackTest.php b/tests/unit/Collections/TStackTest.php
index 89a42749..80dc77c3 100644
--- a/tests/unit/Collections/TStackTest.php
+++ b/tests/unit/Collections/TStackTest.php
@@ -31,7 +31,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
$stack->copyFrom($data);
self::assertEquals(array(4, 5, 6), $stack->toArray());
}
-
+
public function testCanNotCopyFromNonTraversableTypes() {
$stack = new TStack();
$data = new stdClass();
@@ -42,7 +42,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
}
self::fail('An expected TInvalidDataTypeException was not raised');
}
-
+
public function testClear() {
$stack = new TStack(array(1, 2, 3));
$stack->clear();
@@ -59,7 +59,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
$stack = new TStack(array(1));
self::assertEquals(1, $stack->peek());
}
-
+
public function testCanNotPeekAnEmptyStack() {
$stack = new TStack();
try {
@@ -76,7 +76,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
self::assertEquals(3, $last);
self::assertEquals(array(1, 2), $stack->toArray());
}
-
+
public function testCanNotPopAnEmptyStack() {
$stack = new TStack();
try {
@@ -105,7 +105,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
$found++;
}
if($index === 1 && $item === 2) {
- $found++;
+ $found++;
}
}
self::assertTrue($n == 2 && $found == 2);
@@ -117,7 +117,7 @@ class TStackTest extends PHPUnit_Framework_TestCase {
$stack = new TStack(array(1, 2, 3));
self::assertEquals(3, $stack->getCount());
}
-
+
public function testCount() {
$stack = new TStack();
self::assertEquals(0, count($stack));
@@ -127,4 +127,3 @@ class TStackTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Data/DataGateway/AllTests.php b/tests/unit/Data/DataGateway/AllTests.php
index f9ba1ddc..6007ae70 100644
--- a/tests/unit/Data/DataGateway/AllTests.php
+++ b/tests/unit/Data/DataGateway/AllTests.php
@@ -12,12 +12,12 @@ class Data_DataGateway_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Data.DataGateway');
-
+
$suite->addTestSuite('TSqlCriteriaTest');
-
+
return $suite;
}
}
@@ -25,4 +25,3 @@ class Data_DataGateway_AllTests {
if(PHPUnit_MAIN_METHOD == 'Data_DataGateway_AllTests::main') {
Data_DataGateway_AllTests::main();
}
-?>
diff --git a/tests/unit/Data/DataGateway/TSqlCriteriaTest.php b/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
index fb9c72b2..ce22ef1d 100644
--- a/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
+++ b/tests/unit/Data/DataGateway/TSqlCriteriaTest.php
@@ -17,7 +17,7 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
public function testConstruct() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testConditionWithOrderByColumnNames() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references ORDER BY field1 ASC, field2 DESC";
@@ -27,7 +27,7 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
self::assertEquals(true, isset($criteria->OrdersBy['field2']));
self::assertEquals('DESC', $criteria->OrdersBy['field2']);
}
-
+
public function testConditionWithOrderByExpression() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references ORDER BY RAND()";
@@ -42,7 +42,7 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
self::assertEquals("SELECT * FROM table_references", $criteria->Condition);
self::assertEquals(2, $criteria->Limit);
}
-
+
public function testConditionWithOrderByAndLimitAndOffset() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references ORDER BY field1 ASC, field2 DESC LIMIT 3, 2";
@@ -50,7 +50,7 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
self::assertEquals(2, $criteria->Limit);
self::assertEquals(3, $criteria->Offset);
}
-
+
public function testConditionWithOrderByAndLimitAndOffsetVariant() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references ORDER BY field1 ASC, field2 DESC LIMIT 2 OFFSET 3";
@@ -58,14 +58,14 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
self::assertEquals(2, $criteria->Limit);
self::assertEquals(3, $criteria->Offset);
}
-
+
public function testConditionWithLimit() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references LIMIT 2";
self::assertEquals("SELECT * FROM table_references", $criteria->Condition);
self::assertEquals(2, $criteria->Limit);
}
-
+
public function testConditionWithLimitAndOffset() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references LIMIT 3, 2";
@@ -73,7 +73,7 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
self::assertEquals(2, $criteria->Limit);
self::assertEquals(3, $criteria->Offset);
}
-
+
public function testConditionWithLimitAndOffsetVariant() {
$criteria = new TSqlCriteria();
$criteria->Condition = "SELECT * FROM table_references LIMIT 2 OFFSET 3";
@@ -85,27 +85,26 @@ class TSqlCriteriaTest extends PHPUnit_Framework_TestCase {
public function testParameters() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testIsNamedParameters() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOrdersBy() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLimit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOffset() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testToString() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
-?>
diff --git a/tests/unit/Data/SqlMap/AllTests.php b/tests/unit/Data/SqlMap/AllTests.php
index 3adaa29c..08870eb3 100644
--- a/tests/unit/Data/SqlMap/AllTests.php
+++ b/tests/unit/Data/SqlMap/AllTests.php
@@ -27,4 +27,3 @@ class Data_SqlMap_AllTests {
if(PHPUnit_MAIN_METHOD == 'Data_SqlMap_AllTests::main') {
Data_SqlMap_AllTests::main();
}
-?>
diff --git a/tests/unit/Data/SqlMap/DataMapper/AllTests.php b/tests/unit/Data/SqlMap/DataMapper/AllTests.php
index 47b8522f..d685d474 100644
--- a/tests/unit/Data/SqlMap/DataMapper/AllTests.php
+++ b/tests/unit/Data/SqlMap/DataMapper/AllTests.php
@@ -24,5 +24,4 @@ class Data_SqlMap_DataMapper_AllTests {
if(PHPUnit_MAIN_METHOD == 'Data_SqlMap_DataMapper_AllTests::main') {
Data_SqlMap_DataMapper_AllTests::main();
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php b/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
index 61747c6b..3f5493c7 100644
--- a/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
+++ b/tests/unit/Data/SqlMap/DataMapper/TPropertyAccessTest.php
@@ -265,5 +265,3 @@ class _PropertyAccessTestHelperDynamicProperties
}
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Data/SqlMap/DynamicParameterTest.php b/tests/unit/Data/SqlMap/DynamicParameterTest.php
index 64f5e35c..136111db 100644
--- a/tests/unit/Data/SqlMap/DynamicParameterTest.php
+++ b/tests/unit/Data/SqlMap/DynamicParameterTest.php
@@ -105,5 +105,3 @@ class DynamicParameterTest extends PHPUnit_Framework_TestCase
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Data/TDbCommandTest.php b/tests/unit/Data/TDbCommandTest.php
index ab2a4435..87bbbf05 100644
--- a/tests/unit/Data/TDbCommandTest.php
+++ b/tests/unit/Data/TDbCommandTest.php
@@ -220,5 +220,3 @@ class TDbCommandTest extends PHPUnit_Framework_TestCase
}
}
}
-
-?>
diff --git a/tests/unit/Data/TDbConnectionTest.php b/tests/unit/Data/TDbConnectionTest.php
index d5c54c39..4b32300c 100644
--- a/tests/unit/Data/TDbConnectionTest.php
+++ b/tests/unit/Data/TDbConnectionTest.php
@@ -125,5 +125,3 @@ class TDbConnectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(TDbNullConversionMode::NullToEmptyString,$this->_connection1->NullConversion);
}
}
-
-?>
diff --git a/tests/unit/Data/TDbDataReaderTest.php b/tests/unit/Data/TDbDataReaderTest.php
index d1f0b547..2e31245e 100644
--- a/tests/unit/Data/TDbDataReaderTest.php
+++ b/tests/unit/Data/TDbDataReaderTest.php
@@ -178,5 +178,3 @@ class TDbDataReaderTest extends PHPUnit_Framework_TestCase
$this->assertEquals($name,'my name 2');
}
}
-
-?>
diff --git a/tests/unit/Data/TDbTransactionTest.php b/tests/unit/Data/TDbTransactionTest.php
index 7a2b16c2..b51fda04 100644
--- a/tests/unit/Data/TDbTransactionTest.php
+++ b/tests/unit/Data/TDbTransactionTest.php
@@ -72,5 +72,3 @@ class TDbTransactionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(count($result),2);
}
}
-
-?>
diff --git a/tests/unit/I18N/core/AllTests.php b/tests/unit/I18N/core/AllTests.php
index 43bbdb36..bf5fb813 100644
--- a/tests/unit/I18N/core/AllTests.php
+++ b/tests/unit/I18N/core/AllTests.php
@@ -15,16 +15,16 @@ class I18N_core_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.I18N.core');
-
+
$suite->addTestSuite('CultureInfoTest');
$suite->addTestSuite('DateFormatTest');
$suite->addTestSuite('DateTimeFormatInfoTest');
$suite->addTestSuite('NumberFormatInfoTest');
$suite->addTestSuite('NumberFormatTest');
-
+
return $suite;
}
}
@@ -32,4 +32,3 @@ class I18N_core_AllTests {
if(PHPUnit_MAIN_METHOD == 'I18N_core_AllTests::main') {
I18N_core_AllTests::main();
}
-?>
diff --git a/tests/unit/I18N/core/ChoiceFormatTest.php b/tests/unit/I18N/core/ChoiceFormatTest.php
index ef397e05..2c8ab5cb 100644
--- a/tests/unit/I18N/core/ChoiceFormatTest.php
+++ b/tests/unit/I18N/core/ChoiceFormatTest.php
@@ -97,5 +97,3 @@ class ChoiceFormatTest extends PHPUnit_Framework_TestCase
}
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/CultureInfoTest.php b/tests/unit/I18N/core/CultureInfoTest.php
index 6c1eda06..58c8f235 100644
--- a/tests/unit/I18N/core/CultureInfoTest.php
+++ b/tests/unit/I18N/core/CultureInfoTest.php
@@ -8,16 +8,16 @@ Prado::using('System.I18N.core.CultureInfo');
*/
class CultureInfoTest extends PHPUnit_Framework_TestCase {
protected $culture;
-
+
function setUp() {
$this->culture = CultureInfo::getInvariantCulture();
}
-
+
function testCultureName() {
$name = 'en';
-
+
$this->assertEquals($name, $this->culture->Name);
-
+
//the default/invariant culture should be neutral
$this->assertTrue($this->culture->IsNeutralCulture);
}
@@ -26,18 +26,18 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$allCultures = CultureInfo::getCultures();
$neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL);
$specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
-
+
//there should be 246 cultures all together.
$this->assertEquals(count($allCultures),246);
$this->assertEquals(count($neutralCultures),76);
- $this->assertEquals(count($specificCultures),170);
+ $this->assertEquals(count($specificCultures),170);
}
function testParentCultures() {
$zh_CN = new CultureInfo('zh_CN');
$parent = $zh_CN->Parent;
$grandparent = $parent->Parent;
-
+
$this->assertEquals($zh_CN->Name, 'zh_CN');
$this->assertEquals($parent->Name, 'zh');
$this->assertEquals($grandparent->Name, 'en');
@@ -54,17 +54,17 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$au = array('$', 'Australian Dollar');
$this->assertEquals($au, $culture->Currencies['AUD']);
}
-
+
function testLanguages() {
$culture = new CultureInfo('fr_BE');
$this->assertEquals($culture->Languages['fr'], 'français');
}
-
+
function testScripts() {
$culture = new CultureInfo('fr');
$this->assertEquals($culture->Scripts['Armn'], 'arménien');
}
-
+
function testTimeZones() {
$culture = new CultureInfo('fi');
$zone = array(
@@ -83,5 +83,3 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($culture->getEnglishName(), 'iw');
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/DateFormatTest.php b/tests/unit/I18N/core/DateFormatTest.php
index 8015bd74..d8350204 100644
--- a/tests/unit/I18N/core/DateFormatTest.php
+++ b/tests/unit/I18N/core/DateFormatTest.php
@@ -10,86 +10,84 @@ class DateFormatTest extends PHPUnit_Framework_TestCase {
public function testStandardPatterns() {
$dateFormatter = new DateFormat();
-
+
$time = @mktime(9, 9, 9, 9, 1, 2004);
$zone = @date('T', $time);
//var_dump(date('c',$time));
//for ShortDatePattern "M/d/yy"
$this->assertEquals('9/1/04', $dateFormatter->format($time, 'd'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'d'))));
-
+
//for LongDatePattern "MMMM d, yyyy"
$wants = 'September 1, 2004';
$this->assertEquals($wants, $dateFormatter->format($time, 'D'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'D'))));
-
+
//for Full date and time "MMMM d, yyyy h:mm a"
$wants = 'September 1, 2004 9:09 AM';
$this->assertEquals($wants, $dateFormatter->format($time, 'f'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
-
+
//for FullDateTimePattern "MMMM d, yyyy h:mm:ss a z"
$wants = 'September 1, 2004 9:09:09 AM '.$zone;
$this->assertEquals($wants, $dateFormatter->format($time, 'F'));
-
+
//for General "M/d/yy h:mm a"
$wants = '9/1/04 9:09 AM';
$this->assertEquals($wants, $dateFormatter->format($time, 'g'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
-
+
//for General "M/d/yy h:mm:ss a z"
$wants = '9/1/04 9:09:09 AM '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
-
+ $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
+
//for MonthDayPattern "MMMM dd" (invariant)
$wants = 'September 01';
$this->assertEquals($wants, $dateFormatter->format($time, 'm'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'m'))));
-
+
//for RFC1123Pattern "EEE, dd MMM yyyy HH:mm:ss" (invariant)
$wants = 'Wed, 01 Sep 2004 09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 'r'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'r'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'r'))));
-
+
//for SortableDateTimePattern "yyyy-MM-ddTHH:mm:ss" (invariant)
$wants = '2004-09-01T09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 's'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 's'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'s'))));
-
+
//for ShortTimePattern "H:mm a"
$wants = '9:09 AM';
- $this->assertEquals($wants, $dateFormatter->format($time, 't'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 't'));
//(date('c',strtotime($dateFormatter->format($time,'t'))));
-
+
//for LongTimePattern "H:mm:ss a z"
$wants = '9:09:09 AM '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
-
- //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
+ $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
+
+ //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
//(invariant)
$wants = '2004-09-01 09:09:09 '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
-
+ $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
+
//for Full date and time "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
$wants = 'Wednesday 01 September 2004 09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 'U'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'U'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'U'))));
-
+
//for YearMonthPattern "yyyy MMMM" (invariant)
$wants = '2004 September';
- $this->assertEquals($wants, $dateFormatter->format($time, 'y'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'y'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'y'))));
}
-
+
public function testCustomPatterns() {
$dateFormatter = new DateFormat();
-
+
$time = @mktime(9, 9, 9, 9, 1, 2004);
-
+
$pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
$wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
- $this->assertEquals($wants, $dateFormatter->format($time, $pattern));
+ $this->assertEquals($wants, $dateFormatter->format($time, $pattern));
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/DateTimeFormatInfoTest.php b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
index 442a6b85..ac93e1c7 100644
--- a/tests/unit/I18N/core/DateTimeFormatInfoTest.php
+++ b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
@@ -9,20 +9,20 @@ Prado::using('System.I18N.core.DateTimeFormatInfo');
class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
protected $format;
-
+
function setUp() {
$this->format = DateTimeFormatInfo::getInstance('en');
}
-
+
function testAbbreviatedDayNames() {
$names = $this->format->AbbreviatedDayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hel', 'wor');
$this->format->AbbreviatedDayNames = $data;
@@ -31,16 +31,16 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testNarrowDayNames() {
$names = $this->format->NarrowDayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array("S", "M", "T", "W", "T", "F", "S");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('H', 'w');
$this->format->NarrowDayNames = $data;
@@ -49,17 +49,17 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testDayNames() {
$names = $this->format->DayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array( "Sunday","Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->DayNames = $data;
@@ -68,18 +68,18 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testMonthNames() {
$names = $this->format->MonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->MonthNames = $data;
@@ -88,17 +88,17 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testNarrowMonthNames() {
$names = $this->format->NarrowMonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "J", "F", "M", "A", "M", "J", "J",
"A", "S", "O", "N", "D");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->NarrowMonthNames = $data;
@@ -112,13 +112,13 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$names = $this->format->AbbreviatedMonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->AbbreviatedMonthNames = $data;
@@ -134,7 +134,7 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('AD', $this->format->getEra(1));
$this->assertEquals('BC', $this->format->getEra(0));
}
-
+
function testAMPMMarkers() {
$am_pm = array('AM','PM');
$data = $this->format->AMPMMarkers;
@@ -142,7 +142,7 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($am_pm, $data);
$this->assertEquals('AM', $this->format->AMDesignator);
$this->assertEquals('PM', $this->format->PMDesignator);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->AMPMMarkers = $data;
@@ -150,10 +150,10 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertTrue(is_array($newNames),'Must be an array!');
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
-
+
$this->format->AMDesignator = 'TTTT';
$this->assertEquals('TTTT',$this->format->AMDesignator);
-
+
$this->format->PMDesignator = 'SSS';
$this->assertEquals('SSS',$this->format->PMDesignator);
}
@@ -171,37 +171,36 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
'ShortDatePattern' => 'M/d/yy',
'DateTimeOrderPattern' => '{1} {0}'
);
-
+
foreach($patterns as $property => $pattern) {
$this->assertEquals($pattern, $this->format->$property);
}
-
+
$hello = 'Hello';
$world = 'world';
$expectedResult = $hello.' '.$world;
$this->assertEquals($expectedResult,
$this->format->formatDateTime($hello, $world));
}
-
+
function testInvariantInfo() {
$format = DateTimeFormatInfo::getInstance();
-
+
//the variant datetime format for medium date
//should be the follow
$pattern = 'MMM d, yyyy';
-
+
$this->assertEquals($pattern, $format->MediumDatePattern);
-
+
$invariant = $format->getInvariantInfo();
-
+
$this->assertSame($format, $invariant);
}
-
+
function testGetInstance() {
$format = DateTimeFormatInfo::getInstance('zh_CN');
-
+
$pattern = 'yyyy-M-d';
$this->assertEquals($pattern, $format->MediumDatePattern);
- }
-}
-?> \ No newline at end of file
+ }
+} \ No newline at end of file
diff --git a/tests/unit/I18N/core/NumberFormatInfoTest.php b/tests/unit/I18N/core/NumberFormatInfoTest.php
index d522144f..6243095a 100644
--- a/tests/unit/I18N/core/NumberFormatInfoTest.php
+++ b/tests/unit/I18N/core/NumberFormatInfoTest.php
@@ -8,27 +8,27 @@ Prado::using('System.I18N.core.NumberFormatInfo');
* @package System.I18N.core
*/
class NumberFormatInfoTest extends PHPUnit_Framework_TestCase {
-
+
function testCurrencyPatterns() {
$numberInfo = NumberFormatInfo::getCurrencyInstance();
-
+
//there should be 2 decimal places.
$this->assertEquals($numberInfo->DecimalDigits,2);
$this->assertEquals($numberInfo->DecimalSeparator,'.');
$this->assertEquals($numberInfo->GroupSeparator,',');
-
+
//there should be only 1 grouping of size 3
$groupsize = array(3,false);
$this->assertEquals($numberInfo->GroupSizes, $groupsize);
-
+
//the default negative pattern prefix and postfix
$negPattern = array('-¤','');
$this->assertEquals($numberInfo->NegativePattern, $negPattern);
-
+
//the default positive pattern prefix and postfix
$negPattern = array('¤','');
$this->assertEquals($numberInfo->PositivePattern, $negPattern);
-
+
//the default currency symbol
$this->assertEquals($numberInfo->CurrencySymbol, 'US$');
$this->assertEquals($numberInfo->getCurrencySymbol('JPY'), 'Â¥');
@@ -38,51 +38,49 @@ class NumberFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($numberInfo->PositiveSign, '+');
$this->assertEquals($numberInfo->NaNSymbol, '�');
$this->assertEquals($numberInfo->PercentSymbol, '%');
- $this->assertEquals($numberInfo->PerMilleSymbol, '‰');
+ $this->assertEquals($numberInfo->PerMilleSymbol, '‰');
}
function testPatternsSet() {
$numberInfo = NumberFormatInfo::getInstance();
-
+
$numberInfo->DecimalDigits = 0;
$this->assertEquals($numberInfo->DecimalDigits,0);
-
+
$numberInfo->DecimalSeparator = ',';
$this->assertEquals($numberInfo->DecimalSeparator,',');
-
+
$numberInfo->GroupSeparator = ' ';
$this->assertEquals($numberInfo->GroupSeparator,' ');
-
+
$numberInfo->GroupSizes = array(2,3);
$groupsize = array(2,3);
$this->assertEquals($numberInfo->GroupSizes, $groupsize);
-
+
$numberInfo->NegativePattern = array('-$$','.');
$negPattern = array('-$$','.');
$this->assertEquals($numberInfo->NegativePattern, $negPattern);
-
+
$numberInfo->PositivePattern = array('YY','.');
$negPattern = array('YY','.');
$this->assertEquals($numberInfo->PositivePattern, $negPattern);
-
+
//the default CurrencySymbol symbol
$numberInfo->CurrencySymbol = '$$$';
$this->assertEquals($numberInfo->CurrencySymbol, '$$$');
}
-
+
function testLocalizedPatterns() {
$fr = NumberFormatInfo::getInstance('fr');
$de = NumberFormatInfo::getInstance('de');
$en = NumberFormatInfo::getInstance('en_US');
-
+
$this->assertEquals($fr->DecimalSeparator, ',');
$this->assertEquals($de->DecimalSeparator, ',');
$this->assertEquals($en->DecimalSeparator, '.');
-
+
$this->assertEquals($fr->GroupSeparator, ' ');
$this->assertEquals($de->GroupSeparator, '.');
$this->assertEquals($en->GroupSeparator, ',');
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/NumberFormatTest.php b/tests/unit/I18N/core/NumberFormatTest.php
index 958f05f4..ef8add77 100644
--- a/tests/unit/I18N/core/NumberFormatTest.php
+++ b/tests/unit/I18N/core/NumberFormatTest.php
@@ -14,7 +14,7 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$wanted = '123,456,789.125156';
$this->assertEquals($wanted, $formatter->format($number));
-
+
//currency
$wanted = 'US$123,456,789.13';
$this->assertEquals($wanted, $formatter->format($number,'c'));
@@ -25,21 +25,21 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$de = new NumberFormat('de');
$ja = new NumberFormat('ja_JP');
$it = new NumberFormat('it_IT');
-
+
$number = '123456789.125156';
-
+
//french
$wanted = '123 456 789,13 F';
$this->assertEquals($wanted, $fr->format($number,'c','FRF'));
-
+
//german
$wanted = 'DES 123.456.789,13';
$this->assertEquals($wanted, $de->format($number,'c','DES'));
-
+
//japanese
$wanted = 'ï¿¥123,456,789';
$this->assertEquals($wanted, $ja->format($number,'c','JPY'));
-
+
//custom/unkown currency
$wanted = 'DLL123,456,789';
$this->assertEquals($wanted, $ja->format($number,'c','DLL'));
@@ -52,54 +52,54 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
function testCustomFormat() {
$formatter = new NumberFormat();
$number = '123456789.125156';
-
+
//primay and secondary grouping test
$pattern = '#,###,##.###';
$wanted = '1,234,567,89.125156';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
//4 digits grouping test
$pattern = '#,####.###';
$wanted = '1,2345,6789.125156';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
//custom percentage
$pattern = '#,###.00%';
$wanted = '123,456,789.13%';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
}
-
+
function testPercentageFormat() {
$formatter = new NumberFormat();
$number = '0.125156';
$wanted = '12%';
$this->assertEquals($wanted, $formatter->format($number, 'p'));
}
-
+
function testQuotes() {
$formatter = new NumberFormat();
$number = '123456789.125156';
-
+
$pattern = "# o'clock";
$wanted = "123456789 o'clock";
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
}
-
+
function testPadding() {
$formatter = new NumberFormat();
$number = '5';
-
+
$pattern = '0000';
$wanted = '0005';
-
+
$this->assertEquals($wanted, $formatter->format($number, $pattern));
}
-
+
function testFormatWithANegativeValue() {
$formatter = new NumberFormat();
$number = "-1.2";
-
+
$wanted = "-1.2";
$this->assertEquals($wanted, $formatter->format($number));
}
@@ -110,33 +110,33 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$expected = "10E";
$this->assertEquals('10E', $formatter->format($number, 'e'));
}
-
+
function testRounding()
{
$formatter = new NumberFormat();
-
+
$number = 349.999;
$pattern = '#.00';
$expected = '350.00';
-
+
$this->assertEquals($expected, $formatter->format($number, $pattern));
}
function testRounding2()
{
$formatter = new NumberFormat();
-
+
$number = 349.99;
$pattern = '#.00';
$expected = '349.99';
-
+
$this->assertEquals($expected, $formatter->format($number, $pattern));
}
function testLocalizedCurrencyFormats2() {
$it = new NumberFormat('it_IT');
-
+
$number = 12.41;
$wanted = '12,41';
$this->assertEquals($wanted, $it->format($number,'d'));
@@ -149,7 +149,7 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$wanted = '10.010,23';
$this->assertEquals($wanted, $it->format($number,'d'));
- $old= setlocale(LC_ALL,"0");
+ $old= setlocale(LC_ALL,"0");
setlocale(LC_ALL,"it_IT");
$number = 12.41;
@@ -167,5 +167,3 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
setlocale(LC_ALL,$old);
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/IO/AllTests.php b/tests/unit/IO/AllTests.php
index 01bbd95d..c789169f 100644
--- a/tests/unit/IO/AllTests.php
+++ b/tests/unit/IO/AllTests.php
@@ -11,13 +11,13 @@ 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('TTarFileExtractorTest');
$suite->addTestSuite('TTextWriterTest');
-
+
return $suite;
}
}
@@ -25,4 +25,3 @@ class IO_AllTests {
if(PHPUnit_MAIN_METHOD == 'IO_AllTests::main') {
IO_AllTests::main();
}
-?>
diff --git a/tests/unit/IO/TTarFileExtractorTest.php b/tests/unit/IO/TTarFileExtractorTest.php
index 66b66831..860560b1 100644
--- a/tests/unit/IO/TTarFileExtractorTest.php
+++ b/tests/unit/IO/TTarFileExtractorTest.php
@@ -14,10 +14,9 @@ class TTarFileExtractorTest extends PHPUnit_Framework_TestCase {
public function testDestruct() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testExtract() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/IO/TTextWriterTest.php b/tests/unit/IO/TTextWriterTest.php
index d23fec36..087812d7 100644
--- a/tests/unit/IO/TTextWriterTest.php
+++ b/tests/unit/IO/TTextWriterTest.php
@@ -20,7 +20,7 @@ class TTextWriterTest extends PHPUnit_Framework_TestCase {
$writer->write("more text\n");
self::assertEquals("some text\nmore text\n", $writer->flush());
}
-
+
public function testWriteLine() {
$writer = new TTextWriter();
$writer->writeLine('some text');
@@ -28,4 +28,3 @@ class TTextWriterTest extends PHPUnit_Framework_TestCase {
}
}
-?>
diff --git a/tests/unit/Security/AllTests.php b/tests/unit/Security/AllTests.php
index 40316719..e71307a9 100644
--- a/tests/unit/Security/AllTests.php
+++ b/tests/unit/Security/AllTests.php
@@ -14,16 +14,16 @@ 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;
}
}
@@ -31,4 +31,3 @@ class Security_AllTests {
if(PHPUnit_MAIN_METHOD == 'Security_AllTests::main') {
Security_AllTests::main();
}
-?>
diff --git a/tests/unit/Security/TAuthManagerTest.php b/tests/unit/Security/TAuthManagerTest.php
index 03244a22..3b8b9305 100644
--- a/tests/unit/Security/TAuthManagerTest.php
+++ b/tests/unit/Security/TAuthManagerTest.php
@@ -8,7 +8,7 @@ Prado::using('System.Xml.TXmlDocument');
* @package System.Security
*/
class TAuthManagerTest extends PHPUnit_Framework_TestCase {
-
+
public static $app = null;
public static $usrMgr = null;
@@ -18,7 +18,7 @@ class TAuthManagerTest extends PHPUnit_Framework_TestCase {
if(self::$app === null) {
self::$app = new TApplication(dirname(__FILE__).'/app');
}
-
+
// Make a fake user manager module
if (self::$usrMgr === null) {
self::$usrMgr=new TUserManager ();
@@ -39,26 +39,26 @@ class TAuthManagerTest extends PHPUnit_Framework_TestCase {
$authManager->init(null);
self::fail ('Expected TConfigurationException not thrown');
} catch (TConfigurationException $e) {}
-
+
$authManager->setUserManager('users');
$authManager->init (null);
self::assertEquals(self::$usrMgr, $authManager->getUserManager());
}
-
+
public function testUserManager() {
$authManager=new TAuthManager ();
$authManager->setUserManager('users');
$authManager->init(null);
self::assertEquals(self::$usrMgr, $authManager->getUserManager());
-
+
// test change
try {
$authManager->setUserManager('invalid');
self::fail ('Expected TInvalidOperationException not thrown');
} catch (TInvalidOperationException $e) {}
-
+
}
-
+
public function testLoginPage() {
$authManager=new TAuthManager ();
$authManager->setUserManager('users');
@@ -66,7 +66,7 @@ class TAuthManagerTest extends PHPUnit_Framework_TestCase {
$authManager->setLoginPage ('LoginPage');
self::assertEquals('LoginPage', $authManager->getLoginPage());
}
-
+
public function testDoAuthentication() {
throw new PHPUnit_Framework_IncompleteTestError();
// Not yet finished, Session won't start because of headers :( :(
@@ -76,41 +76,40 @@ class TAuthManagerTest extends PHPUnit_Framework_TestCase {
$authManager->init(null);
$authManager->setLoginPage ('LoginPage');
self::$app->raiseEvent ('onAuthentication', self::$app, null);
-
+
}
-
+
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
index 5d5f2d97..5bfa6c2c 100644
--- a/tests/unit/Security/TAuthorizationRuleTest.php
+++ b/tests/unit/Security/TAuthorizationRuleTest.php
@@ -16,35 +16,34 @@ class TAuthorizationRuleTest extends PHPUnit_Framework_TestCase {
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
index 09c261cf..9c319a5a 100644
--- a/tests/unit/Security/TSecurityManagerTest.php
+++ b/tests/unit/Security/TSecurityManagerTest.php
@@ -22,39 +22,39 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
$sec->init(null);
self::assertEquals ($sec, self::$app->getSecurityManager());
}
-
+
public function testValidationKey() {
$sec=new TSecurityManager ();
$sec->init (null);
// Random validation key
$valkey=$sec->getValidationKey ();
self::assertEquals($valkey, self::$app->getGlobalState(TSecurityManager::STATE_VALIDATION_KEY));
-
+
$sec->setValidationKey ('aKey');
self::assertEquals('aKey',$sec->getValidationKey());
-
+
try {
$sec->setValidationKey ('');
self::fail ('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
}
-
+
public function testEncryptionKey() {
$sec=new TSecurityManager ();
$sec->init (null);
// Random encryption key
$valkey=$sec->getEncryptionKey ();
self::assertEquals($valkey, self::$app->getGlobalState(TSecurityManager::STATE_ENCRYPTION_KEY));
-
+
$sec->setEncryptionKey ('aKey');
self::assertEquals('aKey',$sec->getEncryptionKey());
-
+
try {
$sec->setEncryptionKey ('');
self::fail ('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
}
-
+
public function testValidation() {
$sec=new TSecurityManager ();
$sec->init (null);
@@ -67,7 +67,7 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
self::fail ('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
}
-
+
public function testEncryption() {
$sec=new TSecurityManager ();
$sec->init (null);
@@ -79,7 +79,7 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals('NotExisting', $sec->getCryptAlgorithm());
}
}
-
+
public function testEncryptDecrypt() {
$sec=new TSecurityManager ();
$sec->init (null);
@@ -101,13 +101,13 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals($plainText,$decrypted);
- // try change key
+ // try change key
$sec->setEncryptionKey ('anotherKey');
self::assertNotEquals($plainText, $sec->decrypt($encrypted));
}
}
-
-
+
+
public function testHashData() {
$sec=new TSecurityManager ();
$sec->init (null);
@@ -118,7 +118,7 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals (54, strlen($hashed));
// The initial text should be after the initial hash
self::assertEquals ('A text to hash', substr($hashed,40));
-
+
// Same tests with MD5
$sec->setValidationKey('AnotherKey');
$sec->setValidation('MD5');
@@ -128,7 +128,7 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
// The initial text should be after the initial hash
self::assertEquals ('A text to hash', substr($hashed,32));
}
-
+
public function testValidateData() {
$sec=new TSecurityManager ();
$sec->init (null);
@@ -142,8 +142,7 @@ class TSecurityManagerTest extends PHPUnit_Framework_TestCase {
// and a test without tampered data
self::assertFalse($sec->validateData('bad'));
}
-
+
}
-?>
diff --git a/tests/unit/Security/TUserManagerTest.php b/tests/unit/Security/TUserManagerTest.php
index edb7ea6f..91b9d0c6 100644
--- a/tests/unit/Security/TUserManagerTest.php
+++ b/tests/unit/Security/TUserManagerTest.php
@@ -6,18 +6,18 @@ Prado::using('System.Security.TUserManager');
* @package System.Security
*/
class TUserManagerTest extends PHPUnit_Framework_TestCase {
-
+
public static $app=null;
public static $config=null;
-
+
public function setUp() {
-
+
if(self::$app === null) {
self::$app = new TApplication(dirname(__FILE__).'/app');
prado::setPathofAlias('App', dirname(__FILE__));
}
-
+
if (self::$config === null) {
// Simulate a config file
self::$config=new TXmlDocument('1.0','utf8');
@@ -41,21 +41,21 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
$userManager->init (new TXmlDocument()); // Empty config
self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
unlink (dirname(__FILE__).'/users.xml');
- }
+ }
}
-
+
public function testUsers() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
}
-
+
public function testRoles() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
self::assertEquals(array('joe'=>array ('Writer'), 'john'=>array ('Administrator','Writer'), 'test' => array ('Reader', 'User')), $userManager->getRoles());
}
-
+
public function testUserFile() {
$userManager=new TUserManager ();
try {
@@ -71,7 +71,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals(dirname(__FILE__).'/users.xml', $userManager->getUserFile());
unlink (dirname(__FILE__).'/users.xml');
$userManager=null;
- }
+ }
$userManager=new TUserManager ();
$userManager->init (self::$config);
try {
@@ -79,14 +79,14 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::fail ('Exception TInvalidOperationException not thrown');
} catch (TInvalidOperationException $e) {}
}
-
+
public function testGuestName() {
$userManager=new TUserManager ();
self::assertEquals('Guest', $userManager->getGuestName());
$userManager->setGuestName('Invite');
self::assertEquals('Invite', $userManager->getGuestName());
}
-
+
public function testPasswordMode() {
$userManager=new TUserManager ();
$userManager->setPasswordMode('Clear');
@@ -99,9 +99,9 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
$userManager->setPasswordMode('Invalid');
self::fail ('Exception TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
-
+
}
-
+
public function testValidateUser() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -109,7 +109,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertTrue($userManager->validateUser('Joe', 'demo'));
self::assertFalse($userManager->validateUser('John', 'bad'));
}
-
+
public function testUser() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -123,7 +123,7 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
self::assertFalse($user->getIsGuest());
self::assertNull($userManager->getUser('badUser'));
}
-
+
public function testSwitchToGuest() {
$userManager=new TUserManager ();
$userManager->init (self::$config);
@@ -134,4 +134,3 @@ class TUserManagerTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/Security/TUserTest.php b/tests/unit/Security/TUserTest.php
index 6fa337e0..3692b97c 100644
--- a/tests/unit/Security/TUserTest.php
+++ b/tests/unit/Security/TUserTest.php
@@ -32,18 +32,18 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertEquals('Guest', $user->getName());
self::assertEquals(self::$mgr, $user->getManager());
}
-
+
public function testManager() {
$user = new TUser (self::$mgr);
self::assertEquals(self::$mgr, $user->getManager());
}
-
+
public function testName() {
$user = new TUser (self::$mgr);
$user->setName('joe');
self::assertEquals('joe', $user->getName());
}
-
+
public function testIsGuest() {
$user = new TUser (self::$mgr);
$user->setName('John');
@@ -54,7 +54,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertTrue($user->getIsGuest());
self::assertEquals(array(),$user->getRoles());
}
-
+
public function testRoles() {
$user=new TUser(self::$mgr);
$user->setRoles(array('Administrator','Writer'));
@@ -62,7 +62,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
$user->setRoles('Reader,User');
self::assertEquals(array('Reader','User'), $user->getRoles());
}
-
+
public function testIsInRole() {
$user=new TUser(self::$mgr);
$user->setRoles(array('Administrator','Writer'));
@@ -71,7 +71,7 @@ class TUserTest extends PHPUnit_Framework_TestCase {
self::assertTrue($user->IsInRole('Writer'));
self::assertFalse($user->isInRole('Reader'));
}
-
+
public function testSaveToString() {
$user = new TUser (self::$mgr);
$user->setName('John');
@@ -81,20 +81,20 @@ class TUserTest extends PHPUnit_Framework_TestCase {
$assumedState=array ('Name' => 'John', 'IsGuest' => false, 'Roles' => array ('Administrator', 'Writer'));
self::assertEquals(serialize($assumedState), $user->saveToString());
}
-
+
public function testLoadFromString() {
$user = new TUser (self::$mgr);
$user->setName('John');
$user->setIsGuest(false);
$user->setRoles('Administrator, Writer');
$save=$user->saveToString();
-
+
$user2 = new TUser (self::$mgr);
$user2->loadFromString($save);
-
+
self::assertEquals($user, $user2);
}
-
+
/* getState & setState are protected methods, will be tested with other tests.
public function testState() {
throw new PHPUnit_Framework_IncompleteTestError();
@@ -111,4 +111,3 @@ class TUserTest extends PHPUnit_Framework_TestCase {
}
-?>
diff --git a/tests/unit/TComponentTest.php b/tests/unit/TComponentTest.php
index 93668dc0..9a2299da 100644
--- a/tests/unit/TComponentTest.php
+++ b/tests/unit/TComponentTest.php
@@ -13,24 +13,24 @@ class NewComponent extends TComponent {
public function getAutoGlobalListen() {
return true;
- }
+ }
public function getText() {
return $this->_text;
}
-
+
public function setText($value) {
$this->_text=$value;
}
-
+
public function getReadOnlyProperty() {
return 'read only';
}
-
+
public function getJsReadOnlyJsProperty() {
return 'js read only';
}
-
+
public function getObject() {
if(!$this->_object) {
$this->_object=new NewComponent;
@@ -38,19 +38,19 @@ class NewComponent extends TComponent {
}
return $this->_object;
}
-
+
public function onMyEvent($param) {
$this->raiseEvent('OnMyEvent',$this,$param);
}
-
+
public function myEventHandler($sender,$param) {
$this->_eventHandled=true;
}
-
+
public function eventReturnValue($sender,$param) {
return $param->Return;
}
-
+
public function isEventHandled() {
return $this->_eventHandled;
}
@@ -82,14 +82,14 @@ class NewComponentNoListen extends NewComponent {
class DynamicCatchingComponent extends NewComponentNoListen implements IDynamicMethods {
public function __dycall($method, $args) {
-
+
}
}
class GlobalRaiseComponent extends NewComponent implements IDynamicMethods {
private $_callorder = array();
-
+
public function getCallOrders()
{
return $this->_callorder;
@@ -128,7 +128,7 @@ class FooClassBehavior extends TClassBehavior {
class FooFooClassBehavior extends FooClassBehavior {
public function faafaaEverMore($object, $laa, $sol) {
-
+
}
}
@@ -146,7 +146,7 @@ class FooBehavior extends TBehavior {
}
}
class FooFooBehavior extends FooBehavior {
-
+
public function faafaaEverMore($laa, $sol) {
return sqrt($laa * $laa + $sol * $sol);
}
@@ -162,11 +162,11 @@ class PreBarBehavior extends TBehavior {
class BarBehavior extends PreBarBehavior implements IInstanceCheck {
private $_instanceReturn = null;
-
+
public function moreFunction($laa, $sol) {
return pow($laa+$sol+1, 2);
}
-
+
public function isinstanceof($class, $instance=null) {
return $this->_instanceReturn;
}
@@ -200,7 +200,7 @@ class BehaviorTestBehavior extends TBehavior {
public function getReadOnly() {
return true;
}
-
+
public function onBehaviorEvent($sender, $param,$responsetype=null,$postfunction=null) {
return $this->getOwner()->raiseEvent('onBehaviorEvent',$sender,$param,$responsetype,$postfunction);
}
@@ -264,40 +264,40 @@ class dy3ClassTextReplace extends dy1ClassTextReplace {
class IntraObjectExtenderBehavior extends TBehavior {
-
+
private $lastCall = null;
private $arglist = null;
-
+
public function getLastCall() {
$v = $this->lastCall;
$this->lastCall = null;
return $v;
}
-
+
public function getLastArgumentList() {
$v = $this->arglist;
$this->arglist = null;
return $v;
}
-
-
-
+
+
+
public function dyListen($fx, $chain) {
$this->lastCall = 1;
$this->arglist = func_get_args();
-
+
return $chain->dyListen($fx); // Calls the next event, within a chain
}
public function dyUnlisten($fx, $chain) {
$this->lastCall = 2;
$this->arglist = func_get_args();
-
+
return $chain->dyUnlisten($fx);
}
public function dyPreRaiseEvent($name,$sender,$param,$responsetype,$postfunction, $chain) {
$this->lastCall = 3;
$this->arglist = func_get_args();
-
+
return $chain->dyPreRaiseEvent($name);// Calls the next event, within a chain, if parameters are left off, they are filled in with
// the original parameters passed to the dynamic event. Parameters can be passed if they are changed.
}
@@ -409,7 +409,7 @@ class TDynamicClassBehavior extends TClassBehavior implements IDynamicMethods {
* @package System
*/
class TComponentTest extends PHPUnit_Framework_TestCase {
-
+
protected $component;
public function setUp() {
@@ -424,21 +424,21 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->component->unlisten();
$this->component = null;
}
-
-
+
+
public function testGetListeningToGlobalEvents() {
$this->assertEquals(true, $this->component->getListeningToGlobalEvents());
$this->component->unlisten();
$this->assertEquals(false, $this->component->getListeningToGlobalEvents());
}
-
-
+
+
public function testConstructorAutoListen() {
// the default object auto installs class behavior hooks
$this->assertEquals(1, $this->component->getEventHandlers('fxAttachClassBehavior')->getCount());
$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
$this->assertTrue($this->component->getListeningToGlobalEvents());
-
+
// this object does not auto install class behavior hooks, thus not changing the global event structure.
// Creating a new instance should _not_ influence the fxAttachClassBehavior and fxDetachClassBehavior
// count.
@@ -447,655 +447,655 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
$this->assertEquals(1, $component_nolisten->getEventHandlers('fxAttachClassBehavior')->getCount());
$this->assertEquals(1, $component_nolisten->getEventHandlers('fxDetachClassBehavior')->getCount());
-
- // tests order of class behaviors when a parent and class have class behavior.
+
+ // tests order of class behaviors when a parent and class have class behavior.
// The child should override the parent object-oriented programming style
$this->component->attachClassBehavior('Bar', 'BarBehavior', 'NewComponentNoListen');
$this->component->attachClassBehavior('FooBar', 'FooBarBehavior', 'NewComponent');
-
+
//create new object with new class behaviors built in, defined in the two lines above
$component = new NewComponentNoListen;
-
+
$this->assertEquals(25, $component->moreFunction(2, 2));
-
+
$this->assertEquals(25, $component->Bar->moreFunction(2, 2));
$this->assertEquals(8, $component->FooBar->moreFunction(2, 2));
-
+
$component->unlisten();// unwind object and class behaviors
$this->component->detachClassBehavior('FooBar', 'NewComponent');
$this->component->detachClassBehavior('Bar', 'NewComponentNoListen');
-
+
}
-
-
+
+
public function testListenAndUnlisten() {
-
+
$component = new NewComponentNoListen();
-
+
$this->assertEquals(false, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(1, $component->getEventHandlers('fxAttachClassBehavior')->getCount());
-
+
$this->assertEquals(2, $component->listen());
-
+
$this->assertEquals(true, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(2, $component->getEventHandlers('fxAttachClassBehavior')->getCount());
-
+
$this->assertEquals(2, $component->unlisten());
-
+
$this->assertEquals(false, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(1, $component->getEventHandlers('fxAttachClassBehavior')->getCount());
}
-
-
+
+
public function testListenAndUnlistenWithDynamicEventCatching() {
-
+
$component = new DynamicCatchingComponent();
-
+
$this->assertEquals(false, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(0, $component->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER)->getCount());
-
+
// this adds the fxAttachClassBehavior, fxDetachClassBehavior, and __dycall of the component
$this->assertEquals(3, $component->listen());
-
+
$this->assertEquals(true, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(1, $component->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER)->getCount());
-
+
$this->assertEquals(3, $component->unlisten());
-
+
$this->assertEquals(false, $component->getListeningToGlobalEvents());
-
+
//This is from $this->component being instanced and listening. $component is accessing the global event structure
$this->assertEquals(0, $component->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER)->getCount());
}
-
-
-
+
+
+
//Test Class behaviors
public function testAttachClassBehavior() {
-
+
// ensure that the class is listening
$this->assertEquals(1, $this->component->getEventHandlers('fxAttachClassBehavior')->getCount());
-
+
//Test that the component is not a FooClassBehavior
$this->assertNull($this->component->asa('FooClassBehavior'), "Component is already a FooClassBehavior and should not have this behavior");
-
+
//Add the FooClassBehavior
$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
-
+
//Test that the existing listening component can be a FooClassBehavior
$this->assertNotNull($this->component->asa('FooClassBehavior'), "Component is does not have the FooClassBehavior and should have this behavior");
-
+
// test if the function modifies new instances of the object
$anothercomponent = new NewComponent();
-
+
//The new component should be a FooClassBehavior
$this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "anothercomponent does not have the FooClassBehavior");
-
+
// test when overwriting an existing class behavior, it should throw an TInvalidOperationException
try {
$this->component->attachClassBehavior('FooClassBehavior', new BarClassBehavior);
$this->fail('TInvalidOperationException not raised when overwriting an existing behavior');
} catch(TInvalidOperationException $e) {
}
-
-
+
+
// test when overwriting an existing class behavior, it should throw an TInvalidOperationException
try {
$this->component->attachClassBehavior('FooBarBehavior', 'FooBarBehavior', 'TComponent');
$this->fail('TInvalidOperationException not raised when trying to place a behavior on the root object TComponent');
} catch(TInvalidOperationException $e) {
}
-
-
+
+
// test if the function does not modify any existing objects that are not listening
// The FooClassBehavior is already a part of the class behaviors thus the new instance gets the behavior.
$nolistencomponent = new NewComponentNoListen();
-
+
// test if the function modifies all existing objects that are listening
// Adding a behavior to the first object, the second instance should automatically get the class behavior.
// This is because the second object is listening to the global events of class behaviors
$this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
$this->assertNotNull($anothercomponent->asa('BarClassBehavior'), "anothercomponent is does not have the BarClassBehavior");
-
+
// The no listen object should not have the BarClassBehavior because it was added as a class behavior after the object was instanced
$this->assertNull($nolistencomponent->asa('BarClassBehavior'), "nolistencomponent has the BarClassBehavior and should not");
-
+
// But the no listen object should have the FooClassBehavior because the class behavior was installed before the object was instanced
$this->assertNotNull($nolistencomponent->asa('FooClassBehavior'), "nolistencomponent is does not have the FooClassBehavior");
-
+
//Clear out what was done during this test
$anothercomponent->unlisten();
$this->component->detachClassBehavior('FooClassBehavior');
$this->component->detachClassBehavior('BarClassBehavior');
-
+
// Test attaching of single object behaviors as class-wide behaviors
$this->component->attachClassBehavior('BarBehaviorObject', 'BarBehavior');
$this->assertTrue($this->component->asa('BarBehaviorObject') instanceof BarBehavior);
$this->assertEquals($this->component->BarBehaviorObject->Owner, $this->component);
$this->component->detachClassBehavior('BarBehaviorObject');
}
-
-
-
-
-
+
+
+
+
+
public function testDetachClassBehavior() {
// ensure that the component is listening
$this->assertEquals(1, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
-
+
$prenolistencomponent = new NewComponentNoListen();
-
+
//Attach a class behavior
$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
-
+
//Create new components that listen and don't listen to global events
$anothercomponent = new NewComponent();
$postnolistencomponent = new NewComponentNoListen();
-
+
//ensures that all the Components are properly initialized
$this->assertEquals(2, $this->component->getEventHandlers('fxDetachClassBehavior')->getCount());
$this->assertNotNull($this->component->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
$this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
$this->assertNotNull($anothercomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
$this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
-
-
+
+
$this->component->detachClassBehavior('FooClassBehavior');
-
+
$this->assertNull($this->component->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
$this->assertNull($prenolistencomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
$this->assertNull($anothercomponent->asa('FooClassBehavior'), "Component has the FooClassBehavior and should _not_ have this behavior");
$this->assertNotNull($postnolistencomponent->asa('FooClassBehavior'), "Component does not have the FooClassBehavior and should have this behavior");
-
-
+
+
//tear down function variables
$anothercomponent->unlisten();
}
-
+
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));
}
-
-
+
+
public function testAsA() {
$anothercomponent = new NewComponent();
-
+
// ensure the component does not have the FooClassBehavior
$this->assertNull($this->component->asa('FooClassBehavior'));
$this->assertNull($this->component->asa('FooFooClassBehavior'));
$this->assertNull($this->component->asa('BarClassBehavior'));
$this->assertNull($this->component->asa('NonExistantClassBehavior'));
-
+
$this->assertNull($anothercomponent->asa('FooClassBehavior'));
$this->assertNull($anothercomponent->asa('FooFooClassBehavior'));
$this->assertNull($anothercomponent->asa('BarClassBehavior'));
$this->assertNull($anothercomponent->asa('NonExistantClassBehavior'));
-
+
// add the class behavior
$this->component->attachClassBehavior('FooClassBehavior', new FooClassBehavior);
-
+
//Check that the component has only the class behavior assigned
$this->assertNotNull($this->component->asa('FooClassBehavior'));
$this->assertNull($this->component->asa('FooFooClassBehavior'));
$this->assertNull($this->component->asa('BarClassBehavior'));
$this->assertNull($this->component->asa('NonExistantClassBehavior'));
-
+
//Check that the component has only the class behavior assigned
$this->assertNotNull($anothercomponent->asa('FooClassBehavior'));
$this->assertNull($anothercomponent->asa('FooFooClassBehavior'));
$this->assertNull($anothercomponent->asa('BarClassBehavior'));
$this->assertNull($anothercomponent->asa('NonExistantClassBehavior'));
-
+
// remove the class behavior
$this->component->detachClassBehavior('FooClassBehavior');
-
+
// Check the function doesn't have the behavior any more
$this->assertNull($this->component->asa('FooClassBehavior'));
$this->assertNull($this->component->asa('FooFooClassBehavior'));
$this->assertNull($this->component->asa('BarClassBehavior'));
$this->assertNull($this->component->asa('NonExistantClassBehavior'));
-
+
$this->assertNull($anothercomponent->asa('FooClassBehavior'));
$this->assertNull($anothercomponent->asa('FooFooClassBehavior'));
$this->assertNull($anothercomponent->asa('BarClassBehavior'));
$this->assertNull($anothercomponent->asa('NonExistantClassBehavior'));
-
-
-
-
+
+
+
+
$this->component->attachBehavior('BarBehavior', new BarBehavior);
-
+
//Check that the component has only the object behavior assigned
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('FooFooBehavior'));
$this->assertNotNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('NonExistantBehavior'));
-
+
//Check that the component has the behavior assigned
$this->assertNull($anothercomponent->asa('FooBehavior'));
$this->assertNull($anothercomponent->asa('FooFooBehavior'));
$this->assertNull($anothercomponent->asa('BarBehavior'));
$this->assertNull($anothercomponent->asa('NonExistantBehavior'));
-
+
$this->component->detachBehavior('BarBehavior');
-
+
//Check that the component has no object behaviors assigned
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('FooFooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('NonExistantBehavior'));
-
+
//Check that the component has no behavior assigned
$this->assertNull($anothercomponent->asa('FooBehavior'));
$this->assertNull($anothercomponent->asa('FooFooBehavior'));
$this->assertNull($anothercomponent->asa('BarBehavior'));
$this->assertNull($anothercomponent->asa('NonExistantBehavior'));
-
+
$anothercomponent->unlisten();
}
-
+
public function testIsA() {
//This doesn't check the IInstanceCheck functionality, separate function
-
+
$this->assertTrue($this->component->isa('TComponent'));
$this->assertTrue($this->component->isa('NewComponent'));
$this->assertFalse($this->component->isa(new FooBehavior));
$this->assertFalse($this->component->isa('FooBehavior'));
-
+
//Ensure there is no BarBehavior
$this->assertNull($this->component->asa('FooFooBehavior'));
-
+
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('FooFooBehavior'));
-
+
$this->component->attachBehavior('FooFooBehavior', new FooFooBehavior);
-
+
$this->assertNotNull($this->component->asa('FooFooBehavior'));
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertTrue($this->component->isa('FooFooBehavior'));
-
+
$this->component->disableBehaviors();
// It still has the behavior
$this->assertNotNull($this->component->asa('FooFooBehavior'));
-
+
// But it is not expressed
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('FooFooBehavior'));
-
+
$this->component->enableBehaviors();
$this->assertNotNull($this->component->asa('FooFooBehavior'));
-
+
$this->assertTrue($this->component->isa('FooFooBehavior'));
-
-
-
+
+
+
$this->component->attachBehavior('FooBarBehavior', new FooBarBehavior);
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertTrue($this->component->isa('FooBarBehavior'));
-
+
$this->component->disableBehavior('FooBarBehavior');
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('FooBarBehavior'));
-
+
$this->component->enableBehavior('FooBarBehavior');
$this->component->disableBehavior('FooFooBehavior');
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('FooFooBehavior'));
$this->assertTrue($this->component->isa('FooBarBehavior'));
-
+
$this->component->disableBehavior('FooBarBehavior');
$this->component->disableBehavior('FooFooBehavior');
-
+
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('FooFooBehavior'));
$this->assertFalse($this->component->isa('FooBarBehavior'));
-
+
$this->component->enableBehavior('FooBarBehavior');
$this->component->enableBehavior('FooFooBehavior');
-
+
$this->assertTrue($this->component->isa('FooFooBehavior'));
$this->assertTrue($this->component->isa('FooBarBehavior'));
-
-
+
+
$this->component->detachBehavior('FooFooBehavior');
$this->component->detachBehavior('FooBarBehavior');
-
+
$this->assertFalse($this->component->isa(new FooBehavior));
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa(new FooFooBehavior));
$this->assertFalse($this->component->isa('FooFooBehavior'));
$this->assertFalse($this->component->isa(new FooBarBehavior));
$this->assertFalse($this->component->isa('FooBarBehavior'));
-
+
}
-
+
public function testIsA_with_IInstanceCheck() {
-
+
$this->assertTrue($this->component->isa('NewComponent'));
$this->assertFalse($this->component->isa('PreBarBehavior'));
-
+
$this->component->attachBehavior('BarBehavior', $behavior = new BarBehavior);
-
+
$behavior->setInstanceReturn(null);
-
+
$this->assertTrue($this->component->isa('NewComponent'));
$this->assertTrue($this->component->isa('PreBarBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
-
+
// This forces the iso on the BarBehavior to respond to any class with false
$behavior->setInstanceReturn(false);
$this->assertFalse($this->component->isa('PreBarBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
-
+
//This forces the isa on the BarBehavior to respond to any class with true
$behavior->setInstanceReturn(true);
$this->assertTrue($this->component->isa('FooBehavior'));
-
-
+
+
}
-
+
public function testAttachDetachBehavior() {
-
+
try {
$this->component->faaEverMore(true, true);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertFalse($this->component->isa('BarBehavior'));
-
+
try {
$this->component->attachBehavior('FooBehavior', new TComponent);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TInvalidDataTypeException $e) {}
-
+
$this->component->attachBehavior('FooBehavior', new FooBehavior);
-
+
$this->assertNotNull($this->component->asa('FooBehavior'));
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertFalse($this->component->isa('BarBehavior'));
-
+
try {
$this->assertTrue($this->component->faaEverMore(true, true));
} catch(TApplicationException $e) {
$this->fail('TApplicationException raised while trying to execute a behavior class method');
}
-
+
try {
$this->component->noMethodHere(true);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->assertTrue($this->component->disableBehavior('FooBehavior'));
-
+
//BarBehavior is not a behavior at this time
$this->assertNull($this->component->disableBehavior('BarBehavior'));
-
+
try {
$this->component->faaEverMore(true, true);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->assertTrue($this->component->enableBehavior('FooBehavior'));
-
+
//BarBehavior is not a behavior at this time
$this->assertNull($this->component->enableBehavior('BarBehavior'));
-
+
try {
$this->assertTrue($this->component->faaEverMore(true, true));
} catch(TApplicationException $e) {
$this->fail('TApplicationException raised while trying to execute a behavior class method');
}
-
+
$this->component->detachBehavior('FooBehavior');
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertFalse($this->component->isa('BarBehavior'));
-
+
}
-
+
public function testAttachDetachBehaviors() {
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNull($this->component->asa('PreBarBehavior'));
-
+
$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNotNull($this->component->asa('FooFooBehavior'));
$this->assertNotNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNotNull($this->component->asa('PreBarBehavior'));
-
+
$this->assertTrue($this->component->isa('FooFooBehavior'));
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertTrue($this->component->isa('BarBehavior'));
$this->assertTrue($this->component->isa('PreBarBehavior'));
$this->assertFalse($this->component->isa('FooBarBehavior'));
-
+
$this->component->detachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('FooFooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNotNull($this->component->asa('PreBarBehavior'));
-
+
$this->assertFalse($this->component->isa('FooFooBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('BarBehavior'));
$this->assertFalse($this->component->isa('FooBarBehavior'));
$this->assertTrue($this->component->isa('PreBarBehavior'));
-
-
-
+
+
+
// testing if we can detachBehaviors just by the name of the behavior instead of an array of the behavior
$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior));
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
$this->assertTrue($this->component->isa('BarBehavior'));
-
+
$this->component->detachBehaviors(array('FooFooBehavior', 'BarBehavior'));
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('FooFooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
-
+
$this->assertFalse($this->component->isa('FooFooBehavior'));
$this->assertFalse($this->component->isa('FooBehavior'));
$this->assertFalse($this->component->isa('BarBehavior'));
$this->assertFalse($this->component->isa('FooBarBehavior'));
}
-
-
+
+
public function testClearBehaviors() {
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNull($this->component->asa('PreBarBehavior'));
-
+
$this->component->attachBehaviors(array('FooFooBehavior' => new FooFooBehavior, 'BarBehavior' => new BarBehavior, 'PreBarBehavior' => new PreBarBehavior));
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNotNull($this->component->asa('FooFooBehavior'));
$this->assertNotNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNotNull($this->component->asa('PreBarBehavior'));
-
+
$this->component->clearBehaviors();
-
+
$this->assertNull($this->component->asa('FooBehavior'));
$this->assertNull($this->component->asa('BarBehavior'));
$this->assertNull($this->component->asa('FooBarBehavior'));
$this->assertNull($this->component->asa('PreBarBehavior'));
}
-
+
public function testEnableDisableBehavior() {
-
+
$this->assertNull($this->component->enableBehavior('FooBehavior'));
$this->assertNull($this->component->disableBehavior('FooBehavior'));
-
+
try {
$this->component->faaEverMore(true, true);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->component->attachBehavior('FooBehavior', new FooBehavior);
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
try {
$this->assertTrue($this->component->faaEverMore(true, true));
} catch(TApplicationException $e) {
$this->fail('TApplicationException raised while trying to execute a behavior class method');
}
-
+
$this->assertTrue($this->component->disableBehavior('FooBehavior'));
-
+
$this->assertFalse($this->component->isa('FooBehavior'));
-
+
try {
$this->component->faaEverMore(true, true);
$this->fail('TApplicationException not raised trying to execute a undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->assertTrue($this->component->enableBehavior('FooBehavior'));
-
+
$this->assertTrue($this->component->isa('FooBehavior'));
try {
$this->assertTrue($this->component->faaEverMore(true, true));
} catch(TApplicationException $e) {
$this->fail('TApplicationException raised while trying to execute a behavior class method');
}
-
-
-
+
+
+
$this->assertNull($this->component->enableBehavior('BarClassBehavior'));
$this->assertNull($this->component->disableBehavior('BarClassBehavior'));
-
+
try {
$this->component->moreFunction(true, true);
$this->fail('TApplicationException not raised trying to execute an undefined class method');
} catch(TApplicationException $e) {}
-
+
$this->component->attachClassBehavior('BarClassBehavior', new BarClassBehavior);
-
+
$this->assertFalse($this->component->enableBehavior('BarClassBehavior'));
$this->assertFalse($this->component->disableBehavior('BarClassBehavior'));
-
+
try {
$this->assertTrue($this->component->moreFunction(true, true));
} catch(TApplicationException $e) {
$this->fail('TApplicationException raised while trying to execute a behavior class method');
}
-
+
$this->component->detachClassBehavior('BarClassBehavior');
}
-
-
+
+
public function testBehaviorFunctionCalls() {
-
+
$this->component->attachBehavior('FooBarBehavior', $behavior = new FooBarBehavior);
$this->component->attachClassBehavior('FooClassBehavior', $classbehavior = new FooClassBehavior);
-
+
// Test the Class Methods
$this->assertEquals(12, $this->component->faaEverMore(3, 4));
-
+
// Check that the called object is shifted in front of the array of a class behavior call
$this->assertEquals($this->component, $this->component->getLastClassObject());
-
-
+
+
//Test the FooBarBehavior
$this->assertEquals(27, $this->component->moreFunction(3, 3));
-
+
$this->assertTrue($this->component->disableBehavior('FooBarBehavior'));
try {
$this->assertNull($this->component->moreFunction(3, 4));
$this->fail('TApplicationException not raised trying to execute a disabled behavior');
} catch(TApplicationException $e) {}
$this->assertTrue($this->component->enableBehavior('FooBarBehavior'));
-
+
// Test the global event space, this should work and return false because no function implements these methods
$this->assertNull($this->component->fxSomeUndefinedGlobalEvent());
$this->assertNull($this->component->dySomeUndefinedIntraObjectEvent());
-
+
$this->component->detachClassBehavior('FooClassBehavior');
-
-
-
+
+
+
// test object instance behaviors implemented through class-wide behaviors
$this->component->attachClassBehavior('FooFooBehaviorAsClass', 'FooFooBehavior');
-
+
$component = new NewComponent;
-
+
$this->assertEquals(5, $this->component->faafaaEverMore(3, 4));
$this->assertEquals(10, $component->faafaaEverMore(6, 8));
-
+
$this->component->detachClassBehavior('FooFooBehaviorAsClass');
$component->unlisten();
$component = null;
-
+
try {
$this->component->faafaaEverMore(3, 4);
$this->fail('TApplicationException not raised trying to execute a disabled behavior');
} catch(TApplicationException $e) {}
-
-
-
+
+
+
// make a call to an unpatched fx and dy call so that it's passed through to the __dycall function
$dynamicComponent = new DynamicCallComponent;
-
+
$this->assertNull($dynamicComponent->fxUndefinedEvent());
$this->assertNull($dynamicComponent->dyUndefinedEvent());
-
+
//This tests the dynamic __dycall function
$this->assertEquals(1024, $dynamicComponent->dyPowerFunction(2, 10));
$this->assertEquals(5, $dynamicComponent->dyDivisionFunction(10, 2));
-
+
$this->assertEquals(2048, $dynamicComponent->fxPowerFunction(2, 10));
$this->assertEquals(10, $dynamicComponent->fxDivisionFunction(10, 2));
-
+
$dynamicComponent->unlisten();
-
+
}
-
+
public function testHasProperty() {
$this->assertTrue($this->component->hasProperty('Text'), "Component hasn't property Text");
$this->assertTrue($this->component->hasProperty('text'), "Component hasn't property text");
$this->assertFalse($this->component->hasProperty('Caption'), "Component has property Caption");
-
+
$this->assertTrue($this->component->hasProperty('ColorAttribute'), "Component hasn't property JsColorAttribute");
$this->assertTrue($this->component->hasProperty('colorattribute'), "Component hasn't property JsColorAttribute");
$this->assertFalse($this->component->canGetProperty('PastelAttribute'), "Component has property JsPastelAttribute");
-
+
$this->assertTrue($this->component->hasProperty('JSColorAttribute'), "Component hasn't property JsColorAttribute");
$this->assertTrue($this->component->hasProperty('jscolorattribute'), "Component hasn't property JsColorAttribute");
$this->assertFalse($this->component->hasProperty('jsPastelAttribute'), "Component has property JsPastelAttribute");
-
+
$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
$this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
@@ -1107,27 +1107,27 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
$this->component->enableBehavior('ExcitementPropBehavior');
$this->assertTrue($this->component->hasProperty('Excitement'), "Component hasn't property Excitement");
-
+
$this->component->detachBehavior('ExcitementPropBehavior');
-
+
$this->assertFalse($this->component->hasProperty('Excitement'), "Component has property Excitement");
-
+
}
public function testCanGetProperty() {
$this->assertTrue($this->component->canGetProperty('Text'));
$this->assertTrue($this->component->canGetProperty('text'));
$this->assertFalse($this->component->canGetProperty('Caption'));
-
+
$this->assertTrue($this->component->canGetProperty('ColorAttribute'));
$this->assertTrue($this->component->canGetProperty('colorattribute'));
$this->assertFalse($this->component->canGetProperty('PastelAttribute'));
-
+
$this->assertTrue($this->component->canGetProperty('JSColorAttribute'));
$this->assertTrue($this->component->canGetProperty('jscolorattribute'));
$this->assertFalse($this->component->canGetProperty('jsPastelAttribute'));
-
-
+
+
$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
$this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
@@ -1139,9 +1139,9 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
$this->component->enableBehavior('ExcitementPropBehavior');
$this->assertTrue($this->component->canGetProperty('Excitement'), "Component hasn't property Excitement");
-
+
$this->component->detachBehavior('ExcitementPropBehavior');
-
+
$this->assertFalse($this->component->canGetProperty('Excitement'), "Component has property Excitement");
}
@@ -1149,15 +1149,15 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertTrue($this->component->canSetProperty('Text'));
$this->assertTrue($this->component->canSetProperty('text'));
$this->assertFalse($this->component->canSetProperty('Caption'));
-
+
$this->assertTrue($this->component->canSetProperty('ColorAttribute'));
$this->assertTrue($this->component->canSetProperty('colorattribute'));
$this->assertFalse($this->component->canSetProperty('PastelAttribute'));
-
+
$this->assertTrue($this->component->canSetProperty('JSColorAttribute'));
$this->assertTrue($this->component->canSetProperty('jscolorattribute'));
$this->assertFalse($this->component->canSetProperty('jsPastelAttribute'));
-
+
$this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
$this->component->attachBehavior('ExcitementPropBehavior', new BehaviorTestBehavior);
$this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
@@ -1169,7 +1169,7 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->canSetProperty('Excitement'), "Component has property Excitement");
$this->component->enableBehavior('ExcitementPropBehavior');
$this->assertTrue($this->component->canSetProperty('Excitement'), "Component hasn't property Excitement");
-
+
$this->component->detachBehavior('ExcitementPropBehavior');
}
@@ -1180,55 +1180,55 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
$this->assertTrue($this->component->OnMyEvent instanceof TPriorityList);
try {
$value2=$this->component->onUndefinedEvent;
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
- //Without the function parenthesis, the function is _not_ called but the __get
+
+ //Without the function parenthesis, the function is _not_ called but the __get
// method is called and the global events (list) are accessed
$this->assertTrue($this->component->fxAttachClassBehavior instanceof TPriorityList);
$this->assertTrue($this->component->fxDetachClassBehavior instanceof TPriorityList);
-
+
// even undefined global events have a list as every object is able to access every event
$this->assertTrue($this->component->fxUndefinedEvent instanceof TPriorityList);
-
-
+
+
// Test the behaviors within the __get function
$this->component->enableBehaviors();
-
+
try {
$value2=$this->component->Excitement;
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
$this->component->attachBehavior('BehaviorTestBehavior', $behavior = new BehaviorTestBehavior);
$this->assertEquals('faa', $this->component->Excitement);
-
+
$this->component->disableBehaviors();
-
+
try {
$this->assertEquals('faa', $this->component->Excitement);
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
$this->component->enableBehaviors();
$this->assertEquals('faa', $this->component->getExcitement());
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
-
+
$this->assertEquals($behavior, $this->component->BehaviorTestBehavior);
try {
$behavior = $this->component->BehaviorTestBehavior2;
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
try {
$this->assertEquals('faa', $this->component->Excitement);
$this->fail('exception not raised when getting undefined property');
@@ -1236,13 +1236,13 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
}
$this->component->enableBehavior('BehaviorTestBehavior');
$this->assertEquals('faa', $this->component->getExcitement());
-
-
+
+
// behaviors allow on and fx events to be passed through.
$this->assertTrue($this->component->onBehaviorEvent instanceof TPriorityList);
-
+
}
-
+
public function testSetProperty() {
$value='new value';
$this->component->Text=$value;
@@ -1253,64 +1253,64 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->fail('exception not raised when setting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
// Test get only properties is a set function
try {
$this->component->ReadOnlyProperty = 'setting read only';
$this->fail('a property without a set function was set to a new value without error');
} catch(TInvalidOperationException $e) {
}
-
+
try {
$this->component->ReadOnlyJsProperty = 'jssetting read only';
$this->fail('a js property without a set function was set to a new value without error');
} catch(TInvalidOperationException $e) {
}
-
+
try {
$this->component->JsReadOnlyJsProperty = 'jssetting read only';
$this->fail('a js property without a set function was set to a new value without error');
} catch(TInvalidOperationException $e) {
}
-
+
$this->assertEquals(0, $this->component->getEventHandlers('onMyEvent')->getCount());
$this->component->onMyEvent = array($this->component,'myEventHandler');
$this->assertEquals(1, $this->component->getEventHandlers('onMyEvent')->getCount());
$this->component->onMyEvent[] = array($this->component,'Object.myEventHandler');
$this->assertEquals(2, $this->component->getEventHandlers('onMyEvent')->getCount());
-
+
$this->component->getEventHandlers('onMyEvent')->clear();
-
+
// Test the behaviors within the __get function
$this->component->enableBehaviors();
-
+
try {
$this->component->Excitement = 'laa';
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
$this->component->attachBehavior('BehaviorTestBehavior', $behavior1 = new BehaviorTestBehavior);
$this->component->Excitement = 'laa';
$this->assertEquals('laa', $this->component->Excitement);
$this->assertEquals('sol', $this->component->Excitement = 'sol');
-
-
+
+
$this->component->disableBehaviors();
-
+
try {
$this->component->Excitement = false;
$this->assertEquals(false, $this->component->Excitement);
$this->fail('exception not raised when getting undefined property');
} catch(TInvalidOperationException $e) {
}
-
+
$this->component->enableBehaviors();
$this->component->Excitement = 'faa';
$this->assertEquals('faa', $this->component->getExcitement());
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
-
+
try {
$this->component->Excitement = false;
$this->assertEquals(false, $this->component->Excitement);
@@ -1320,82 +1320,82 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->component->enableBehavior('BehaviorTestBehavior');
$this->component->Excitement = 'sol';
$this->assertEquals('sol', $this->component->Excitement);
-
-
+
+
$this->component->attachBehavior('BehaviorTestBehavior2', $behavior2 = new BehaviorTestBehavior);
-
+
$this->assertEquals('sol', $this->component->Excitement);
$this->assertEquals('faa', $behavior2->Excitement);
-
+
// this sets Excitement for both because they are not uniquely named
$this->component->Excitement = 'befaad';
-
+
$this->assertEquals('befaad', $this->component->Excitement);
$this->assertEquals('befaad', $behavior1->Excitement);
$this->assertEquals('befaad', $behavior2->Excitement);
-
-
+
+
$this->component->detachBehavior('BehaviorTestBehavior2');
-
+
// behaviors allow on and fx events to be passed through.
$this->assertTrue($this->component->BehaviorTestBehavior->onBehaviorEvent instanceof TPriorityList);
-
+
$this->assertEquals(0, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
$this->component->onBehaviorEvent = array($this->component,'myEventHandler');
$this->assertEquals(1, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
$this->component->onBehaviorEvent[] = array($this->component,'Object.myEventHandler');
$this->assertEquals(2, $this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->getCount());
-
+
$this->component->BehaviorTestBehavior->getEventHandlers('onBehaviorEvent')->clear();
}
-
-
+
+
public function testIsSetFunction() {
$this->assertTrue(isset($this->component->fxAttachClassBehavior));
$this->component->unlisten();
-
+
$this->assertFalse(isset($this->component->onMyEvent));
$this->assertFalse(isset($this->component->undefinedEvent));
$this->assertFalse(isset($this->component->fxAttachClassBehavior));
-
+
$this->assertFalse(isset($this->component->BehaviorTestBehavior));
$this->assertFalse(isset($this->component->onBehaviorEvent));
-
+
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
-
+
$this->assertTrue(isset($this->component->BehaviorTestBehavior));
$this->assertFalse(isset($this->component->onBehaviorEvent));
-
+
$this->component->attachEventHandler('onBehaviorEvent','foo');
$this->assertTrue(isset($this->component->onBehaviorEvent));
-
+
$this->component->attachEventHandler('onMyEvent','foo');
$this->assertTrue(isset($this->component->onMyEvent));
-
+
$this->assertTrue(isset($this->component->Excitement));
$this->component->Excitement = null;
$this->assertFalse(isset($this->component->Excitement));
$this->assertFalse(isset($this->component->UndefinedBehaviorProperty));
-
-
+
+
}
-
-
+
+
public function testUnsetFunction() {
-
+
$this->assertEquals('default', $this->component->getText());
unset($this->component->Text);
$this->assertNull($this->component->getText());
-
+
unset($this->component->UndefinedProperty);
-
+
// object events
$this->assertEquals(0, $this->component->onMyEvent->Count);
$this->component->attachEventHandler('onMyEvent','foo');
$this->assertEquals(1, $this->component->onMyEvent->Count);
unset($this->component->onMyEvent);
$this->assertEquals(0, $this->component->onMyEvent->Count);
-
+
//global events
$this->assertEquals(1, $this->component->fxAttachClassBehavior->Count);
$component = new NewComponent();
@@ -1404,22 +1404,22 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
// retain the other object event
$this->assertEquals(1, $this->component->fxAttachClassBehavior->Count);
$component->unlisten();
-
+
try {
unset($this->component->Object);
$this->fail('TInvalidOperationException not raised when unsetting get only property');
} catch(TInvalidOperationException $e) {}
-
+
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
$this->assertTrue($this->component->asa('BehaviorTestBehavior') instanceof BehaviorTestBehavior);
$this->assertFalse($this->component->asa('BehaviorTestBehavior2') instanceof BehaviorTestBehavior);
-
+
$this->assertEquals('faa', $this->component->Excitement);
unset($this->component->Excitement);
$this->assertNull($this->component->Excitement);
$this->component->Excitement = 'sol';
$this->assertEquals('sol', $this->component->Excitement);
-
+
// Test the disabling of unset within behaviors
$this->component->disableBehaviors();
unset($this->component->Excitement);
@@ -1430,60 +1430,60 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
unset($this->component->Excitement);
$this->component->enableBehavior('BehaviorTestBehavior');
$this->assertEquals('sol', $this->component->Excitement);
-
+
unset($this->component->Excitement);
$this->assertNull($this->component->Excitement);
-
+
try {
unset($this->component->ReadOnly);
$this->fail('TInvalidOperationException not raised when unsetting get only property');
} catch(TInvalidOperationException $e) {}
-
+
$this->component->onBehaviorEvent = 'foo';
$this->assertEquals(1, count($this->component->onBehaviorEvent));
$this->assertEquals(1, count($this->component->BehaviorTestBehavior->onBehaviorEvent));
unset($this->component->onBehaviorEvent);
$this->assertEquals(0, count($this->component->onBehaviorEvent));
$this->assertEquals(0, count($this->component->BehaviorTestBehavior->onBehaviorEvent));
-
+
// Remove behavior via unset
unset($this->component->BehaviorTestBehavior);
$this->assertFalse($this->component->asa('BehaviorTestBehavior') instanceof BehaviorTestBehavior);
-
+
}
public function testGetSubProperty() {
$this->assertTrue('object text'===$this->component->getSubProperty('Object.Text'));
}
-
+
public function testSetSubProperty() {
$this->component->setSubProperty('Object.Text','new object text');
$this->assertEquals('new object text',$this->component->getSubProperty('Object.Text'));
}
-
+
public function testHasEvent() {
$this->assertTrue($this->component->hasEvent('OnMyEvent'));
$this->assertTrue($this->component->hasEvent('onmyevent'));
$this->assertFalse($this->component->hasEvent('onYourEvent'));
-
+
// fx won't throw an error if any of these fx function are called on an object.
// It is a special prefix event designation that every object responds to all events.
$this->assertTrue($this->component->hasEvent('fxAttachClassBehavior'));
$this->assertTrue($this->component->hasEvent('fxattachclassbehavior'));
-
+
$this->assertTrue($this->component->hasEvent('fxNonExistantGlobalEvent'));
$this->assertTrue($this->component->hasEvent('fxnonexistantglobalevent'));
-
+
$this->assertTrue($this->component->hasEvent('dyNonExistantLocalEvent'));
$this->assertTrue($this->component->hasEvent('fxnonexistantlocalevent'));
-
-
+
+
//Test behavior events
$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
$this->assertTrue($this->component->hasEvent('onBehaviorEvent'));
$this->assertTrue($this->component->BehaviorTestBehavior->hasEvent('onBehaviorEvent'));
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
$this->component->enableBehavior('BehaviorTestBehavior');
@@ -1494,20 +1494,20 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->hasEventHandler('OnMyEvent'));
$this->component->attachEventHandler('OnMyEvent','foo');
$this->assertTrue($this->component->hasEventHandler('OnMyEvent'));
-
+
$this->assertFalse($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
$this->component->attachEventHandler('fxNonExistantGlobalEvent','foo');
$this->assertTrue($this->component->hasEventHandler('fxNonExistantGlobalEvent'));
-
+
//Test behavior events
$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
$this->assertFalse($this->component->BehaviorTestBehavior->hasEventHandler('onBehaviorEvent'));
-
+
$this->component->attachEventHandler('onBehaviorEvent','foo');
$this->assertTrue($this->component->hasEventHandler('onBehaviorEvent'));
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
$this->assertFalse($this->component->hasEvent('onBehaviorEvent'));
$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
@@ -1526,7 +1526,7 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->fail('exception not raised when getting event handlers for undefined event');
} catch(TInvalidOperationException $e) {
}
-
+
$list=$this->component->getEventHandlers('fxRandomEvent');
$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
$this->component->attachEventHandler('fxRandomEvent','foo');
@@ -1536,9 +1536,9 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
$this->fail('exception raised when getting event handlers for universal global event');
}
-
-
-
+
+
+
//Test behavior events
try {
$list=$this->component->getEventHandlers('onBehaviorEvent');
@@ -1546,13 +1546,13 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
$this->assertFalse($this->component->hasEventHandler('onBehaviorEvent'));
-
+
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
$list=$this->component->getEventHandlers('onBehaviorEvent');
$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===0));
$this->component->attachEventHandler('onBehaviorEvent','foo');
$this->assertTrue(($list instanceof TPriorityList) && ($list->getCount()===1));
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
try {
$list=$this->component->getEventHandlers('onBehaviorEvent');
@@ -1561,11 +1561,11 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
}
$this->component->enableBehavior('BehaviorTestBehavior');
$this->assertTrue(($this->component->getEventHandlers('onBehaviorEvent') instanceof TPriorityList) && ($list->getCount()===1));
-
+
}
public function testAttachEventHandler() {
-
+
$this->component->attachEventHandler('OnMyEvent','foo');
$this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
try {
@@ -1573,7 +1573,7 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->fail('exception not raised when attaching event handlers for undefined event');
} catch(TInvalidOperationException $e) {
}
-
+
//Testing the priorities of attaching events
$this->component->attachEventHandler('OnMyEvent','foopre', 5);
$this->component->attachEventHandler('OnMyEvent','foopost', 15);
@@ -1584,8 +1584,8 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('foo', $list[1]);
$this->assertEquals('foobar', $list[2]);
$this->assertEquals('foopost', $list[3]);
-
-
+
+
//Test attaching behavior events
try {
$this->component->attachEventHandler('onBehaviorEvent','foo');
@@ -1593,9 +1593,9 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
-
+
$this->component->attachEventHandler('onBehaviorEvent','foo');
-
+
//Testing the priorities of attaching behavior events
$this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
$this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
@@ -1608,7 +1608,7 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('foobar', $list[2]);
$this->assertEquals('foobarfoobar', $list[3]);
$this->assertEquals('foopost', $list[4]);
-
+
$this->component->disableBehavior('BehaviorTestBehavior');
try {
$this->component->attachEventHandler('onBehaviorEvent','bar');
@@ -1616,37 +1616,37 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
$this->component->enableBehavior('BehaviorTestBehavior');
-
+
}
public function testDetachEventHandler() {
-
+
$this->component->attachEventHandler('OnMyEvent','foo');
$this->assertEquals(1, $this->component->getEventHandlers('OnMyEvent')->getCount());
-
+
$this->component->attachEventHandler('OnMyEvent','foopre', 5);
$this->component->attachEventHandler('OnMyEvent','foopost', 15);
$this->component->attachEventHandler('OnMyEvent','foobar', 10);
$this->component->attachEventHandler('OnMyEvent','foobarfoobar', 10);
-
-
-
+
+
+
$this->component->detachEventHandler('OnMyEvent','foo');
$list = $this->component->getEventHandlers('OnMyEvent');
$this->assertEquals(4, $list->getCount());
-
+
$this->assertEquals('foopre', $list[0]);
$this->assertEquals('foobar', $list[1]);
$this->assertEquals('foobarfoobar', $list[2]);
$this->assertEquals('foopost', $list[3]);
-
+
$this->component->detachEventHandler('OnMyEvent','foopre', null);
$this->assertEquals(4, $list->getCount());
-
+
$this->component->detachEventHandler('OnMyEvent','foopre', 5);
$this->assertEquals(3, $list->getCount());
-
-
+
+
// Now do detaching of behavior on events
try {
$this->component->attachEventHandler('onBehaviorEvent','foo');
@@ -1654,29 +1654,29 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(TInvalidOperationException $e) {
}
$this->component->attachBehavior('BehaviorTestBehavior', new BehaviorTestBehavior);
-
+
$this->component->attachEventHandler('onBehaviorEvent','foo');
$this->assertEquals(1, $this->component->getEventHandlers('onBehaviorEvent')->getCount());
-
+
$this->component->attachEventHandler('onBehaviorEvent','foopre', 5);
$this->component->attachEventHandler('onBehaviorEvent','foopost', 15);
$this->component->attachEventHandler('onBehaviorEvent','foobar', 10);
$this->component->attachEventHandler('onBehaviorEvent','foobarfoobar', 10);
-
-
-
+
+
+
$this->component->detachEventHandler('onBehaviorEvent','foo');
$list = $this->component->getEventHandlers('onBehaviorEvent');
$this->assertEquals(4, $list->getCount());
-
+
$this->assertEquals('foopre', $list[0]);
$this->assertEquals('foobar', $list[1]);
$this->assertEquals('foobarfoobar', $list[2]);
$this->assertEquals('foopost', $list[3]);
-
+
$this->component->detachEventHandler('onBehaviorEvent','foopre', null);
$this->assertEquals(4, $list->getCount());
-
+
$this->component->detachEventHandler('onBehaviorEvent','foopre', 5);
$this->assertEquals(3, $list->getCount());
}
@@ -1693,14 +1693,14 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->Object->isEventHandled());
$this->component->raiseEvent('OnMyEvent',$this,null);
$this->assertTrue($this->component->Object->isEventHandled());
-
+
$this->component->resetEventHandled();
$this->component->Object->resetEventHandled();
-
-
+
+
// Test a behavior on event
$this->component->attachBehavior('test', new BehaviorTestBehavior);
-
+
$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
$this->assertFalse($this->component->isEventHandled());
$this->component->raiseEvent('onBehaviorEvent',$this,null);
@@ -1709,13 +1709,13 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($this->component->Object->isEventHandled());
$this->component->raiseEvent('onBehaviorEvent',$this,null);
$this->assertTrue($this->component->Object->isEventHandled());
-
+
//test behavior enabled/disabled events
$this->component->disableBehavior('test');
-
+
$this->component->resetEventHandled();
$this->component->Object->resetEventHandled();
-
+
try {
$this->component->attachEventHandler('onBehaviorEvent',array($this->component,'myEventHandler'));
$this->fail('exception not raised when getting event handlers for undefined event');
@@ -1726,172 +1726,172 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
$this->fail('exception not raised when getting event handlers for undefined event');
} catch(TInvalidOperationException $e) {}
$this->assertFalse($this->component->isEventHandled());
-
+
$this->component->enableBehavior('test');
-
-
-
+
+
+
//Test the return types of this function
-
+
$this->assertFalse($this->component->isEventHandled());
$this->assertFalse($this->component->Object->isEventHandled());
$this->assertEquals(array(), $this->component->onBehaviorEvent($this,$this->component));
$this->assertTrue($this->component->isEventHandled());
$this->assertTrue($this->component->Object->isEventHandled());
-
+
// This accumulates all the responses from each of the events
$arr=$this->component->onBehaviorEvent($this, $this->component, TEventResults::EVENT_RESULT_ALL);
$this->assertEquals($this, $arr[0]['sender']);
$this->assertEquals($this->component, $arr[0]['param']);
$this->assertTrue(null === $arr[0]['response']);
-
+
$this->assertEquals($this, $arr[1]['sender']);
$this->assertEquals($this->component, $arr[1]['param']);
$this->assertTrue(null === $arr[1]['response']);
-
+
$this->assertEquals(2, count($arr));
-
+
// This tests without the default filtering-out of null
$arr=$this->component->onBehaviorEvent($this, $this->component, false);
$this->assertEquals(array(null, null), $arr);
-
-
+
+
unset($this->component->onBehaviorEvent);
$this->assertEquals(0, $this->component->onBehaviorEvent->Count);
-
+
$this->component->onBehaviorEvent = array($this, 'returnValue4');
$this->component->onBehaviorEvent = array($this, 'returnValue1');
-
+
// Test the per event post processing function
$arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction'));
$this->assertEquals(array(exp(4), exp(1)), $arr);
$arr=$this->component->onBehaviorEvent($this, $this->component, array($this, 'postEventFunction2'));
$this->assertEquals(array(sin(4), sin(1)), $arr);
-
-
+
+
//Testing Feed-forward functionality
unset($this->component->onBehaviorEvent);
-
+
$this->component->onBehaviorEvent = array($this, 'ffValue4');
$this->component->onBehaviorEvent = array($this, 'ffValue2');
$arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
$this->assertEquals(array(20, 40), $arr);
-
-
+
+
unset($this->component->onBehaviorEvent);
-
+
//Order of these events affects the response order in feed forward
$this->component->onBehaviorEvent = array($this, 'ffValue2');
$this->component->onBehaviorEvent = array($this, 'ffValue4');
$arr=$this->component->onBehaviorEvent($this, 5, TEventResults::EVENT_RESULT_FEED_FORWARD);
$this->assertEquals(array(10, 40), $arr);
}
-
+
public function returnValue1(){return 1;}
public function returnValue4(){return 4;}
public function postEventFunction($sender, $param, $caller, $response){return exp($response);}
public function postEventFunction2($sender, $param, $caller, $response){return sin($response);}
public function ffValue2($sender, $param){return $param*2;}
public function ffValue4($sender, $param){return $param*4;}
-
-
+
+
public function testGlobalEventListenerInRaiseEvent() {
//TODO Test the Global Event Listener
}
-
-
+
+
public function testIDynamicMethodsOnBehavior() {
-
+
//Add Behavior with dynamic call
$this->component->attachBehavior('TDynamicBehavior', new TDynamicBehavior);
-
+
//Check that the behavior is working as it should
$this->assertTrue($this->component->isa('TDynamicBehavior'));
$this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
-
+
// call basic behavior implemented method from object (containing behavior)
$this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
-
+
//Test out undefined behavior/host object method
try {
$this->component->objectAndBehaviorUndefinedMethod();
$this->fail('exception not raised when evaluating an undefined method by the object and behavior');
} catch(TApplicationException $e) {
}
-
+
// calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
// this behavior catches undefined dynamic event and divides param1 by param 2
$this->assertEquals(22, $this->component->dyTestDynamicBehaviorMethod(242, 11));
$this->assertEquals('dyTestDynamicBehaviorMethod', $this->component->getLastBehaviorDynamicMethodCalled());
-
+
// calling undefined dynamic method, caught by the __dycall in the behavior and ignored
$this->assertNull($this->component->dyUndefinedIntraEvent(242, 11));
$this->assertEquals('dyUndefinedIntraEvent', $this->component->getLastBehaviorDynamicMethodCalled());
-
+
//call behavior defined dynamic event
// param1 * 2 * param2
$this->assertEquals(2420, $this->component->dyTestIntraEvent(121, 10));
-
+
$this->component->detachBehavior('TDynamicBehavior');
$this->assertFalse($this->component->isa('TDynamicBehavior'));
-
-
-
+
+
+
//Add Class Behavior with dynamic call
$this->component->attachBehavior('TDynamicClassBehavior', new TDynamicClassBehavior);
-
+
//Check that the behavior is working as it should
$this->assertTrue($this->component->isa('TDynamicClassBehavior'));
$this->assertNull($this->component->getLastBehaviorDynamicMethodCalled());
-
+
// call basic behavior implemented method from object (containing behavior)
$this->assertEquals(42, $this->component->TestBehaviorMethod(6, 7));
-
+
//Test out undefined behavior/host object method
try {
$this->component->objectAndBehaviorUndefinedMethod();
$this->fail('exception not raised when evaluating an undefined method by the object and behavior');
} catch(TApplicationException $e) {
}
-
+
// calling undefined dynamic method, caught by the __dycall method in the behavior and implemented
// this behavior catches undefined dynamic event and divides param1 by param 2
$this->assertEquals(22, $this->component->dyTestDynamicClassBehaviorMethod(242, 11));
$this->assertEquals('dyTestDynamicClassBehaviorMethod', $this->component->getLastBehaviorDynamicMethodCalled());
-
+
// calling undefined dynamic method, caught by the __dycall in the behavior and ignored
$this->assertNull($this->component->dyUndefinedIntraEvent(242, 11));
$this->assertEquals('dyUndefinedIntraEvent', $this->component->getLastBehaviorDynamicMethodCalled());
-
+
//call behavior defined dynamic event
// param1 * 2 * param2
$this->assertEquals(2420, $this->component->dyTestIntraEvent(121, 10));
-
+
$this->component->detachBehavior('TDynamicClassBehavior');
$this->assertFalse($this->component->isa('TDynamicClassBehavior'));
-
+
}
-
+
// This also tests the priority of the common global raiseEvent events
public function testIDynamicMethodsOnBehaviorGlobalEvents() {
$component = new GlobalRaiseComponent();
-
+
// common function has a default priority of 10
$component->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($component, 'commonRaiseEventListener'));
$component->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($component, 'postglobalRaiseEventListener'), 1);
$component->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($component, 'preglobalRaiseEventListener'), -1);
-
+
$this->assertEquals(5, $this->component->fxGlobalListener->getCount());
$this->assertEquals(1, $this->component->fxPrimaryGlobalEvent->getCount());
$this->assertEquals(1, $this->component->fxPrimaryGlobalEvent->getCount(), 'fxPrimaryGlobalEvent is not installed on test object');
-
+
// call the global event on a different object than the test object
$res = $this->component->raiseEvent('fxPrimaryGlobalEvent', $this, null, TEventResults::EVENT_RESULT_ALL);
-
+
$this->assertEquals(6, count($res));
$this->assertEquals(array('pregl', 'primary', 'postgl', 'fxGL', 'fxcall', 'com'), $component->getCallOrders());
-
+
$component->unlisten();
}
@@ -1907,10 +1907,10 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(Exception $e) {
}
}
-
-
-
-
+
+
+
+
public function testEvaluateStatements() {
$statements='$a="test string"; echo $a;';
$this->assertEquals('test string',$this->component->evaluateStatements($statements));
@@ -1921,169 +1921,167 @@ class TComponentTest extends PHPUnit_Framework_TestCase {
} catch(Exception $e) {
}
}
-
-
+
+
public function testDynamicFunctionCall() {
-
+
$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
-
+
$this->component->attachBehavior('dy1', new dy1TextReplace);
$this->assertFalse($this->component->dy1->isCalled());
$this->assertEquals(' aa bb cc __ __ ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy1->isCalled());
-
+
$this->component->attachBehavior('dy2', new dy2TextReplace);
$this->assertFalse($this->component->dy2->isCalled());
$this->assertEquals(' aa bb cc __ __ || || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy2->isCalled());
-
+
$this->component->attachBehavior('dy3', new dy3TextReplace);
$this->assertFalse($this->component->dy3->isCalled());
$this->assertEquals(' aa bb cc __ __ || || ?? ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy3->isCalled());
-
+
$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
-
+
$this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
-
-
+
+
$this->component->detachBehavior('dy1');
$this->component->detachBehavior('dy2');
$this->component->detachBehavior('dy3');
-
+
//test class behaviors of dynamic events and the argument list order
-
+
$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
-
+
$this->component->attachBehavior('dy1', new dy1ClassTextReplace);
$this->assertFalse($this->component->dy1->isCalled());
$this->assertEquals(' aa bb cc .. .. ++ || !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy1->isCalled());
-
+
$this->component->attachBehavior('dy2', new dy2ClassTextReplace);
$this->assertFalse($this->component->dy2->isCalled());
$this->assertEquals(' aa bb cc .. .. ++ ++ !! ?? ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy2->isCalled());
-
+
$this->component->attachBehavior('dy3', new dy3ClassTextReplace);
$this->assertFalse($this->component->dy3->isCalled());
$this->assertEquals(' aa bb cc .. .. ++ ++ !! ^_^ ', $this->component->dyTextFilter(' aa bb cc __ .. ++ || !! ?? '));
$this->assertTrue($this->component->dy3->isCalled());
-
+
$this->assertEquals(' aa bb cc __ .. ++ || !! ?? ', $this->component->dyUndefinedEvent(' aa bb cc __ .. ++ || !! ?? '));
-
+
$this->assertEquals(0.25, $this->component->dyPowerFunction(2,2));
-
-
+
+
}
-
-
-
-
+
+
+
+
public function testDynamicIntraObjectEvents() {
-
+
$this->component->attachBehavior('IntraEvents', new IntraObjectExtenderBehavior);
-
+
$this->assertNull($this->component->IntraEvents->LastCall);
-
+
//unlisten first, this object listens upon instantiation.
$this->component->unlisten();
$this->assertEquals(2, $this->component->IntraEvents->LastCall);
-
+
// ensures that IntraEvents nulls the last call variable when calling this getter
$this->assertNull($this->component->IntraEvents->LastCall);
-
+
//listen next to undo the unlisten
$this->component->listen();
$this->assertEquals(1, $this->component->IntraEvents->LastCall);
-
-
+
+
$this->assertEquals(3, $this->component->evaluateExpression('1+2'));
$this->assertEquals(7, $this->component->IntraEvents->LastCall);
-
+
$statements='$a="test string"; echo $a;';
$this->assertEquals('test string', $this->component->evaluateStatements($statements));
$this->assertEquals(8, $this->component->IntraEvents->LastCall);
-
+
$component2 = new NewComponentNoListen();
$this->assertNull($this->component->createdOnTemplate($component2));
$this->assertEquals(9, $this->component->IntraEvents->LastCall);
-
+
$this->assertNull($this->component->addParsedObject($component2));
$this->assertEquals(10, $this->component->IntraEvents->LastCall);
-
-
-
+
+
+
$behavior = new BarBehavior;
$this->assertEquals($behavior, $this->component->attachBehavior('BarBehavior', $behavior));
$this->assertEquals(11, $this->component->IntraEvents->LastCall);
-
+
$this->assertNull($this->component->disableBehaviors());
$this->assertNull($this->component->enableBehaviors());
$this->assertEquals(27, $this->component->IntraEvents->LastCall);
-
+
$this->assertTrue($this->component->disableBehavior('BarBehavior'));
$this->assertEquals(16, $this->component->IntraEvents->LastCall);
-
+
$this->assertTrue($this->component->enableBehavior('BarBehavior'));
$this->assertEquals(15, $this->component->IntraEvents->LastCall);
-
+
$this->assertEquals($behavior, $this->component->detachBehavior('BarBehavior'));
$this->assertEquals(12, $this->component->IntraEvents->LastCall);
-
-
+
+
$this->component->attachEventHandler('OnMyEvent',array($this->component,'myEventHandler'));
$this->component->raiseEvent('OnMyEvent',$this,null);
-
+
//3 + 4 + 5 + 6 = 18 (the behavior adds these together when each raiseEvent dynamic intra event is called)
$this->assertEquals(18, $this->component->IntraEvents->LastCall);
}
-
-
-
+
+
+
public function testJavascriptGetterSetter() {
-
+
$this->assertFalse(isset($this->component->ColorAttribute));
$this->assertFalse(isset($this->component->JsColorAttribute));
-
+
$this->component->ColorAttribute = "('#556677', '#abcdef', 503987)";
$this->assertEquals("('#556677', '#abcdef', 503987)", $this->component->ColorAttribute);
-
+
$this->assertTrue(isset($this->component->ColorAttribute));
$this->assertTrue(isset($this->component->JsColorAttribute));
-
+
$this->component->ColorAttribute = "new Array(1, 2, 3, 4, 5)";
$this->assertEquals("new Array(1, 2, 3, 4, 5)", $this->component->JsColorAttribute);
-
+
$this->component->JsColorAttribute = "['#112233', '#fedcba', 22009837]";
$this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
}
-
-
+
+
public function testJavascriptIssetUnset() {
-
+
$this->component->JsColorAttribute = "['#112233', '#fedcba', 22009837]";
$this->assertEquals("['#112233', '#fedcba', 22009837]", $this->component->ColorAttribute);
-
+
unset($this->component->ColorAttribute);
-
+
$this->assertFalse(isset($this->component->ColorAttribute));
$this->assertFalse(isset($this->component->JsColorAttribute));
-
+
$this->component->JsColorAttribute = "['#112233', '#fedcba', 22009837]";
-
+
$this->assertTrue(isset($this->component->ColorAttribute));
$this->assertTrue(isset($this->component->JsColorAttribute));
-
+
unset($this->component->JsColorAttribute);
-
+
$this->assertFalse(isset($this->component->ColorAttribute));
$this->assertFalse(isset($this->component->JsColorAttribute));
-
+
}
-
-
-
-}
-?> \ No newline at end of file
+
+
+}
diff --git a/tests/unit/Util/AllTests.php b/tests/unit/Util/AllTests.php
index 8ab99a50..a6a217d7 100644
--- a/tests/unit/Util/AllTests.php
+++ b/tests/unit/Util/AllTests.php
@@ -11,13 +11,13 @@ 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;
}
}
@@ -25,4 +25,3 @@ class Util_AllTests {
if(PHPUnit_MAIN_METHOD == 'Util_AllTests::main') {
Util_AllTests::main();
}
-?>
diff --git a/tests/unit/Util/TDateTimeStampTest.php b/tests/unit/Util/TDateTimeStampTest.php
index 6ae4b128..37784ef3 100644
--- a/tests/unit/Util/TDateTimeStampTest.php
+++ b/tests/unit/Util/TDateTimeStampTest.php
@@ -7,7 +7,7 @@ Prado::using('System.Util.TDateTimeStamp');
* @package System.Util
*/
class TDateTimeStampTest extends PHPUnit_Framework_TestCase {
-
+
public function testGetTimeStampAndFormat() {
$s = new TDateTimeStamp;
$t = $s->getTimeStamp(0,0,0);
@@ -126,4 +126,3 @@ class TDateTimeStampTest extends PHPUnit_Framework_TestCase {
}
}
-?>
diff --git a/tests/unit/Util/TLoggerTest.php b/tests/unit/Util/TLoggerTest.php
index 49d5d316..03b36c5b 100644
--- a/tests/unit/Util/TLoggerTest.php
+++ b/tests/unit/Util/TLoggerTest.php
@@ -16,11 +16,10 @@ class TLoggerTest extends PHPUnit_Framework_TestCase {
public function testLog() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetLogs() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
-?>
diff --git a/tests/unit/Util/TSimpleDateFormatterTest.php b/tests/unit/Util/TSimpleDateFormatterTest.php
index b989fcf5..ce6f1234 100644
--- a/tests/unit/Util/TSimpleDateFormatterTest.php
+++ b/tests/unit/Util/TSimpleDateFormatterTest.php
@@ -16,49 +16,48 @@ class TSimpleDateFormatterTest extends PHPUnit_Framework_TestCase {
public function testConstruct() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testPattern() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testCharset() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testFormat() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testMonthPattern() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testDayPattern() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testYearPattern() {
$formatter = new TSimpleDateFormatter("yyyy");
self::assertEquals("2008-01-01", date('Y-m-d', $formatter->parse("2008")));
}
-
+
public function testMissingYearPattern() {
$formatter = new TSimpleDateFormatter("MM/dd");
self::assertEquals(date("Y-10-22"), date('Y-m-d', $formatter->parse("10/22")));
}
-
+
public function testDayMonthYearOrdering() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testIsValidDate() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testParse() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
-?>
diff --git a/tests/unit/Web/AllTests.php b/tests/unit/Web/AllTests.php
index f9b3b91d..ffd98978 100644
--- a/tests/unit/Web/AllTests.php
+++ b/tests/unit/Web/AllTests.php
@@ -20,10 +20,10 @@ class Web_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Web');
-
+
$suite->addTestSuite('TAssetManagerTest');
$suite->addTestSuite('TCacheHttpSessionTest');
$suite->addTestSuite('THttpCookieCollectionTest');
@@ -33,9 +33,9 @@ class Web_AllTests {
$suite->addTestSuite('THttpSessionTest');
$suite->addTestSuite('THttpUtilityTest');
$suite->addTestSuite('TUriTest');
-
+
$suite->addTest(Web_UI_AllTests::suite());
-
+
return $suite;
}
}
@@ -43,4 +43,3 @@ class Web_AllTests {
if(PHPUnit_MAIN_METHOD == 'Web_AllTests::main') {
Web_AllTests::main();
}
-?>
diff --git a/tests/unit/Web/TAssetManagerTest.php b/tests/unit/Web/TAssetManagerTest.php
index 89349a0d..13d2d6c1 100644
--- a/tests/unit/Web/TAssetManagerTest.php
+++ b/tests/unit/Web/TAssetManagerTest.php
@@ -26,26 +26,26 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$_SERVER['REMOTE_HOST'] = 'localhost';
-
+
if (self::$app===null) {
self::$app=new TApplication(dirname(__FILE__).'/app');
}
-
+
if (self::$assetDir===null) self::$assetDir= dirname(__FILE__).'/assets';
- // Make asset directory if not exists
+ // Make asset directory if not exists
if (!file_exists (self::$assetDir)) {
- if (is_writable(dirname(self::$assetDir)))
+ if (is_writable(dirname(self::$assetDir)))
mkdir (self::$assetDir) ;
- else
+ else
throw new Exception ('Directory '.dirname(self::$assetDir).' is not writable');
} elseif (!is_dir (self::$assetDir)) {
throw new Exception (self::$assetDir.' exists and is not a directory');
}
// Define an alias to asset directory
prado::setPathofAlias('AssetAlias', self::$assetDir);
-
+
}
-
+
private function removeDirectory ($dir) {
// Let's be sure $dir is a directory to avoir any error. Clear the cache !
clearstatcache();
@@ -53,7 +53,7 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
foreach (scandir($dir) as $content) {
if ($content==='.' or $content==='..') continue; // skip . and ..
$content=$dir.'/'.$content;
- if (is_dir($content))
+ if (is_dir($content))
$this->removeDirectory ($content); // Recursivly remove directories
else
unlink ($content); // Remove file
@@ -62,21 +62,21 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
rmdir ($dir);
}
}
-
+
public function tearDown () {
// Make some cleaning :)
- $this->removeDirectory(self::$assetDir);
+ $this->removeDirectory(self::$assetDir);
}
-
+
public function testInit() {
-
+
$manager=new TAssetManager ();
$manager->init (null);
-
+
self::assertEquals(self::$assetDir, $manager->getBasePath());
self::assertEquals($manager, self::$app->getAssetManager());
-
+
// No, remove asset directory, and catch the exception
if (is_dir(self::$assetDir)) $this->removeDirectory (self::$assetDir);
try {
@@ -92,12 +92,12 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
$manager->setBasePath('invalid');
self::fail('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
-
+
// Next, standard asset directory, should work
-
+
$manager->setBasePath ('AssetAlias');
self::assertEquals(self::$assetDir, $manager->getBasePath());
-
+
// Finally, test to change after init
$manager->init (null);
try {
@@ -111,20 +111,20 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
$manager=new TAssetManager ();
$manager->setBaseUrl ('/assets/');
self::assertEquals("/assets", $manager->getBaseUrl());
-
+
$manager->init (null);
try {
$manager->setBaseUrl ('/test');
self::fail ('Expected TInvalidOperationException not thrown');
} catch (TInvalidOperationException $e) {}
-
+
}
public function testPublishFilePath() {
$manager=new TAssetManager();
$manager->setBaseUrl('/');
$manager->init (null);
-
+
// Try to publish a single file
$fileToPublish=dirname(__FILE__).'/data/pradoheader.gif';
$publishedUrl = $manager->publishFilePath($fileToPublish);
@@ -132,19 +132,19 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals($publishedFile, $manager->getPublishedPath($fileToPublish));
self::assertEquals($publishedUrl, $manager->getPublishedUrl($fileToPublish));
self::assertTrue(is_file($publishedFile));
-
+
// try to publish invalid file
try {
$manager->publishFilePath('invalid_file');
self::fail('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
}
-
+
public function testPublishFilePathWithDirectory () {
$manager=new TAssetManager();
$manager->setBaseUrl('/');
$manager->init (null);
-
+
// Try to publish a directory
$dirToPublish=dirname(__FILE__).'/data';
$publishedUrl = $manager->publishFilePath($dirToPublish);
@@ -153,23 +153,23 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
self::assertEquals($publishedUrl, $manager->getPublishedUrl($dirToPublish));
self::assertTrue(is_dir($publishedDir));
self::assertTrue(is_file($publishedDir.'/pradoheader.gif'));
-
+
}
public function testPublishTarFile() {
$manager=new TAssetManager();
$manager->setBaseUrl('/');
$manager->init (null);
-
+
$tarFile=dirname(__FILE__).'/data/aTarFile.tar';
$md5File=dirname(__FILE__).'/data/aTarFile.md5';
-
+
// First, try with bad md5
try {
$manager->publishTarFile($tarFile, 'badMd5File');
self::fail('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
-
+
// Then, try with real md5 file
$publishedUrl=$manager->publishTarFile($tarFile, $md5File);
$publishedDir=self::$assetDir.$publishedUrl;
@@ -178,5 +178,4 @@ class TAssetManagerTest extends PHPUnit_Framework_TestCase {
self::assertTrue(is_file($publishedDir.'/aTarFile.md5'));
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/TCacheHttpSessionTest.php b/tests/unit/Web/TCacheHttpSessionTest.php
index 15c2a382..8475cd37 100644
--- a/tests/unit/Web/TCacheHttpSessionTest.php
+++ b/tests/unit/Web/TCacheHttpSessionTest.php
@@ -11,14 +11,14 @@ class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase
protected $app = null;
protected static $cache = null;
protected static $session = null;
-
+
protected function setUp()
{
if(!extension_loaded('memcache'))
{
self::markTestSkipped('The memcache extension is not available');
}
- else
+ else
{
$basePath = dirname(__FILE__).'/app';
$runtimePath = $basePath.'/runtime';
@@ -33,14 +33,14 @@ class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase
$this->app->setModule('MyCache',self::$cache);
}
}
-
+
protected function tearDown()
{
$this->app = null;
$this->cache = null;
$this->session = null;
}
-
+
public function testInit()
{
$session = new TCacheHttpSession();
@@ -53,7 +53,7 @@ class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase
{
}
unset($session);
-
+
$session = new TCacheHttpSession();
try
{
@@ -66,12 +66,12 @@ class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase
{
}
unset($session);
-
+
self::$session = new TCacheHttpSession();
try
{
self::$session->setCacheModuleID('MyCache');
- self::$session->init(null);
+ self::$session->init(null);
}
catch(TConfigurationException $e)
{
@@ -79,50 +79,49 @@ class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase
self::markTestSkipped('Cannot continue this test');
}
}
-
+
public function testGetCache()
{
$cache = self::$session->getCache();
$this->assertEquals(true, $cache instanceof TMemCache);
}
-
+
public function testCacheModuleID()
{
$id = 'value';
self::$session->setCacheModuleID($id);
self::assertEquals($id, self::$session->getCacheModuleID());
}
-
+
public function testKeyPrefix()
{
$id = 'value';
self::$session->setKeyPrefix($id);
self::assertEquals($id, self::$session->getKeyPrefix());
}
-
+
public function testSetAndGet()
{
self::$session['key'] = 'value';
self::assertEquals('value', self::$session['key']);
}
-
+
public function testAdd()
{
self::$session->add('anotherkey', 'value');
self::assertEquals('value', self::$session['anotherkey']);
}
-
+
public function testRemove()
{
self::$session->remove('key');
self::assertEquals(false, self::$session['key']);
}
-
+
public function testDestroyAndIsStarted()
{
$this->testSetAndGet();
self::$session->destroy();
self::assertEquals(false, self::$session->getIsStarted());
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpCookieCollectionTest.php b/tests/unit/Web/THttpCookieCollectionTest.php
index 68ea8777..aa091788 100644
--- a/tests/unit/Web/THttpCookieCollectionTest.php
+++ b/tests/unit/Web/THttpCookieCollectionTest.php
@@ -28,7 +28,7 @@ class THttpCookieCollectionTest extends PHPUnit_Framework_TestCase {
$coll->removeAt(0);
self::fail('Invalid Value exception not raised');
} catch (TInvalidDataValueException $e) {}
-
+
$coll->insertAt(0, new THttpCookie('name','value'));
self::assertEquals('value',$coll->removeAt(0)->getValue());
}
@@ -46,5 +46,4 @@ class THttpCookieCollectionTest extends PHPUnit_Framework_TestCase {
self::assertEquals ('value', $coll->findCookieByName('name')->getValue());
self::assertNull ($coll->findCookieByName('invalid'));
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpCookieTest.php b/tests/unit/Web/THttpCookieTest.php
index 31d8e572..206ef105 100644
--- a/tests/unit/Web/THttpCookieTest.php
+++ b/tests/unit/Web/THttpCookieTest.php
@@ -49,5 +49,4 @@ class THttpCookieTest extends PHPUnit_Framework_TestCase {
$cookie->setSecure(true);
self::assertTrue($cookie->getSecure());
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpRequestTest.php b/tests/unit/Web/THttpRequestTest.php
index 1807bbe2..7f5da17d 100644
--- a/tests/unit/Web/THttpRequestTest.php
+++ b/tests/unit/Web/THttpRequestTest.php
@@ -503,5 +503,4 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
$module->init ($config);
self::assertEquals('testService', $request->resolveRequest(array ('page', 'testService')));
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpResponseTest.php b/tests/unit/Web/THttpResponseTest.php
index dadbd768..0855bf4d 100644
--- a/tests/unit/Web/THttpResponseTest.php
+++ b/tests/unit/Web/THttpResponseTest.php
@@ -7,18 +7,18 @@ Prado::using('System.Web.THttpResponse');
* @package System.Web
*/
class THttpResponseTest extends PHPUnit_Framework_TestCase {
-
+
public static $app=null;
public function setUp () {
if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app');
ob_start();
}
-
+
public function tearDown () {
ob_end_flush();
}
-
+
public function testInit() {
$response=new THttpResponse ();
$response->init (null);
@@ -43,7 +43,7 @@ class THttpResponseTest extends PHPUnit_Framework_TestCase {
$response->setCacheControl('invalid');
self::fail ('Expected TInvalidDataValueException not thrown');
} catch (TInvalidDataValueException $e) {}
-
+
}
public function testSetContentType() {
@@ -62,7 +62,7 @@ class THttpResponseTest extends PHPUnit_Framework_TestCase {
self::assertEquals('UTF-8', $response->getCharset());
$response->setCharset ('ISO8859-1');
self::assertEquals('ISO8859-1', $response->getCharset());
-
+
}
public function testSetBufferOutput() {
@@ -101,17 +101,17 @@ class THttpResponseTest extends PHPUnit_Framework_TestCase {
}
public function testWriteFile() {
-
+
// Don't know how to test headers :(( ...
throw new PHPUnit_Framework_IncompleteTestError();
-
+
$response=new THttpResponse ();
$response->setBufferOutput(true);
// Suppress warning with headers
$response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0'));
-
+
self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean());
-
+
}
public function testRedirect() {
@@ -157,5 +157,4 @@ class THttpResponseTest extends PHPUnit_Framework_TestCase {
public function testCreateHtmlWriter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpSessionTest.php b/tests/unit/Web/THttpSessionTest.php
index 7de0f8a5..aca83077 100644
--- a/tests/unit/Web/THttpSessionTest.php
+++ b/tests/unit/Web/THttpSessionTest.php
@@ -110,5 +110,4 @@ class THttpSessionTest extends PHPUnit_Framework_TestCase {
public function testOffsetUnset() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/THttpUtilityTest.php b/tests/unit/Web/THttpUtilityTest.php
index 85fcf7f4..7f4e6705 100644
--- a/tests/unit/Web/THttpUtilityTest.php
+++ b/tests/unit/Web/THttpUtilityTest.php
@@ -18,5 +18,4 @@ class THttpUtilityTest extends PHPUnit_Framework_TestCase {
$html = THttpUtility::htmlDecode('&lt;tag key=&quot;value&quot;&gt;');
self::assertEquals('<tag key="value">', $html);
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/TUriTest.php b/tests/unit/Web/TUriTest.php
index a8c65b9e..b610cd1b 100644
--- a/tests/unit/Web/TUriTest.php
+++ b/tests/unit/Web/TUriTest.php
@@ -6,17 +6,17 @@ Prado::using('System.Web.THttpRequest');
* @package System.Web
*/
class TUriTest extends PHPUnit_Framework_TestCase {
-
+
const URISTR='http://login:p@ssw0rd:compl3x@www.pradosoft.com:80/demos/quickstart/index.php?page=test&param1=test2#anchor';
-
+
public function setUp () {
$this->uri=new TUri(self::URISTR);
}
-
+
public function tearDown() {
$this->uri=null;
}
-
+
public function testConstruct() {
$url="http://www.pradosoft.com/";
$uri=new TUri ($url);
@@ -27,7 +27,7 @@ class TUriTest extends PHPUnit_Framework_TestCase {
$url=new TUri($url);
self::fail ('exception not raised with an invalid URL');
} catch (TInvalidDataValueException $e) {
-
+
}
}
@@ -66,5 +66,4 @@ class TUriTest extends PHPUnit_Framework_TestCase {
public function testGetFragment() {
self::assertEquals('anchor', $this->uri->getFragment());
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/ActiveControls/AllTests.php b/tests/unit/Web/UI/ActiveControls/AllTests.php
index ef2dfb91..68989996 100644
--- a/tests/unit/Web/UI/ActiveControls/AllTests.php
+++ b/tests/unit/Web/UI/ActiveControls/AllTests.php
@@ -11,11 +11,11 @@ class Web_UI_ActiveControls_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Web.UI.ActiveControls');
-
- $suite->addTestSuite('TActiveHiddenFieldTest');
+
+ $suite->addTestSuite('TActiveHiddenFieldTest');
return $suite;
}
}
@@ -23,4 +23,3 @@ class Web_UI_ActiveControls_AllTests {
if(PHPUnit_MAIN_METHOD == 'Web_UI_ActiveControls_AllTests::main') {
Web_UI_ActiveControls_AllTests::main();
}
-?>
diff --git a/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php b/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
index 58821747..6e80bd12 100644
--- a/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
+++ b/tests/unit/Web/UI/ActiveControls/TActiveHiddenFieldTest.php
@@ -14,5 +14,3 @@ class TActiveHiddenFieldTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Test', $field->getValue());
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Web/UI/AllTests.php b/tests/unit/Web/UI/AllTests.php
index 71b088e4..6885c337 100644
--- a/tests/unit/Web/UI/AllTests.php
+++ b/tests/unit/Web/UI/AllTests.php
@@ -23,10 +23,10 @@ class Web_UI_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Web.UI');
-
+
$suite->addTestSuite('TClientScriptManagerTest');
$suite->addTestSuite('TControlAdapterTest');
$suite->addTestSuite('TControlTest');
@@ -40,7 +40,7 @@ class Web_UI_AllTests {
$suite->addTestSuite('THtmlWriterTest');
$suite->addTestSuite('TPageStatePersisterTest');
$suite->addTestSuite('TSessionPageStatePersisterTest');
-
+
return $suite;
}
}
@@ -48,4 +48,3 @@ class Web_UI_AllTests {
if(PHPUnit_MAIN_METHOD == 'Web_UI_AllTests::main') {
Web_UI_AllTests::main();
}
-?>
diff --git a/tests/unit/Web/UI/TClientScriptManagerTest.php b/tests/unit/Web/UI/TClientScriptManagerTest.php
index ea360f91..efce0009 100644
--- a/tests/unit/Web/UI/TClientScriptManagerTest.php
+++ b/tests/unit/Web/UI/TClientScriptManagerTest.php
@@ -144,5 +144,4 @@ class TClientScriptManagerTest extends PHPUnit_Framework_TestCase {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TControlAdapterTest.php b/tests/unit/Web/UI/TControlAdapterTest.php
index 2a173fd8..ff687cc8 100644
--- a/tests/unit/Web/UI/TControlAdapterTest.php
+++ b/tests/unit/Web/UI/TControlAdapterTest.php
@@ -15,46 +15,45 @@ class TControlAdapterTest extends PHPUnit_Framework_TestCase {
public function testGetControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetPage() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testCreateChildControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLoadState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSaveState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnLoad() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnPreRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnUnload() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRenderChildren() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TControlTest.php b/tests/unit/Web/UI/TControlTest.php
index 670926be..b6741167 100644
--- a/tests/unit/Web/UI/TControlTest.php
+++ b/tests/unit/Web/UI/TControlTest.php
@@ -15,266 +15,265 @@ class TControlTest extends PHPUnit_Framework_TestCase {
public function test__get() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasAdapter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetAdapter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetParent() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetNamingContainer() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetPage() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetTemplateControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetSourceTemplateControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetControlStage() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetID() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetUniqueID() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testFocus() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetClientID() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetSkinID() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnableTheming() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetCustomData() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetVisible() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnabled() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasAttributes() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetAttributes() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testHasAttribute() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetAttribute() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRemoveAttribute() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnableViewState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetControlState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testTrackViewState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetViewState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testClearViewState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testBindProperty() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testUnbindProperty() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testAutoBindProperty() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testDataBind() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testEnsureChildControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testCreateChildControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testFindControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testFindControlsByType() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testFindControlsByID() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testClearNamingContainer() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRegisterObject() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testUnregisterObject() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testIsObjectRegistered() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasChildInitialized() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasInitialized() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasLoadedPostData() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasLoaded() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHasPreRendered() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetRegisteredObject() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetAllowChildControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testAddParsedObject() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testAddedControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRemovedControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnLoad() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnDataBinding() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnUnload() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnPreRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testBubbleEvent() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testBroadcastEvent() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRenderControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRenderChildren() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSaveState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLoadState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testApplyStyleSheetSkin() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TFormTest.php b/tests/unit/Web/UI/TFormTest.php
index 74cbdb59..7fb6d2b7 100644
--- a/tests/unit/Web/UI/TFormTest.php
+++ b/tests/unit/Web/UI/TFormTest.php
@@ -15,22 +15,21 @@ class TFormTest extends PHPUnit_Framework_TestCase {
public function testRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetDefaultButton() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetMethod() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnctype() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetName() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/THtmlWriterTest.php b/tests/unit/Web/UI/THtmlWriterTest.php
index 080e2e26..cf3b27e3 100644
--- a/tests/unit/Web/UI/THtmlWriterTest.php
+++ b/tests/unit/Web/UI/THtmlWriterTest.php
@@ -31,7 +31,7 @@ class TestWriter extends TComponent implements ITextWriter
{
$this->write($str."\n");
}
-
+
// Accessors to get value of private vars during tests
public function getFlushedContent() { return $this->_flushedContent; }
public function getStr() { return $this->_str; }
@@ -77,7 +77,7 @@ class THtmlWriterTest extends PHPUnit_Framework_TestCase {
$writer->addAttribute('value','Prado & Cie');
$result=self::readAttribute($writer, '_attributes');
self::assertEquals('text',$result['type']);
- self::assertEquals(THttpUtility::htmlEncode('Prado & Cie'), $result['value']);
+ self::assertEquals(THttpUtility::htmlEncode('Prado & Cie'), $result['value']);
}
public function testRemoveAttribute() {
@@ -129,21 +129,21 @@ class THtmlWriterTest extends PHPUnit_Framework_TestCase {
$writer=new THtmlWriter(self::$output);
$writer->write('Some Text');;
self::assertEquals('Some Text', self::$output->flush());
-
+
}
public function testWriteLine() {
$writer=new THtmlWriter(self::$output);
$writer->writeLine('Some Text');;
self::assertEquals("Some Text\n", self::$output->flush());
-
+
}
public function testWriteBreak() {
$writer=new THtmlWriter(self::$output);
$writer->writeBreak();
self::assertEquals("<br/>", self::$output->flush());
-
+
}
public function testRenderBeginTag() {
@@ -163,5 +163,4 @@ class THtmlWriterTest extends PHPUnit_Framework_TestCase {
self::assertEquals('<div>Div Content</div>', self::$output->flush());
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TPageStatePersisterTest.php b/tests/unit/Web/UI/TPageStatePersisterTest.php
index 2734b142..8ee1cfc9 100644
--- a/tests/unit/Web/UI/TPageStatePersisterTest.php
+++ b/tests/unit/Web/UI/TPageStatePersisterTest.php
@@ -7,18 +7,17 @@ Prado::using('System.Web.UI.TPageStatePersister');
* @package System.Web.UI
*/
class TPageStatePersisterTest extends PHPUnit_Framework_TestCase {
-
+
public function testSetAndGetPage() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSave() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLoad() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TPageTest.php b/tests/unit/Web/UI/TPageTest.php
index d6f689e9..5b2f444d 100644
--- a/tests/unit/Web/UI/TPageTest.php
+++ b/tests/unit/Web/UI/TPageTest.php
@@ -15,15 +15,15 @@ class TPageTest extends PHPUnit_Framework_TestCase {
public function testRun() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetCallbackClient() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetCallbackEventTarget() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetCallbackEventParameter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
@@ -39,157 +39,156 @@ class TPageTest extends PHPUnit_Framework_TestCase {
public function testSetAndGetForm() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetValidators() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testValidate() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIsValid() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetTheme() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetStyleSheetTheme() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testApplyControlSkin() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testApplyControlStyleSheet() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetClientScript() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnPreInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnInitComplete() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnPreLoad() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnLoadComplete() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnPreRenderComplete() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testOnSaveStateComplete() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIsPostBack() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIsCallback() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSaveState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLoadState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRegisterRequiresPostData() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetPostBackEventTarget() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetPostBackEventParameter() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIsLoadingPostData() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testEnsureRenderInForm() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testBeginFormRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testEndFormRender() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetFocus() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetClientSupportsJavaScript() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetHead() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetTitle() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetClientState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetRequestClientState() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetStatePersisterClass() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetStatePersister() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnableStateValidation() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetEnableStateEncryption() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetPagePath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRegisterCachingAction() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetCachingStack() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
-?> \ No newline at end of file
diff --git a/tests/unit/Web/UI/TSessionPageStatePersisterTest.php b/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
index b8758b30..9153ad42 100644
--- a/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
+++ b/tests/unit/Web/UI/TSessionPageStatePersisterTest.php
@@ -7,22 +7,21 @@ Prado::using('System.Web.UI.TSessionPageStatePersister');
* @package System.Web.UI
*/
class TSessionPageStatePersisterTest extends PHPUnit_Framework_TestCase {
-
+
public function testSetAndGetPage() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetHistorySize() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSave() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testLoad() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TTemplateControlTest.php b/tests/unit/Web/UI/TTemplateControlTest.php
index 97ea8c1d..7276a2b0 100644
--- a/tests/unit/Web/UI/TTemplateControlTest.php
+++ b/tests/unit/Web/UI/TTemplateControlTest.php
@@ -15,34 +15,33 @@ class TTemplateControlTest extends PHPUnit_Framework_TestCase {
public function testGetIsSourceTemplateControl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetTemplateDirectory() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testCreateChildControls() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRegisterContent() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testRegisterContentPlaceHolder() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetMasterClass() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetMaster() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testInjectContent() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TTemplateManagerTest.php b/tests/unit/Web/UI/TTemplateManagerTest.php
index 46c17538..dfe452bf 100644
--- a/tests/unit/Web/UI/TTemplateManagerTest.php
+++ b/tests/unit/Web/UI/TTemplateManagerTest.php
@@ -7,18 +7,17 @@ Prado::using('System.Web.UI.TTemplateManager');
* @package System.Web.UI
*/
class TTemplateManagerTest extends PHPUnit_Framework_TestCase {
-
+
public function testInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetTemplateByClassName() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetTemplateByFileName() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
-}
-?> \ No newline at end of file
+
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TTemplateTest.php b/tests/unit/Web/UI/TTemplateTest.php
index 2bb6599b..2d802094 100644
--- a/tests/unit/Web/UI/TTemplateTest.php
+++ b/tests/unit/Web/UI/TTemplateTest.php
@@ -7,42 +7,41 @@ Prado::using('System.Web.UI.TTemplateManager');
* @package System.Web.UI
*/
class TTemplateTest extends PHPUnit_Framework_TestCase {
-
+
public function testConstruct() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetTemplateFile() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIsSourceTemplate() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetContextPath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetDirective() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetHashCode() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetItems() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testInstantiateIn() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetIncludedFiles() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
-}
-?> \ No newline at end of file
+
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TThemeManagerTest.php b/tests/unit/Web/UI/TThemeManagerTest.php
index 1a514d2b..028b222a 100644
--- a/tests/unit/Web/UI/TThemeManagerTest.php
+++ b/tests/unit/Web/UI/TThemeManagerTest.php
@@ -7,26 +7,25 @@ Prado::using('System.Web.UI.TThemeManager');
* @package System.Web.UI
*/
class TThemeManagerTest extends PHPUnit_Framework_TestCase {
-
+
public function testInit() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetTheme() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetAvailableThemes() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetBasePath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testSetAndGetBaseUrl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/TThemeTest.php b/tests/unit/Web/UI/TThemeTest.php
index e7fa376d..aeeeee65 100644
--- a/tests/unit/Web/UI/TThemeTest.php
+++ b/tests/unit/Web/UI/TThemeTest.php
@@ -7,34 +7,33 @@ Prado::using('System.Web.UI.TThemeManager');
* @package System.Web.UI
*/
class TThemeTest extends PHPUnit_Framework_TestCase {
-
+
public function testConstruct() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetName() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetBaseUrl() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetBasePath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testApplySkin() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetStyleSheetFiles() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-
+
public function testGetJavaScriptFiles() {
throw new PHPUnit_Framework_IncompleteTestError();
}
-}
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/tests/unit/Web/UI/WebControls/AllTests.php b/tests/unit/Web/UI/WebControls/AllTests.php
index 7d0b1632..5ffa45a2 100644
--- a/tests/unit/Web/UI/WebControls/AllTests.php
+++ b/tests/unit/Web/UI/WebControls/AllTests.php
@@ -14,15 +14,15 @@ class Web_UI_WebControls_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Web.UI.WebControls');
-
+
$suite->addTestSuite('TDropDownListTest');
$suite->addTestSuite('TLabelTest');
$suite->addTestSuite('TRequiredFieldValidatorTest');
$suite->addTestSuite('TXmlTransformTest');
-
+
return $suite;
}
}
@@ -30,4 +30,3 @@ class Web_UI_WebControls_AllTests {
if(PHPUnit_MAIN_METHOD == 'Web_UI_WebControls_AllTests::main') {
Web_UI_WebControls_AllTests::main();
}
-?>
diff --git a/tests/unit/Web/UI/WebControls/TDropDownListTest.php b/tests/unit/Web/UI/WebControls/TDropDownListTest.php
index 503466fe..d27ebb9c 100644
--- a/tests/unit/Web/UI/WebControls/TDropDownListTest.php
+++ b/tests/unit/Web/UI/WebControls/TDropDownListTest.php
@@ -27,4 +27,3 @@ class TDropDownListTest extends PHPUnit_Framework_TestCase {
}
}
-?>
diff --git a/tests/unit/Web/UI/WebControls/TLabelTest.php b/tests/unit/Web/UI/WebControls/TLabelTest.php
index 0e5577d5..88d8aec8 100644
--- a/tests/unit/Web/UI/WebControls/TLabelTest.php
+++ b/tests/unit/Web/UI/WebControls/TLabelTest.php
@@ -15,5 +15,3 @@ class TLabelTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Test', $label->getText());
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
index 894c3899..43ed2c9d 100644
--- a/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
+++ b/tests/unit/Web/UI/WebControls/TRequiredFieldValidatorTest.php
@@ -19,5 +19,3 @@ class TRequiredFieldValidatorTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('', $value);
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/Web/UI/WebControls/TXmlTransformTest.php b/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
index 6c6d9456..f93e9897 100644
--- a/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
+++ b/tests/unit/Web/UI/WebControls/TXmlTransformTest.php
@@ -51,7 +51,7 @@ class TXmlTransformTest extends PHPUnit_Framework_TestCase {
$transform->setTransformContent($expected);
$this->assertEquals($expected, $transform->getTransformContent());
}
-
+
public function testSetTransformPathAsFile() {
$expected = $this->transformPath;
$transform = new TXmlTransform();
@@ -120,10 +120,9 @@ class TXmlTransformTest extends PHPUnit_Framework_TestCase {
$actual = $textWriter->flush();
self::assertEquals($expected, $actual);
}
-
+
public function testRenderWithBodyAsDocumentAndTransformPath() {
throw new PHPUnit_Framework_IncompleteTestError();
}
}
-?>
diff --git a/tests/unit/Xml/AllTests.php b/tests/unit/Xml/AllTests.php
index d934786b..afb4c7a8 100644
--- a/tests/unit/Xml/AllTests.php
+++ b/tests/unit/Xml/AllTests.php
@@ -12,14 +12,14 @@ class Xml_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.Xml');
-
+
$suite->addTestSuite('TXmlDocumentTest');
$suite->addTestSuite('TXmlElementTest');
$suite->addTestSuite('TXmlElementListTest');
-
+
return $suite;
}
}
@@ -27,4 +27,3 @@ class Xml_AllTests {
if(PHPUnit_MAIN_METHOD == 'Xml_AllTests::main') {
Xml_AllTests::main();
}
-?>
diff --git a/tests/unit/Xml/TXmlDocumentTest.php b/tests/unit/Xml/TXmlDocumentTest.php
index 2ab95641..54e4b5aa 100644
--- a/tests/unit/Xml/TXmlDocumentTest.php
+++ b/tests/unit/Xml/TXmlDocumentTest.php
@@ -34,7 +34,7 @@ class TXmlDocumentTest extends PHPUnit_Framework_TestCase {
$xmldoc->loadFromFile('unexistentXmlFile.xml');
self::fail('Expected TIOException not thrown');
} catch (TIOException $e) {}
-
+
self::assertTrue($xmldoc->loadFromFile($file));
self::assertEquals('1.0', $xmldoc->getVersion());
self::assertEquals('UTF-8',$xmldoc->getEncoding());
@@ -61,9 +61,9 @@ class TXmlDocumentTest extends PHPUnit_Framework_TestCase {
// Result string should be :
$resultString="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n <node param=\"attribute1\"\n</root>";
self::assertEquals($xmlString, $magicString);
-
+
}
-
+
public function testSaveToFile() {
$file=dirname(__FILE__).'/data/tmp.xml';
if (!is_writable(dirname($file))) self::markTestSkipped(dirname($file).' must be writable for this test');
@@ -77,4 +77,3 @@ class TXmlDocumentTest extends PHPUnit_Framework_TestCase {
if (is_file($file)) unlink ($file);
}
}
-?>
diff --git a/tests/unit/Xml/TXmlElementListTest.php b/tests/unit/Xml/TXmlElementListTest.php
index b124dfbe..7667c64d 100644
--- a/tests/unit/Xml/TXmlElementListTest.php
+++ b/tests/unit/Xml/TXmlElementListTest.php
@@ -23,7 +23,7 @@ class TXmlElementListTest extends PHPUnit_Framework_TestCase {
$newElement=new TXmlElement('newTag');
$list->insertAt(0,$newElement);
self::assertEquals($newElement,$list->itemAt(0));
-
+
}
public function testRemoveAt() {
@@ -34,4 +34,3 @@ class TXmlElementListTest extends PHPUnit_Framework_TestCase {
self::assertEquals($newElement,$list->removeAt(0));
}
}
-?>
diff --git a/tests/unit/Xml/TXmlElementTest.php b/tests/unit/Xml/TXmlElementTest.php
index d7b86832..49cae36f 100644
--- a/tests/unit/Xml/TXmlElementTest.php
+++ b/tests/unit/Xml/TXmlElementTest.php
@@ -7,7 +7,7 @@ Prado::using('System.Xml.TXmlDocument');
*/
class TXmlElementTest extends PHPUnit_Framework_TestCase {
- public function setUp() {
+ public function setUp() {
}
public function testConstruct() {
@@ -80,4 +80,3 @@ class TXmlElementTest extends PHPUnit_Framework_TestCase {
self::assertEquals('<tag key="value">value</tag>', (string)$element);
}
}
-?>