Skip to content

Instantly share code, notes, and snippets.

View BrendanKoral's full-sized avatar

Brendan Koral BrendanKoral

View GitHub Profile
@xbot
xbot / ShortageTest.php
Last active January 18, 2022 00:14
How to mock laravel DB facade。
DB::shouldReceive('table')->with('users as u')->once()->andReturnSelf();
DB::shouldReceive('where')->with('u.id', $user->id)->once()->andReturnSelf();
DB::shouldReceive('value')->with('u.favorites_shortages')->once()->andReturn($fakeOldShortages);
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE