本文整理汇总了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();
}