Skip to content

Instantly share code, notes, and snippets.

View acfatah's full-sized avatar
🚀
Looking for a new opportunity

Achmad F. Ibrahim acfatah

🚀
Looking for a new opportunity
View GitHub Profile
@acfatah
acfatah / parse-bash-arguments
Last active March 31, 2019 00:14
Examples how to parse bash command line arguments
#!/bin/bash
# An example script how to parse a bash arguments with command
# link: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
# Script version
SCRIPT_VERSION=0
# Help message
function usage() {
@acfatah
acfatah / PassportTestCase
Last active March 17, 2019 13:28
Laravel 5.8 unit testing with laravel/passport
<?php
// origin: https://gist.github.com/archy-bold/bd696e8ec84a7657b724523e07fd7a6c
namespace Tests;
use DB;
use DateTime;
use App\User;
use Laravel\Passport\ClientRepository;
$totalCorrect = 0;
for ($i = 1; $i < 22; i++) {
if (isset ($_POST['question-' . $i . '-answers']) && is_numeric($_POST['question-' . $i . '-answers'])) {
$totalCorrect += (int) $_POST['question-' . $i . '-answers'];
}
}

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()