Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

Found the answer on stack overflow http://stackoverflow.com/questions/20701679/mocking-callbacks-in-laravel-4-mockery

I modified the mock code to the following

 DB::shouldReceive('connection')
        ->once()
        ->with('remote_mysql')
        ->andReturn(Mockery::mock('Illuminate\Database\Connection', function ($mock) use ($returnTimestamp)
            {
                $mock->shouldReceive('select')
                    ->once()
                    ->with('SELECT UNIX_TIMESTAMP()')
                    ->andReturn($returnTimestamp);
            })
        );
Last updated 2 years ago.

roberto0arruda liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.