blob: bf98d9748c32c1f53ce26dfd6d49bf5ba0bfab55 (
plain)
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
|
<?php
// $Id: simpletest_test.php 1505 2007-04-30 23:39:59Z lastcraft $
require_once(dirname(__FILE__) . '/../autorun.php');
require_once(dirname(__FILE__) . '/../simpletest.php');
SimpleTest::ignore('ShouldNeverBeRunEither');
class ShouldNeverBeRun extends UnitTestCase {
function testWithNoChanceOfSuccess() {
$this->fail('Should be ignored');
}
}
class ShouldNeverBeRunEither extends ShouldNeverBeRun { }
class TestOfStackTrace extends UnitTestCase {
function testCanFindAssertInTrace() {
$trace = new SimpleStackTrace(array('assert'));
$this->assertEqual(
$trace->traceMethod(array(array(
'file' => '/my_test.php',
'line' => 24,
'function' => 'assertSomething'))),
' at [/my_test.php line 24]');
}
}
class DummyResource { }
class TestOfContext extends UnitTestCase {
function testCurrentContextIsUnique() {
$this->assertReference(
SimpleTest::getContext(),
SimpleTest::getContext());
}
function testContextHoldsCurrentTestCase() {
$context = &SimpleTest::getContext();
$this->assertReference($this, $context->getTest());
}
function testResourceIsSingleInstanceWithContext() {
$context = &new SimpleTestContext();
$this->assertReference(
$context->get('DummyResource'),
$context->get('DummyResource'));
}
function testClearingContextResetsResources() {
$context = &new SimpleTestContext();
$resource = &$context->get('DummyResource');
$context->clear();
$this->assertClone($resource, $context->get('DummyResource'));
}
}
?>
|