| @@ 39-60 (lines=22) @@ | ||
| 36 | $xml = simplexml_load_string('<form><field name="url1" /> |
|
| 37 | <field name="url2" schemes="gopher" /></form>'); |
|
| 38 | ||
| 39 | if ($xmlfield == '0') |
|
| 40 | { |
|
| 41 | if ($expected == 'false') |
|
| 42 | { |
|
| 43 | // Test fail conditions. |
|
| 44 | $this->assertThat( |
|
| 45 | $rule->test($xml->field[0], $url), |
|
| 46 | $this->isFalse(), |
|
| 47 | 'Line:' . __LINE__ . ' The rule should return' . $expected . '.' |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | if ($expected == 'true') |
|
| 52 | { |
|
| 53 | // Test pass conditions. |
|
| 54 | $this->assertThat( |
|
| 55 | $rule->test($xml->field[0], $url), |
|
| 56 | $this->isTrue(), |
|
| 57 | 'Line:' . __LINE__ . ' The rule should return' . $expected . '.' |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | if ($xmlfield == '1') |
|
| 63 | { |
|
| @@ 62-83 (lines=22) @@ | ||
| 59 | } |
|
| 60 | } |
|
| 61 | ||
| 62 | if ($xmlfield == '1') |
|
| 63 | { |
|
| 64 | if ($expected == 'false') |
|
| 65 | { |
|
| 66 | // Test fail conditions. |
|
| 67 | $this->assertThat( |
|
| 68 | $rule->test($xml->field[1], $url), |
|
| 69 | $this->isFalse(), |
|
| 70 | 'Line:' . __LINE__ . ' The rule should return' . $expected . '.' |
|
| 71 | ); |
|
| 72 | } |
|
| 73 | ||
| 74 | if ($expected == 'true') |
|
| 75 | { |
|
| 76 | // Test pass conditions. |
|
| 77 | $this->assertThat( |
|
| 78 | $rule->test($xml->field[1], $url), |
|
| 79 | $this->isTrue(), |
|
| 80 | 'Line:' . __LINE__ . ' The rule should return' . $expected . '.' |
|
| 81 | ); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|