Example #1
0
 function runTests($tests)
 {
     foreach ($tests as $test) {
         $result = Testing::runTest($test);
         print $_SERVER['argv'][0] . '::' . $test . ': ' . $result . "\n";
     }
 }
Example #2
0
<?php

if (!check_perms('users_mod')) {
    error(404);
}
View::show_header("Tests");
?>
<div class="header">
	<h2>Tests</h2>
	<?php 
TestingView::render_linkbox("classes");
?>
</div>

<div class="thin">
	<?php 
TestingView::render_classes(Testing::get_classes());
?>
</div>

<?php 
View::show_footer();
Example #3
0
    <div class="instruction"><b>คำชี้แจง:</b><?php 
echo $answer['session_name'];
?>
</div>
        <ul>
             <?php 
$session_id = $answer['session_id'];
$session_type = $answer['answer_type_id'];
$start = $answer['session_start'];
$end = $answer['session_end'];
$order = $answer['session_order'];
$student_id = Yii::app()->user->id;
$exam_id = $_GET['id'];
$testRecoed = new TestRecord();
$testing = new Testing();
$test_record_id = $testRecoed->getIdByStudentIdExamId($student_id, $exam_id);
for ($i = $start; $i <= $end; $i++) {
    $test = $testing->getAllTestingRecord($test_record_id, $i);
    if (is_array($test)) {
        $ans_1 = substr($test['selected'], 0, 1);
        $ans_2 = substr($test['selected'], 1, 1);
        $ans_3 = substr($test['selected'], 2, 1);
        $ans_4 = substr($test['selected'], 3, 1);
        $ans_5 = substr($test['selected'], 4, 1);
        $ans_6 = substr($test['selected'], 5, 1);
        $ans_7 = substr($test['selected'], 6, 1);
        $ans_8 = substr($test['selected'], 7, 1);
        $ans_9 = substr($test['selected'], 8, 1);
        $ans_10 = substr($test['selected'], 9, 1);
        $ans_11 = substr($test['selected'], 10, 1);
Example #4
0
        $this->super();
    }
}
class Testing extends Object
{
    function real_method()
    {
        return 'real_method';
    }
    protected function protected_method()
    {
        return 'protected_method';
    }
}
Testing::extend('Whoa', 'Dude');
$t = new Testing();
$t->testing();
echo "\n";
$t->testing2();
echo "\n";
echo $t->testing2();
echo "\n";
echo $t->send('testing') . ' guy';
echo "\n";
echo $t->respond_to('real_method');
echo "\n";
echo $t->respond_to('testing');
echo "\n";
echo $t->respond_to('protected_method');
echo "\n";
echo $t->respond_to('invalid');
Example #5
0
    /**
     * Renders class documentation stats
     */
    public static function render_missing_documentation($Classes)
    {
        ?>
		<table>
			<tr class="colhead">
				<td>
					Class
				</td>
				<td>
					Class documented
				</td>
				<td>
					Undocumented functions
				</td>
				<td>
					Documented functions
				</td>
			</tr>
<?php 
        foreach ($Classes as $Key => $Value) {
            $ClassComment = Testing::get_class_comment($Key);
            ?>
				<tr>
					<td>
						<?php 
            echo $Key;
            ?>
					</td>
					<td>
						<?php 
            echo !empty($ClassComment) ? "Yes" : "No";
            ?>
					<td>
						<?php 
            echo count(Testing::get_undocumented_methods($Key));
            ?>
					</td>
					<td>
						<?php 
            echo count(Testing::get_documented_methods($Key));
            ?>
					</td>
				</tr>
<?php 
        }
        ?>
		</table>
<?php 
    }
Example #6
0
<?php

enforce_login();
if (!check_perms('users_mod')) {
    error(404);
} else {
    Testing::init();
    if (!empty($_REQUEST['action'])) {
        switch ($_REQUEST['action']) {
            case 'class':
                include SERVER_ROOT . '/sections/testing/class.php';
                break;
            case 'ajax_run_method':
                include SERVER_ROOT . '/sections/testing/ajax_run_method.php';
                break;
            case 'comments':
                include SERVER_ROOT . '/sections/testing/comments.php';
                break;
            default:
                include SERVER_ROOT . '/sections/testing/classes.php';
                break;
        }
    } else {
        include SERVER_ROOT . '/sections/testing/classes.php';
    }
}
<ol class="breadcrumb">
    <li><a href="<?php 
print URL;
?>
">Кабінет</a></li>
    <li class="active">Перегляд результатів</li>
</ol>

</br></br>
    <?php 
$res = $this->list;
$test_name = $this->test_name;
require_once 'core/Testing/Testing.php';
$test_name_obj = new Testing();
?>

<div class="table-responsive">
    <table class="table table-condensed table-hover">
        <thead>
        <tr class="success">
            <th>Користувач</th>
            <th>Назва тесту</th>
            <th>Результат</th>
            <th>Дата</th>
        </tr>
        </thead>
        <tbody>
        <?php 
for ($i = 0; $i < count($res); $i++) {
    ?>
            <tr >
Example #8
0
    return true;
}
function test_fetch_by_search()
{
    $db = new TestSchema();
    $record = $db->resultset('TestTable')->search(array("charfield" => "Test Title"))->single();
    if (!$record instanceof Record) {
        return PEAR::raiseError('search()->single() did not return Record');
    }
    if ($record->id != 1) {
        return PEAR::raiseError('search() returned wrong ID: expected 1, got ' . $record->id);
    }
    return true;
}
# Test bug where ->data() did not load()
function test_get_data()
{
    $db = new TestSchema();
    $records = $db->resultset('TestTable')->all();
    $rec = $records[0];
    $data = $rec->data();
    if (!is_array($data)) {
        return PEAR::raiseError("data() did not return array");
    }
    if (!array_key_exists('charfield', $data)) {
        return PEAR::raiseError("data() did not return any data");
    }
    return true;
}
Testing::runTests(array("test_fetch_by_id", "test_fetch_all", "test_fetch_by_search", "test_get_data"));
Example #9
0
<?php

// Test class
class Testing extends V8Js
{
    public $foo = 'ORIGINAL';
    private $my_private = 'arf';
    // Should not show in JS side
    protected $my_protected = 'argh';
    // Should not show in JS side
    public function mytest($a, $b, $c = NULL)
    {
        var_dump(func_get_args());
    }
}
$a = new Testing();
echo $a;
try {
    $a->executeString("PHP.mytest(PHP.foo, PHP.my_private, PHP.my_protected);", "test7.js");
} catch (V8JsScriptException $e) {
    var_dump($e);
}
Example #10
0
        return PEAR::raiseError("create() did not seem to insert the right id.");
    }
    return true;
}
function test_delete()
{
    $db = new TestSchema();
    $data = array("id" => 2, "charfield" => "Test Insert", "textfield" => "Test text data", "datefield" => "2010-04-09", "dtfield" => "2010-04-09 22:25:00");
    $db->resultset('TestTable')->create($data);
    $data['id'] = 3;
    $db->resultset('TestTable')->create($data);
    $data['id'] = 4;
    $db->resultset('TestTable')->create($data);
    $records = $db->resultset('TestTable')->find(3)->all();
    $records[0]->delete();
    $records = $db->resultset('TestTable')->find(3)->all();
    if (count($records) != 0) {
        return PEAR::raiseError("We found record 3 - so it was not deleted.");
    }
    $records = $db->resultset('TestTable')->all();
    foreach ($records as $rec) {
        $rec->delete();
    }
    $records = $db->resultset('TestTable')->all();
    if (count($records) != 0) {
        return PEAR::raiseError("delete() did not seem to remove the records.");
    }
    return true;
}
Testing::runTests(array("test_insert", "test_delete"));
Example #11
0
<?php

if (!check_perms('users_mod')) {
    error(404);
}
$Class = $_GET['name'];
if (!empty($Class) && !Testing::has_class($Class)) {
    error("Missing class");
}
View::show_header("Tests", "testing");
?>
<div class="header">
	<h2><?php 
echo $Class;
?>
</h2>
	<?php 
echo TestingView::render_linkbox("class");
?>
</div>

<div class="thin">
	<?php 
echo TestingView::render_functions(Testing::get_testable_methods($Class));
?>
</div>

<?php 
View::show_footer();
Example #12
0
<?php

authorize();
if (!check_perms('users_mod')) {
    error(404);
}
$Class = $_POST['class'];
$Method = $_POST['method'];
$Params = json_decode($_POST['params'], true);
if (!empty($Class) && !empty($Method) && Testing::has_testable_method($Class, $Method)) {
    if (count($Params)) {
        $Results = call_user_func_array(array($Class, $Method), array_values($Params));
    } else {
        $Results = call_user_func(array($Class, $Method));
    }
    TestingView::render_results($Results);
}
Example #13
0
 function should_call_parent_method_using_method_super()
 {
     $t = new Testing();
     expects($t->super_test('sean'))->should_match('/Hello sean from super/');
 }
Example #14
0
<?php

if (!check_perms('users_mod')) {
    error(404);
}
View::show_header("Tests");
?>

<div class="header">
	<h2>Documentation</h2>
	<?php 
TestingView::render_linkbox("comments");
?>
</div>

<div class="thin">
	<?php 
TestingView::render_missing_documentation(Testing::get_classes());
?>
</div>

<?php 
View::show_footer();