summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorctrlaltca <>2012-11-18 19:08:27 +0000
committerctrlaltca <>2012-11-18 19:08:27 +0000
commit6dff17fee04f8b8a1f35ec8e9afe65ae32b2684c (patch)
treee8e9f9b44ba7975aca3b96f736daa1728b59fe2c
parentdd2fbb7ff2ce3d9885c18a978c79294a13ed9025 (diff)
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
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore4
-rw-r--r--build.xml5
-rw-r--r--buildscripts/phing/tasks/PradoTestTask.php11
-rw-r--r--demos/quickstart/protected/pages/Controls/Accordion.page2
-rw-r--r--demos/quickstart/protected/pages/Controls/FlushOutput.page2
-rwxr-xr-xdemos/quickstart/protected/pages/Services/RpcService.page2
-rw-r--r--tests/unit/AllTests.php3
-rw-r--r--tests/unit/Caching/TDirectoryCacheDependencyTest.php4
-rw-r--r--tests/unit/Caching/TFileCacheDependencyTest.php4
-rw-r--r--tests/unit/Collections/TMapTest.php8
-rw-r--r--tests/unit/Collections/TPriorityMapTest.php13
-rw-r--r--tests/unit/Data/TDbCommandTest.php7
-rw-r--r--tests/unit/Data/TDbConnectionTest.php10
-rw-r--r--tests/unit/Data/TDbDataReaderTest.php7
-rw-r--r--tests/unit/Data/TDbTransactionTest.php5
-rw-r--r--tests/unit/Prado.php2
-rw-r--r--tests/unit/Web/THttpResponseTest.php1
-rw-r--r--tests/unit/Xml/TRssFeedDocumentTest.php158
-rw-r--r--tests/unit/phpunit.php21
20 files changed, 41 insertions, 229 deletions
diff --git a/.gitattributes b/.gitattributes
index 451dc821..878e207d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4021,7 +4021,6 @@ tests/unit/Web/data/aTarFile.md5 -text
tests/unit/Web/data/aTarFile.tar -text
tests/unit/Web/data/pradoheader.gif -text
tests/unit/Xml/AllTests.php -text
-tests/unit/Xml/TRssFeedDocumentTest.php -text
tests/unit/Xml/TXmlDocumentTest.php -text
tests/unit/Xml/TXmlElementListTest.php -text
tests/unit/Xml/TXmlElementTest.php -text
diff --git a/.gitignore b/.gitignore
index d3325539..8785e5f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,11 @@
/.project
/.settings
/assets
+/build
buildscripts/chmbuilder/assets/*
buildscripts/chmbuilder/classes/runtime/*
+buildscripts/texbuilder/quickstart/*.png
+buildscripts/texbuilder/quickstart/*.tex
demos/address-book/assets/*
demos/address-book/protected/runtime/*
demos/blog-tutorial/assets/*
@@ -58,5 +61,6 @@ tests/FunctionalTests/validators/assets/*
tests/FunctionalTests/validators/protected/runtime/*
tests/simple_unit/runtime/*
tests/unit/Caching/mockapp/runtime/*
+tests/unit/Data/db/test.db
tests/unit/Security/app/runtime/*
tests/unit/Web/app/runtime/*
diff --git a/build.xml b/build.xml
index cac1e8d9..794328e9 100644
--- a/build.xml
+++ b/build.xml
@@ -12,7 +12,8 @@
<!-- <taskdef name="prado-pear" classname="PradoPearTask" classpath="buildscripts/phing/tasks"/>-->
<taskdef name="prado-quickstart-index" classname="QuickstartIndexTask" classpath="buildscripts/phing/tasks"/>
<taskdef name="prado-api-index" classname="ManualIndexTask" classpath="buildscripts/phing/tasks"/>
-<!-- <taskdef name="prado-test" classname="PradoTestTask" classpath="buildscripts/phing/tasks"/>-->
+ <taskdef name="prado-test" classname="PradoTestTask" classpath="buildscripts/phing/tasks"/>
+ <taskdef name="phpunitreporttask" classname="PhpUnitReportTask" classpath="buildscripts/phing/tasks"/>
<taskdef name="compact-package" classname="PradoPackageTask" classpath="buildscripts/phing/tasks"/>
<taskdef name="prado-quickstart-docs" classname="PradoQuickStartDocs" classpath="buildscripts/phing/tasks" />
@@ -460,7 +461,7 @@ the PRADO distribution:
</batchtest>
<formatter type="xml" todir="${build.test.dir}" outfile="unit-tests.xml"/>
</prado-test>
- <phpunit2report infile="${build.test.dir}/unit-tests.xml" format="frames" styledir="buildscripts/phing/style" todir="${build.test.dir}"/>
+ <phpunitreporttask infile="${build.test.dir}/unit-tests.xml" format="frames" todir="${build.test.dir}"/>
</target>
<target name="snapshot" depends="rebuild">
diff --git a/buildscripts/phing/tasks/PradoTestTask.php b/buildscripts/phing/tasks/PradoTestTask.php
index cd2c87f8..a52e7c85 100644
--- a/buildscripts/phing/tasks/PradoTestTask.php
+++ b/buildscripts/phing/tasks/PradoTestTask.php
@@ -1,18 +1,13 @@
<?php
require_once 'phing/Task.php';
-require_once 'phing/tasks/ext/phpunit2/PHPUnit2Task.php';
+require_once 'phing/tasks/ext/phpunit/PHPUnitTask.php';
+require 'PHPUnit/Autoload.php';
/**
* Task to run PRADO unit tests
*/
-class PradoTestTask extends PHPUnit2Task
+class PradoTestTask extends PHPUnitTask
{
- function init()
- {
- $phpunit2_path = realpath(dirname(__FILE__).'/../..');
- set_include_path(get_include_path().PATH_SEPARATOR.$phpunit2_path);
- parent::init();
- }
}
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Accordion.page b/demos/quickstart/protected/pages/Controls/Accordion.page
index c4637c4b..4cb4b2ed 100644
--- a/demos/quickstart/protected/pages/Controls/Accordion.page
+++ b/demos/quickstart/protected/pages/Controls/Accordion.page
@@ -1,6 +1,6 @@
<com:TContent ID="body" >
-<h1>TAccordion</h1>
+<h1 id="54001">TAccordion</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TAccordion" />
<p class="block-content">
diff --git a/demos/quickstart/protected/pages/Controls/FlushOutput.page b/demos/quickstart/protected/pages/Controls/FlushOutput.page
index 39b0b8be..78459aca 100644
--- a/demos/quickstart/protected/pages/Controls/FlushOutput.page
+++ b/demos/quickstart/protected/pages/Controls/FlushOutput.page
@@ -1,6 +1,6 @@
<com:TContent ID="body" >
-<h1>TFlushOutput</h1>
+<h1 id="74002">TFlushOutput</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TFlushOutput" />
<p class="block-content">
diff --git a/demos/quickstart/protected/pages/Services/RpcService.page b/demos/quickstart/protected/pages/Services/RpcService.page
index ef6ded94..f5d38c84 100755
--- a/demos/quickstart/protected/pages/Services/RpcService.page
+++ b/demos/quickstart/protected/pages/Services/RpcService.page
@@ -1,6 +1,6 @@
<com:TContent ID="body" >
-<h1>RPC Service</h1>
+<h1 id="218003">RPC Service</h1>
<p class="block-content">
RPC Service stands for "Remote Procedure Call" Service and is a common name used to identify a service that exposes an interface that can be called by remote programs in order to execute a procedure.
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 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit2.php');
-
/**
* @package System.Caching
*/
-class TDirectoryCacheDependencyTest extends PHPUnit2_Framework_TestCase
+class TDirectoryCacheDependencyTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/unit/Caching/TFileCacheDependencyTest.php b/tests/unit/Caching/TFileCacheDependencyTest.php
index 6b61aed6..b4bc89d3 100644
--- a/tests/unit/Caching/TFileCacheDependencyTest.php
+++ b/tests/unit/Caching/TFileCacheDependencyTest.php
@@ -1,11 +1,9 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit2.php');
-
/**
* @package System.Caching
*/
-class TFileCacheDependencyTest extends PHPUnit2_Framework_TestCase
+class TFileCacheDependencyTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
diff --git a/tests/unit/Collections/TMapTest.php b/tests/unit/Collections/TMapTest.php
index c6a2172c..81062855 100644
--- a/tests/unit/Collections/TMapTest.php
+++ b/tests/unit/Collections/TMapTest.php
@@ -1,7 +1,7 @@
<?php
require_once dirname(__FILE__).'/../phpunit.php';
-class MapItem {
+class TMapTest_MapItem {
public $data='data';
}
@@ -14,9 +14,9 @@ class TMapTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->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 @@
<?php
-require_once dirname(__FILE__).'/../phpunit.php';
-class MapItem {
+class TPriorityMapTest_MapItem {
public $data='data';
}
@@ -16,11 +15,11 @@ class TPriorityMapTest extends PHPUnit_Framework_TestCase {
public function setUp() {
// test that TPriorityMap complies with TMap
$this->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 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit2.php');
-
Prado::using('System.Data.*');
-define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
+if(!defined('TEST_DB_FILE'))
+ define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
/**
* @package System.Data.PDO
*/
-class TDbCommandTest extends PHPUnit2_Framework_TestCase
+class TDbCommandTest extends PHPUnit_Framework_TestCase
{
private $_connection;
diff --git a/tests/unit/Data/TDbConnectionTest.php b/tests/unit/Data/TDbConnectionTest.php
index 6c1e71aa..8f6ff34f 100644
--- a/tests/unit/Data/TDbConnectionTest.php
+++ b/tests/unit/Data/TDbConnectionTest.php
@@ -1,16 +1,16 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit2.php');
-
Prado::using('System.Data.*');
-define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
-define('TEST_DB_FILE2',dirname(__FILE__).'/db/test2.db');
+if(!defined('TEST_DB_FILE'))
+ define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
+if(!defined('TEST_DB_FILE2'))
+ define('TEST_DB_FILE2',dirname(__FILE__).'/db/test2.db');
/**
* @package System.Data.PDO
*/
-class TDbConnectionTest extends PHPUnit2_Framework_TestCase
+class TDbConnectionTest extends PHPUnit_Framework_TestCase
{
private $_connection1;
private $_connection2;
diff --git a/tests/unit/Data/TDbDataReaderTest.php b/tests/unit/Data/TDbDataReaderTest.php
index 9d61a330..98aa0385 100644
--- a/tests/unit/Data/TDbDataReaderTest.php
+++ b/tests/unit/Data/TDbDataReaderTest.php
@@ -1,10 +1,9 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit2.php');
-
Prado::using('System.Data.*');
-define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
+if(!defined('TEST_DB_FILE'))
+ define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
class FooRecord extends TComponent
{
@@ -31,7 +30,7 @@ class FooRecord extends TComponent
/**
* @package System.Data.PDO
*/
-class TDbDataReaderTest extends PHPUnit2_Framework_TestCase
+class TDbDataReaderTest extends PHPUnit_Framework_TestCase
{
private $_connection;
diff --git a/tests/unit/Data/TDbTransactionTest.php b/tests/unit/Data/TDbTransactionTest.php
index 4cfd2943..c608bce1 100644
--- a/tests/unit/Data/TDbTransactionTest.php
+++ b/tests/unit/Data/TDbTransactionTest.php
@@ -1,10 +1,9 @@
<?php
-require_once(dirname(__FILE__).'/../phpunit.php');
-
Prado::using('System.Data.*');
-define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
+if(!defined('TEST_DB_FILE'))
+ define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');
/**
* @package System.Data.PDO
diff --git a/tests/unit/Prado.php b/tests/unit/Prado.php
index 6368a086..d99a4b17 100644
--- a/tests/unit/Prado.php
+++ b/tests/unit/Prado.php
@@ -146,5 +146,3 @@ class Prado extends PradoBase {
}
}
-
-?>
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 @@
<?php
require_once dirname(__FILE__).'/../phpunit.php';
-require_once 'PHPUnit/Extensions/OutputTestCase.php';
Prado::using('System.Web.THttpResponse');
diff --git a/tests/unit/Xml/TRssFeedDocumentTest.php b/tests/unit/Xml/TRssFeedDocumentTest.php
deleted file mode 100644
index 6d96444a..00000000
--- a/tests/unit/Xml/TRssFeedDocumentTest.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-require_once dirname(__FILE__).'/../phpunit.php';
-
-Prado::using('System.Xml.TRssFeedDocument');
-
-/**
- * @package System.Xml.TRssFeedDocument
- */
-class TRssFeedDocumentTest extends PHPUnit_Framework_TestCase {
-
- public function testConstruct() {
- $feed = new TRssFeedDocument();
- self::assertEquals('0.91', $feed->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