/
UnitTest.php
60 lines (49 loc) · 1.15 KB
/
UnitTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require_once 'Autoload.php';
// same thing as JrMnt, but no comments.
// I kind of find them really distracting.
class UnitTest //extends TestRunner
{
public function setUp()
{
}
public function tearDown()
{
}
public function skip($message = null)
{
throw new SkippedTestException($message);
}
public function pass($message = null)
{
throw new PassedTestException($message);
}
public function fail($message = null)
{
throw new FailedTestException($message);
}
public function should($boolean)
{
if (!($boolean)) {
throw new FailedTestException();
}
}
public function shouldnt($boolean)
{
if ($boolean) {
throw new FailedTestException();
}
}
public function shouldBeEqual($one, $other)
{
if ($one != $other) {
throw new FailedTestException("$one does not equal $other");
}
}
public function shouldBeIdentical($one, $other)
{
if ($one !== $other) {
throw new FailedTestException("$one is not identical to $other");
}
}
}