new class to manage icons. Showing failures,etc on a test suite.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestSuite.java
index 9d565da..3c4562c 100644 (file)
@@ -18,6 +18,9 @@ public class TestSuite {
 
 
 
+       private boolean hasFailure;
+       private boolean isAllPass;
+       private boolean hasError;
        private Vector testCases; // current or actual.
        private Vector testSuites; // current or actual.
        private String name;
@@ -26,22 +29,7 @@ public class TestSuite {
        private int numTestCasesRunSoFar;
        TestSuite parent;
 
-       /**
-        * @param name
-        * @param testID
-        * @param testCount
-        */
-       public TestSuite(String name, String testID, int testCount) {
-               
-               this.parent = null;
-               this.id = testID;
-               this.name = name;
-               this.numTestCasesExpected = testCount;
-               
-               testCases = new Vector();
-               testSuites = new Vector();
-               
-       }
+
 
        /**
         * @param name
@@ -57,6 +45,10 @@ public class TestSuite {
        
                testCases = new Vector();
                testSuites = new Vector();
+               
+               hasError = false;
+               isAllPass = true;
+               hasFailure = false;
        }
                        
        public void addTestCase(TestCase test) {
@@ -203,4 +195,51 @@ public class TestSuite {
                testSuites = vector;
        }
 
+       /**
+        * @return
+        */
+       public boolean hasError() {
+
+               return hasError;                
+
+       }
+       
+       public void setHasError() {
+               
+               if(hasError)
+                       return;
+                       
+               hasError = true;
+               
+               if(parent != null)
+                       parent.setHasError();
+       }
+
+
+       /**
+        * @return
+        */
+       public boolean hasFailure() {
+
+               return hasFailure;              
+
+       }
+       
+       public void setHasFailure() {
+               
+               if(hasFailure)
+                       return;
+                       
+               hasFailure = true;
+               
+               if(parent != null)
+                       parent.setHasFailure();
+       }
+       
+
+       public boolean isAllPass() {
+               
+               return !hasError() && !hasFailure();
+               
+       }       
 }