<?php
# $HeadURL: https://svn.sigpipe.cz/r/trunk/testilence/tests/method.php $
# $Id: method.php 392 2007-02-11 19:24:38Z roman $
require_once dirname(__FILE__) . '/utils/case.php';
require_once dirname(__FILE__) . '/utils/reporter.php';
class tencetest_TestMethodTest extends tencetest_util_TestResultMatcher # {{{
{
protected function createTest($classname, $methodname) # {{{
{
return new Tence_TestMethod(
$this->ReflectionClass($classname)
, $this->ReflectionMethod($classname, $methodname)
);
} # }}}
protected function runAndAssert($classname, $methodname, array $expected) # {{{
{
return parent::runAndAssert(
$this->createTest($classname, $methodname)
, $expected
);
} # }}}
function f0() { return $this->assertTrue(0); }
function f1() { return $this->assertTrue(true); }
function fV() {}
function testSuccess() # {{{
{
return $this->runAndAssert(__CLASS__, 'f1', array(1, 0, 0, 0));
} # }}}
function testFailure() # {{{
{
return $this->runAndAssert(__CLASS__, 'f0', array(1, 1, 0, 0));
} # }}}
function testMethodThrows() # {{{
{
return $this->runAndAssert('tencetest_util_testMethodThrows', 'test', array(1, 0, 1, 0));
} # }}}
function testVoidMethod() # {{{
{
return $this->runAndAssert(__CLASS__, 'fV', array(1, 0, 0, 1));
} # }}}
function testSetUpThrows() # {{{
{
return $this->runAndAssert('tencetest_util_setUpThrows', 'test', array(1, 0, 0, 1));
} # }}}
function testTearDownThrows() # {{{
{
return $this->runAndAssert('tencetest_util_tearDownThrows', 'test', array(1, 0, 0, 1));
} # }}}
function testTestAndTearDownThrow() # {{{
{
return $this->runAndAssert('tencetest_util_testMethodAndTearDownThrow', 'test', array(1, 0, 0, 1));
} # }}}
function testSetUpAndTearDownThrow() # {{{
{
return $this->runAndAssert('tencetest_util_setUpAndTearDownThrow', 'test', array(1, 0, 0, 1));
} # }}}
} # }}}
class tencetest_TestMethodTests extends Tence_TestSuite # {{{
{
function __construct()
{
$this
->add(new tencetest_TestMethodTest)
;
}
} # }}}
# vim: et ts=4 sts=4 sw=4 fdm=marker cms=\ #\ %s