Warm tip: This article is reproduced from stackoverflow.com, please click
codeception phpunit

How to use PHPUnit assert methods in a Codeception functional test?

发布于 2020-11-15 17:36:16

I'm using Codeception for unit, functional, and acceptance tests of my Laravel 4 PHP application.

My unit tests look this:

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

My functional tests look like this:

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

But I also want to use PHPUnit assert methods in my functional tests. But when I try to, I get this error:

Call to undefined method ExampleCest::assertSame()

How do I use PHP assert methods in a Codeception functional test?

Questioner
mtmacdonald
Viewed
1
19k 2014-01-30 10:31

\PHPUnit_Framework_Assert::assertSame()