From 6dff17fee04f8b8a1f35ec8e9afe65ae32b2684c Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Sun, 18 Nov 2012 19:08:27 +0000 Subject: Reworked the "test" task in order to make it work again: - it will use the system PHPUnit installation if available (bundled PHPUnit with prado is no more a choice) - fixed tests in order to be compatible with recent phpunit versions (currently 3.7) - dropped old tests referring to unexisting components (NOTE: this includes what seems a test suite for an older version of SQLMap) Added some svn-ignore properties --- tests/unit/AllTests.php | 3 +- .../unit/Caching/TDirectoryCacheDependencyTest.php | 4 +- tests/unit/Caching/TFileCacheDependencyTest.php | 4 +- tests/unit/Collections/TMapTest.php | 8 +- tests/unit/Collections/TPriorityMapTest.php | 13 +- tests/unit/Data/TDbCommandTest.php | 7 +- tests/unit/Data/TDbConnectionTest.php | 10 +- tests/unit/Data/TDbDataReaderTest.php | 7 +- tests/unit/Data/TDbTransactionTest.php | 5 +- tests/unit/Prado.php | 2 - tests/unit/Web/THttpResponseTest.php | 1 - tests/unit/Xml/TRssFeedDocumentTest.php | 158 --------------------- tests/unit/phpunit.php | 21 +-- 13 files changed, 28 insertions(+), 215 deletions(-) delete mode 100644 tests/unit/Xml/TRssFeedDocumentTest.php (limited to 'tests') diff --git a/tests/unit/AllTests.php b/tests/unit/AllTests.php index 62e127c8..e4c022cb 100644 --- a/tests/unit/AllTests.php +++ b/tests/unit/AllTests.php @@ -51,4 +51,5 @@ class AllTests { if(PHPUnit_MAIN_METHOD == 'AllTests::main') { AllTests::main(); } -?> + +?> \ No newline at end of file diff --git a/tests/unit/Caching/TDirectoryCacheDependencyTest.php b/tests/unit/Caching/TDirectoryCacheDependencyTest.php index 786720da..c5c75dec 100644 --- a/tests/unit/Caching/TDirectoryCacheDependencyTest.php +++ b/tests/unit/Caching/TDirectoryCacheDependencyTest.php @@ -1,11 +1,9 @@ map=new TMap; - $this->item1=new MapItem; - $this->item2=new MapItem; - $this->item3=new MapItem; + $this->item1=new TMapTest_MapItem; + $this->item2=new TMapTest_MapItem; + $this->item3=new TMapTest_MapItem; $this->map->add('key1',$this->item1); $this->map->add('key2',$this->item2); } diff --git a/tests/unit/Collections/TPriorityMapTest.php b/tests/unit/Collections/TPriorityMapTest.php index 54ff68b7..c7d56243 100644 --- a/tests/unit/Collections/TPriorityMapTest.php +++ b/tests/unit/Collections/TPriorityMapTest.php @@ -1,7 +1,6 @@ map=new TPriorityMap; - $this->item1=new MapItem; - $this->item2=new MapItem; - $this->item3=new MapItem; - $this->item4=new MapItem; - $this->item5=new MapItem; + $this->item1=new TPriorityMapTest_MapItem; + $this->item2=new TPriorityMapTest_MapItem; + $this->item3=new TPriorityMapTest_MapItem; + $this->item4=new TPriorityMapTest_MapItem; + $this->item5=new TPriorityMapTest_MapItem; $this->map->add('key1',$this->item1); $this->map->add('key2',$this->item2); diff --git a/tests/unit/Data/TDbCommandTest.php b/tests/unit/Data/TDbCommandTest.php index 9023e6b6..a75674bf 100644 --- a/tests/unit/Data/TDbCommandTest.php +++ b/tests/unit/Data/TDbCommandTest.php @@ -1,15 +1,14 @@ diff --git a/tests/unit/Web/THttpResponseTest.php b/tests/unit/Web/THttpResponseTest.php index 8e40a2a0..ac5d3751 100644 --- a/tests/unit/Web/THttpResponseTest.php +++ b/tests/unit/Web/THttpResponseTest.php @@ -1,6 +1,5 @@ getVersion()); - $feed = new TRssFeedDocument('UTF-8'); - self::assertEquals('UTF-8', $feed->getEncoding()); - } - - public function testSetVersion() { - $feed = new TRssFeedDocument(); - $feed->setVersion('0.92'); - self::assertEquals('0.92', $feed->getVersion()); - $feed->setVersion('2.0'); - self::assertEquals('2.0', $feed->getVersion()); - } - - public function testSetTitle() { - $expected = "This is a title"; - $feed = new TRssFeedDocument(); - $feed->setTitle($expected); - self::assertEquals($expected, $feed->getTitle()); - } - - public function testSetLink() { - $expected = "http://www.pradosoft.com"; - $feed = new TRssFeedDocument(); - $feed->setLink($expected); - self::assertEquals($expected, $feed->getLink()); - } - - public function testSetDescription() { - $expected = "This is a description"; - $feed = new TRssFeedDocument(); - $feed->setDescription($expected); - self::assertEquals($expected, $feed->getDescription()); - } - - public function testSetLanguage() { - $expected = "en-us"; - $feed = new TRssFeedDocument(); - $feed->setLanguage($expected); - self::assertEquals($expected, $feed->getLanguage()); - } - - public function testSetCopyright() { - $expected = "Copyright (C) 2006 PradoSoft"; - $feed = new TRssFeedDocument(); - $feed->setCopyright($expected); - self::assertEquals($expected, $feed->getCopyright()); - } - - public function testSetManagingEditor() { - $expected = "test@gmail.com"; - $feed = new TRssFeedDocument(); - $feed->setManagingEditor($expected); - self::assertEquals($expected, $feed->getManagingEditor()); - } - - public function testSetWebMaster() { - $expected = "test@gmail.com"; - $feed = new TRssFeedDocument(); - $feed->setWebMaster($expected); - self::assertEquals($expected, $feed->getWebMaster()); - } - - public function testSetRating() { - $expected = '(PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~000 1))'; - $feed = new TRssFeedDocument(); - $feed->setRating($expected); - self::assertEquals($expected, $feed->getRating()); - } - - public function testSetPublicationDate() { - $expected = 'Fri, 13 Apr 2001 19:23:02 GMT'; - $feed = new TRssFeedDocument(); - $feed->setPublicationDate($expected); - self::assertEquals($expected, $feed->getPublicationDate()); - } - - public function testSetLastBuildDate() { - $expected = 'Fri, 13 Apr 2001 19:23:02 GMT'; - $feed = new TRssFeedDocument(); - $feed->setLastBuildDate($expected); - self::assertEquals($expected, $feed->getLastBuildDate()); - } - - public function testSetDocumentation() { - $expected = 'http://backend.userland.com/rss092'; - $feed = new TRssFeedDocument(); - $feed->setDocumentation($expected); - self::assertEquals($expected, $feed->getDocumentation()); - } - - public function testSetSkipDays() { - $expected = array('Saturday', 'Sunday'); - $feed = new TRssFeedDocument(); - $feed->setSkipDays($expected); - self::assertEquals($expected, $feed->getSkipDays()); - } - - public function testSetSkipHours() { - $expected = array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23); - $feed = new TRssFeedDocument(); - $feed->setSkipHours($expected); - self::assertEquals($expected, $feed->getSkipHours()); - } - - public function testAddItem() { - $feed = new TRssFeedDocument(); - $item = new TRssFeedItem(); - $feed->addItem($item); - $items = $feed->getItems(); - /* var_dump($items); - self::assertInstanceOf($items[0], 'TRssItem');*/ - } - - public function testSetImage() { - throw new PHPUnit2_Framework_IncompleteTestError(); - } - - public function testSetTextInput() { - throw new PHPUnit2_Framework_IncompleteTestError(); - } - - public function testSetCloud() { - throw new PHPUnit2_Framework_IncompleteTestError(); - } - - public function testSetCategory() { - $expected = 'Business/Industries/Publishing/Publishers/Nonfiction/'; - $feed = new TRssFeedDocument(); - $feed->setCategory($expected, 'http://www.pradosoft.com'); - self::assertEquals($expected, $feed->getCategory()); - } - - public function testSetGenerator() { - $expected = 'PRADO 3.0'; - $feed = new TRssFeedDocument(); - $feed->setVersion('2.0'); - $feed->setGenerator($expected); - self::assertEquals($expected, $feed->getGenerator()); - } - - public function testSetTimeToLive() { - throw new PHPUnit2_Framework_IncompleteTestError(); - } -} - -?> \ No newline at end of file diff --git a/tests/unit/phpunit.php b/tests/unit/phpunit.php index 6d612e46..e32d0e54 100644 --- a/tests/unit/phpunit.php +++ b/tests/unit/phpunit.php @@ -13,23 +13,4 @@ define('PRADO_FRAMEWORK_DIR', dirname(__FILE__).'/../../framework'); set_include_path(PRADO_FRAMEWORK_DIR.PATH_SEPARATOR.get_include_path()); -require_once dirname(__FILE__).'/Prado.php'; -require_once PRADO_FRAMEWORK_DIR.'/prado.php'; - -//grab the version of phpunit, OPP: phpunit provided version call -$version = `{$_SERVER['argv'][0]} --version`; -preg_match('/(\d\d?)\.(\d\d?)(\.(\d\d?))?/', $version, $matches); - -if($matches[1] <= 3){ - if($matches[2] <= 4){ - require_once 'PHPUnit/Framework.php'; - if($matches[2] <= 3){ - require_once 'PHPUnit/Framework/TestCase.php'; - require_once 'PHPUnit/Framework/IncompleteTestError.php'; - require_once 'PHPUnit/Framework/TestSuite.php'; - } - } -} -require_once 'PHPUnit/TextUI/TestRunner.php'; -require_once 'PHPUnit/Util/Filter.php'; -?> +?> \ No newline at end of file -- cgit v1.2.3