V
V
Vocler2019-07-12 18:32:53
Yii
Vocler, 2019-07-12 18:32:53

What is the meaning of assert_that in this context?

In Yii2 standard tests, I saw such a test

public function testFindUserByAccessToken()
    {
        expect_that($user = User::findIdentityByAccessToken('100-token'));
        expect($user->username)->equals('admin');

        expect_not(User::findIdentityByAccessToken('non-existing'));        
    }

Specifically, I was interested in the line
expect_that($user = User::findIdentityByAccessToken('100-token'));

Why is expect_that() used in this case? Why can't you just do
$user = User::findIdentityByAccessToken('100-token');

As far as I understand the essence of expect_that () is that if false is passed to it, the test ends with an error. But in the above example, the variable $user is passed to it.
Do I understand correctly that the point is that the test would fail if User::findIdentityByAccessToken('100-token') returns false?
And in general, where can I find a reference for expect, expect_that, etc.? It 's not on https://codeception.com/docs/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question