Skip to content

PHPUnit Assertions #5002

@johannesschobel

Description

@johannesschobel

Dear @DavertMik and community,

I am trying to migrate my tests from PHPUnit to Codeception CESTs because of its awesome functional and acceptance tests (:+1: ). However, i recently stumbled upon the following issue - maybe you can help me with this?

Consider the following minimal example:

class UserManagerCest 
{
    /**
     * @param UnitTester $I
     */
    public function test_if_only_users_are_returned(UnitTester $I)
    {
        $users = ... // get all users from the database here

        $I->assertContainsOnlyInstancesOf(
            User::class,
            $users
        );
    }

However, this fails, because the UnitTester does not inherit the required assertContainsOnlyInstancesOf() method. Same with many other functions PHPUnit offers (cf. this link here)

What do you suggest to get these PHPUnit-based assertions? I need them because otherwise all my tests will fail, because I also heavily rely on the assertJson...() and other functions..

Thanks in advance for your time and effort,
Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions