[英]Kohana 3 and SimpleTest using autorun.php
經過幾個小時的檢查,我發現了如何做
我的例子:
<?php
include_once ("../../test_index.php");
include_once ("../simpletest/autorun.php");
class kohana_init_test extends UnitTestCase
{
function testTrue()
{
$this->assertTrue(true);
}
function testWelcome()
{
$response = Request::factory('main/index')->execute()->response;
$this->assertEqual($response->content, 'testing');
}
}
?>
一些注意事項:$ response變量取決於您使用的是View還是純文本輸出。 如果使用模板控制器或視圖,則$ response是用於呈現內容的視圖。 視圖中的變量可用,如上所示(變量內容在視圖內部定義)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.