Avoid NPE for "mark occurences"
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestCase.java
index 7812b67..5f3a8ed 100644 (file)
@@ -1,18 +1,16 @@
-/*
- * Created on Jul 31, 2004
+/*************************************************************************
+ * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
  *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
+ * Plugin for PHP unit Testing.
+ * www.phpeclipse.de
+ * 
+ *************************************************************************/
+
+
 package net.sourceforge.phpeclipse.phpunit.testpool;
 
 
-/**
- * @author Ali Echihabi
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
 public class TestCase {
 
        public static final String PASS = "PASS";
@@ -21,6 +19,11 @@ public class TestCase {
 
 
        private TestSuite parentSuite;
+       private String testName;
+       private String testID;
+       private String verdict;
+       private String parentTestSuiteName;
+       
        
        
 
@@ -28,16 +31,14 @@ public class TestCase {
         * @param testName
         * @param testID
         */
-       public TestCase(String testName, String testID) {
+       public TestCase(String testID, String testName, String parentTestSuiteName) {
                
                this.testName = testName;
                this.testID = testID;
+               this.parentTestSuiteName = parentTestSuiteName;
        }
 
 
-       String testName;
-       String testID;
-       String verdict;
 
        /**
         * @return
@@ -65,8 +66,11 @@ public class TestCase {
         */
        public void setTestID(String string) {
                testID = string;
+               
        }
 
+
+
        /**
         * @param string
         */
@@ -80,10 +84,11 @@ public class TestCase {
        public void setVerdict(String string) {
                verdict = string;
                
+               if(isFailure())
+                       parentSuite.setHasFailure();
+               if(isError())
+                       parentSuite.setHasError();
                
-               
-               
-                       
        }
 
        /**
@@ -91,6 +96,7 @@ public class TestCase {
         */
        public void setParentSuite(TestSuite suite) {
                this.parentSuite = suite;
+               suite.setName(parentTestSuiteName);
                
        }