Laravel 断言完整列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27998642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:43:07  来源:igfitidea点击:

Laravel assertions full list

testinglaravellaravel-4

提问by user3702861

PHP Laravel framework provides assertion methods like ->assertTrue(), ->assertFalse()for unit testing. However, I cannot find a full list of them. Are they documented somewhere? If not, where can I find them in Laravel source?

PHP Laravel 框架提供了断言方法,例如->assertTrue(),->assertFalse()用于单元测试。但是,我找不到它们的完整列表。他们在某处记录了吗?如果没有,我在哪里可以在 Laravel 源中找到它们?

回答by lukasgeiter

Sure. Your test cases all should extend Illuminate\Foundation\Testing\TestCase. This class uses the Illuminate\Foundation\Testing\AssertTrait. Those are all the Laravel specific assertions.

当然。你的测试用例都应该扩展Illuminate\Foundation\Testing\TestCase。这个类使用Illuminate\Foundation\Testing\AssertTrait. 这些都是 Laravel 特定的断言。

View on github

在github上查看

However assertTrueand assertFalseare both part of PHPUnit itself. You can find a list of all PHPUnit assertions on the official website

但是,assertTrueassertFalse都是 PHPUnit 本身的一部分。您可以在官方网站上找到所有 PHPUnit 断言的列表