Kohana에서 단순한 구현 방법
-
13-09-2019 - |
해결책
Kohana에서 SimpleTest_Controller를 만들었습니다
디렉토리 테스트에서 테스트를받습니다
define ( 'SIMPLE_TEST', '../tools/simpletest/');
require_once(SIMPLE_TEST . 'unit_tester.php');
require_once(SIMPLE_TEST . 'reporter.php');
require_once( SIMPLE_TEST . 'mock_objects.php');
class SimpleTest_Controller extends Controller {
function index() {
$this->runall();
}
function runall() {
$sDir = '../tests/';
$rDir = opendir( $sDir );
while ( $sFile = readdir( $rDir ) ) {
if ( $sFile != '.' && $sFile != '..' ) {
$this->run( $sFile );
}
}
}
function run ( $sTests ) {
$sDir = '../tests/' . $sTests .'/';
$rDir = opendir( $sDir );
$test = new GroupTest( $sTests );
while ( $sFile = readdir( $rDir ) ) {
if ( $sFile != '.' && $sFile != '..' && !preg_match('/~\d+~/', $sFile) ) {
include_once($sDir . $sFile);
$test->addTestCase( substr($sFile, 0, -4 ) );
}
}
$test->run( new HtmlReporter() );
}
}
전화해도됩니다 domain.com/simpletest
모든 것을 실행하거나 전화 할 수 있습니다 domain.com/simpletest/run/account
시험지에 회계사가있는 경우
제휴하지 않습니다 StackOverflow