温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - How to use PHPUnit assert methods in a Codeception functional test?
codeception phpunit

其他 - 如何在Codeception功能测试中使用PHPUnit断言方法?

发布于 2021-04-17 09:18:51

我正在使用Codeception进行Laravel 4 PHP应用程序的单元,功能和验收测试。

我的单元测试看起来是这样的:

use Codeception\Util\Stub;
class ExampleTest extends \Codeception\TestCase\Test 
{
 public function testExample()
 {
  $example = true;
  $this->assertSame($example, true);
 }
}

我的功能测试如下:

use \TestGuy;
class ExampleCest
{
 public function example(TestGuy $I)
 { 
  $I->amOnPage('/auth/login');
  $I->see('Sign in');
 }
}

但是我也想在功能测试中使用PHPUnit断言方法。但是,当我尝试这样做时,出现以下错误:

调用未定义的方法ExampleCest :: assertSame()

如何在Codeception功能测试中使用PHP断言方法?

查看更多

提问者
mtmacdonald
被浏览
0
19k 2014-01-30 10:31

\PHPUnit_Framework_Assert::assertSame()