Skip to content

Consider to use $this instead of $ctx argument #4

@fesor

Description

@fesor

I know that it will break compability wth php5.3 but hey... php5.3 is no longer supported.

Example:

describe('User Database', function () {
    foreach(range(1,5) as $repetition) {
        it('should insert a user', function (){
            $user = $this->db->findOne([
                'username' => $this->username;
            ]);
            expect($user)->to->have->length(1);
        });

        it('should not accumulate users', function (){
            $users = $this->db->find();
            expect($users)->to->have->length(1);
        });
    }
    // ...
}

This will allow to add mock injection into closures based on typehint (see phpspec implementation for example).

    before_all(function (Database $databaseMock) {
        $this->db = $databaseMock;
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions