What I use
- linux(ubuntu)
- phalcon 3.4.0
- phalcon/incubator 3.4.3
- phpunit 7.5.0
- mockery/mockery 1.2.0
what I want to realize
I want to implement unittest for phalcon queryBuilder.
I know how to set the return value by myself like this.
$userMock->shouldReceive('columns') ->andReturn(~~~~);
but I would like to know how to automatically return the results after passing the data.
Code to be tested
class UserController extends \Base\Controlelr {
        public function points Action ()
        {
                .
                .
                .
                $columns = [
                        'User.userName',
                        'Point.userPoint',
                    ];
                    $result = \User::query()
                        ->columns($columns)
                        ->innerJoin('Points', 'Points.userId = User.id')
                        ->where('User.roleId = '10')
                        ->andWhere("User.join >= '{$startOfMonth}'")
                        ->andWhere("User.join < '{$startOfNextMonth}'")
                        ->execute();
                .
                .
                .
        }
    }