- Timestamp:
- 04/08/06 07:20:16 (3 years ago)
- Location:
- branches/magpie-hacks/MagpieTests
- Files:
-
- 1 added
- 3 modified
- 1 moved
-
README (modified) (1 diff)
-
TestCases/WellFormed (moved) (moved from branches/magpie-hacks/MagpieTests/TestCases/Wellformed)
-
rss_testConstants.inc (added)
-
rss_unitTest.inc (modified) (2 diffs)
-
runTests.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/magpie-hacks/MagpieTests/README
r1414 r1417 7 7 8 8 The Magpie unit test files will be stored in 9 http://svn.gregarius.net/svn/branches/magpie-pirate-tests 10 Please download that branch into this directory to and point 11 your web browser to runTests.php 9 http://svn.gregarius.net/svn/branches/magpie-hacks/ 10 Please download that branch and point your web browser to runTests.php 12 11 13 12 --Sameer -
branches/magpie-hacks/MagpieTests/rss_unitTest.inc
r1414 r1417 1 1 <?php 2 2 3 define('UNIT_TESTS_DIR_NAME', 'TestCases');3 require_once('rss_testConstants.inc'); 4 4 5 5 class RSSUnitTest { … … 15 15 16 16 function RSSUnitTest ($filename = "") { 17 $this->fileName = $filename; 18 $this->filePath = dirname(__FILE__) . DIR_SEP . 19 UNIT_TESTS_DIR_NAME . DIR_SEP . $this->fileName; 17 $this->fileName = strtr($filename, array("." => "")); // do not allow periods in the filename 18 $this->filePath = dirname(__FILE__) . DIR_SEP . $this->fileName . ".xml"; 20 19 } 21 20 -
branches/magpie-hacks/MagpieTests/runTests.php
r1414 r1417 19 19 20 20 require_once('../rss_fetch.inc'); 21 require_once('rss_testConstants.inc'); 21 22 require_once('rss_unitTest.inc'); 22 23 … … 27 28 $fetchTestUrl = $thisScriptBaseUrl . "fetchTest.php" ; 28 29 30 $wellFormedTestCategories = glob(UNIT_TESTS_DIR_NAME . DIR_SEP . WELLFORMED_UNIT_TESTS_DIR_NAME 31 . DIR_SEP . "*", GLOB_ONLYDIR); 32 $illFormedTestCategories = glob(UNIT_TESTS_DIR_NAME . DIR_SEP . ILLFORMED_UNIT_TESTS_DIR_NAME 33 . DIR_SEP . "*", GLOB_ONLYDIR); 29 34 30 $tests = array(); 31 $tests[] = "Wellformed/date/item_pubDate.xml"; 32 $tests[] = "Wellformed/rss/item_title.xml"; 35 $testCategories = array_merge($wellFormedTestCategories, $illFormedTestCategories); 33 36 34 37 35 38 echo "<html>\n<body>\n<table border=\"1\">\n"; 36 echo "<tr><th>Location</th><th>Description</th><th>Result</th>\n"; 37 foreach ($tests as $test) { 38 $_magpie_unitTest = new RSSUnitTest ($test); 39 echo "<tr>\n"; 40 echo "<td>\n" 41 ."<a href=\"" . $thisScriptBaseUrl . "TestCases/" . $test 42 ."\">" 43 .$test 44 ."</a>\n</td>\n" 45 ."<td>" 46 . htmlspecialchars($_magpie_unitTest->getDescription()) 47 ."</td>\n"; 39 //echo "<tr><th>Location</th><th>Description</th><th>Result</th>\n"; 40 foreach ($testCategories as $testCategory) { 41 $tests = glob($testCategory . DIR_SEP . "*.xml"); 42 echo "<tr><th colspan=\"2\">" . $testCategory . "</th></tr>\n"; 43 $testCategory = substr($testCategory, strlen(UNIT_TESTS_DIR_NAME . DIR_SEP 44 . ILLFORMED_UNIT_TESTS_DIR_NAME . DIR_SEP)); 48 45 49 $rss = fetch_rss($fetchTestUrl . "?testfile=" . $test); 50 echo "<td>\n"; 51 if (assert($_magpie_unitTest->getExpect())){ 52 echo "<font color=\"green\">Test Passed</font>"; 53 }else{ 54 echo "<font color=\"red\">Test Failed</font>"; 55 } 56 echo "</td>\n</tr>"; 46 foreach ($tests as $test) { 47 $test = substr($test, 0, - strlen(".xml")); // remove the .xml 48 $_magpie_unitTest = new RSSUnitTest ($test); 49 echo "<tr>\n"; 50 echo "<td>\n" 51 ."<a href=\"" . $thisScriptBaseUrl . "/" . $test . ".xml" 52 ."\">" 53 . htmlspecialchars($_magpie_unitTest->getDescription()) 54 ."</a>\n</td>\n" 55 ."</td>\n"; 56 57 $rss = fetch_rss($fetchTestUrl . "?testfile=" . $test); 58 echo "<td>\n"; 59 if (assert($_magpie_unitTest->getExpect())){ 60 echo "<font color=\"green\">Test Passed</font>"; 61 }else{ 62 echo "<font color=\"red\">Test Failed</font>"; 63 } 64 echo "</td>\n</tr>"; 65 } 57 66 } 58 67 echo "\n</table>\n</body>\n</html>";
