<?php /** * test.php * * @author Miguel Villaseñor Garduño * * This file defines some test to be executed form the command line * the first param recibed is the option and the second the date to be tested * */
require 'mkBirthday.php';
$option = $argv[1];
switch($option){ case 'construct': $calendario = new mkBirthday($argv[2]); echo $calendario->getDate(); break; case 'get-next': $calendario = new mkBirthday($argv[2]); $diferencia = $calendario->getDaysUntilNext(); echo $diferencia->m." months\n"; echo $diferencia->d." days\n"; echo $diferencia->h.' hours'; break; case 'get-age': $calendario = new mkBirthday($argv[2]); $age = $calendario->getAge(); echo $age; break; case 'is-birthday': $calendario = new mkBirthday($argv[2]); echo $calendario->isBirthday()?'true':'false'; break; default: echo "Function does not exist"; }
|