Added "Toggle PHP Breakpoint" to left Editor ruler
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestCase.java
1 /*************************************************************************
2  * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
3  *
4  * Plugin for PHP unit Testing.
5  * www.phpeclipse.de
6  * 
7  *************************************************************************/
8
9
10 package net.sourceforge.phpeclipse.phpunit.testpool;
11
12
13  
14 public class TestCase {
15
16         public static final String PASS = "PASS";
17         public static final String FAIL = "FAIL";
18         public static final String ERROR = "ERROR";
19
20
21         private TestSuite parentSuite;
22         private String testName;
23         private String testID;
24         private String verdict;
25         private String parentTestSuiteName;
26         
27         
28         
29
30         /**
31          * @param testName
32          * @param testID
33          */
34         public TestCase(String testID, String testName, String parentTestSuiteName) {
35                 
36                 this.testName = testName;
37                 this.testID = testID;
38                 this.parentTestSuiteName = parentTestSuiteName;
39         }
40
41
42
43         /**
44          * @return
45          */
46         public String getTestID() {
47                 return testID;
48         }
49
50         /**
51          * @return
52          */
53         public String getTestName() {
54                 return testName;
55         }
56
57         /**
58          * @return
59          */
60         public String getVerdict() {
61                 return verdict;
62         }
63
64         /**
65          * @param string
66          */
67         public void setTestID(String string) {
68                 testID = string;
69                 
70         }
71
72
73
74         /**
75          * @param string
76          */
77         public void setTestName(String string) {
78                 testName = string;
79         }
80
81         /**
82          * @param string
83          */
84         public void setVerdict(String string) {
85                 verdict = string;
86                 
87                 if(isFailure())
88                         parentSuite.setHasFailure();
89                 if(isError())
90                         parentSuite.setHasError();
91                 
92         }
93
94         /**
95          * @param suite
96          */
97         public void setParentSuite(TestSuite suite) {
98                 this.parentSuite = suite;
99                 suite.setName(parentTestSuiteName);
100                 
101         }
102
103         /**
104          * @return
105          */
106         public Object getParentSuite() {
107                 
108                 return parentSuite;
109         }
110
111         /**
112          * @return
113          */
114         public boolean isError() {
115                 
116                 return getVerdict().equals(TestCase.ERROR);
117         }
118
119         /**
120          * @return
121          */
122         public boolean isFailure() {
123                 
124                 return getVerdict().equals(TestCase.FAIL);
125                 
126         }
127
128         /**
129          * @return
130          */
131         public boolean isPass() {
132                 
133                 return getVerdict().equals(TestCase.PASS);
134
135         }
136
137 }