You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
PHTML
57 lines
1.8 KiB
PHTML
16 years ago
|
<?php
|
||
|
// $Id: simpletest_test.php,v 1.8 2006/06/03 16:32:06 lastcraft Exp $
|
||
|
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'));
|
||
|
}
|
||
|
}
|
||
|
?>
|