PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Miguel Villase˝or  >  PHP Birthday To Age  >  test.php  >  Download  
File: test.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Birthday To Age
Calculate the age and other values from a birthday
Author: By
Last change:
Date: 1 year ago
Size: 1,006 bytes
 

Contents

Class file image Download
<?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";
}