示例#1
0
function calculateAge($yearOfBirth)
{
    expectsToBe($yearOfBirth, 'to be an integer > 1900 and <= current year', function ($arg) {
        return is_int($arg) && $arg > 1900 && $arg <= (int) date('Y');
    });
    return (int) date('Y') - $yearOfBirth;
}
示例#2
0
 function expectsCustomNegativeTest($arg1)
 {
     expectsToBe($arg1, 'a positive integer', function ($arg) {
         return is_int($arg) && $arg > 0;
     });
 }