corrected the number of tests expected in progress view. Added toolbar actions to...
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestPool.java
index 008cb3d..a8e5e6c 100644 (file)
@@ -31,8 +31,7 @@ public class TestPool {
        public TestPool(String rootTitle) {
                
                tests = new HashMap();
-               root = new TestSuite(rootTitle, "-1", 0);
-               
+               root = null;            
                currentTestSuite = root;
                
        }
@@ -62,11 +61,19 @@ public class TestPool {
         */
        public void addTestSuite(TestSuite suite) {
        
-       //add as sibling
-               currentTestSuite.addTestSuite(suite);
-               suite.setParent(currentTestSuite);
-
-               currentTestSuite = suite;
+       
+       if(root == null) {
+               root = suite;
+       } 
+       else {
+       
+               //add as sibling        
+                       currentTestSuite.addTestSuite(suite);
+                       suite.setParent(currentTestSuite);
+
+       }       
+       
+               currentTestSuite = suite;       
        }
 
        /**
@@ -107,22 +114,28 @@ public class TestPool {
        
        }
 
-       private int countSuiteExpectedTests(TestSuite suite) {
-               
-               int total = 0;
-               
-               total += suite.getNumTestCasesExpected();
-               
-               for(int i = 0; i < suite.getTestSuites().size(); i++) 
-                       total += countSuiteExpectedTests((TestSuite) suite.getTestSuites().elementAt(i));
-               
-               return total;
-       
-       }
+// This recursion is done at the php side (report generation)
+
+//     private int countSuiteExpectedTests(TestSuite suite) {
+//             
+//             int total = 0;
+//             
+//             total += suite.getNumTestCasesExpected();
+//             
+//             for(int i = 0; i < suite.getTestSuites().size(); i++) 
+//                     total += countSuiteExpectedTests((TestSuite) suite.getTestSuites().elementAt(i));
+//             
+//             System.out.println("total: " + total);
+//             
+//             return total;
+//     
+//     }
 
        public int getNumTestsOverall() {
        
-               return countSuiteExpectedTests(root);
+               int total = root.getNumTestCasesExpected();
+               System.out.println("total: " + total);
+               return total;
                                
        }