3

モデル (codeigniter フレームワーク) に、Cookie に 2 つの値を設定する関数があります。

同じことの単体テストを作成する必要があります。この場合、両方の Cookie が設定されていることを確認するために、2 つの assertEqual() 関数を呼び出す必要があります。

同じテストケース内で2つのアサート関数を呼び出すというアイデアはありますか?

4

1 に答える 1

1
// 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

于 2012-07-18T18:44:07.963 に答える