gpt4 book ai didi

phpunit - 在simpletest测试用例中调用两个assert函数

转载 作者:行者123 更新时间:2023-12-04 18:39:50 25 4
gpt4 key购买 nike

我的模型(codeigniter框架)中有一个函数,该函数在cookie中设置两个值。

我需要编写相同的单元测试。因此,在这种情况下,我需要调用两个assertEqual()函数以确保同时设置了两个cookie。

是否有人想在同一测试用例中调用两个assert函数?

最佳答案

// For example
public function testMyTest()
{
$foo = 'test';
$this->assertTrue(is_string($foo));
$this->assertEquals('test', $foo);
$this->assertEquals(4, strlen($foo));
}


查看文件:: http://www.phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html

关于phpunit - 在simpletest测试用例中调用两个assert函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11080797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com