diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-02 18:40:04 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-02 18:40:04 +0000 |
commit | 322bb9cd2be9e51422cb2b82684692e825c2bfb7 (patch) | |
tree | 1e8e75c1ff0c47d6eda9db114a13dfa2b83adf72 /vendors/simpletest/test/simpletest_test.php | |
parent | 4ffb02ad9c1b95013a0fbf97cefde827600ecc3f (diff) | |
download | elgg-322bb9cd2be9e51422cb2b82684692e825c2bfb7.tar.gz elgg-322bb9cd2be9e51422cb2b82684692e825c2bfb7.tar.bz2 |
Added simpletest and start of unit tests.
git-svn-id: http://code.elgg.org/elgg/trunk@3503 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'vendors/simpletest/test/simpletest_test.php')
-rwxr-xr-x | vendors/simpletest/test/simpletest_test.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/vendors/simpletest/test/simpletest_test.php b/vendors/simpletest/test/simpletest_test.php new file mode 100755 index 000000000..bf98d9748 --- /dev/null +++ b/vendors/simpletest/test/simpletest_test.php @@ -0,0 +1,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')); + } +} +?>
\ No newline at end of file |