本文整理匯總了PHP中TestController::index方法的典型用法代碼示例。如果您正苦於以下問題:PHP TestController::index方法的具體用法?PHP TestController::index怎麽用?PHP TestController::index使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TestController
的用法示例。
在下文中一共展示了TestController::index方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: runIndex
public function runIndex($searchValue, $formInput, $returnValue, $returnValue2 = null, $returnValue3 = null)
{
Input::replace($formInput);
$controller = new TestController();
$view = $controller->index();
$tests = $view->getData()['testSet'];
if (isset($returnValue3)) {
$field3 = $returnValue3;
$field2 = $returnValue2;
} elseif (isset($returnValue2)) {
$field2 = $returnValue2;
}
$field = $returnValue;
if (is_numeric($searchValue) && $field == 'specimen_id' | $field == 'visit_id') {
if ($searchValue == '0') {
$this->assertEquals($searchValue, count($tests));
} else {
$this->assertGreaterThanOrEqual(1, count($tests));
}
} else {
foreach ($tests as $key => $test) {
if (isset($field3)) {
$this->assertEquals($searchValue, $test->{$field}->{$field2}->{$field3});
} elseif (isset($field2)) {
$this->assertEquals($searchValue, $test->{$field}->{$field2});
} else {
$this->assertEquals($searchValue, $test->{$field});
}
}
}
}
示例2: testControllerFlash
function testControllerFlash()
{
session_unset();
$controller = new Controller();
# sets the ceva from the flash to altceva
$test = new TestController();
$this->assertTrue(empty($test->flash));
$test->index();
$this->assertEqual($test->flash["ceva"], "altceva");
# calls the destruct method that puts the flash into the session
unset($test);
# reinit test
$test = new TestController();
$this->assertEqual($test->flash["ceva"], "altceva");
$test->index();
$test->flash["altceva"] = "ceva";
$this->assertEqual($test->flash["ceva"], "altceva");
$this->assertEqual($test->flash["altceva"], "ceva");
# the flash remainds unmodified
unset($test);
# the flash is now destroyed
$test = new TestController();
$this->assertEqual($test->flash["altceva"], "ceva");
session_destroy();
}