* 測試返回值是數組類型
*/
public function testReturnArray()
{
// 實際情況把$result賦值為被測試方法或函數
$result = array('test' => 'hello');
// 實際情況把'test'換為要測試的鍵名稱
$this->assertArrayHasKey('test', $result);
}
/**
* 測試返回值是對象類型
*/
public function testReturnObject()
{
// 實際情況把$this換為期望的對象
$expected = $this;
// 實際情況把$this換為被測試方法或函數
$result = $this;
$this->assertSame($expected, $result);
}
}
?>
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/