cvs: pear /Validate/tests credit_card.php
| From: | Ondrej Jombik | Date: | Thu, 21 Nov 2002 13:23:31 +0000 |
| Subject: | cvs: pear /Validate/tests credit_card.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7509@lists.php.net to get a copy of this message | ||
nepto Thu Nov 21 08:23:31 2002 EDT
Added files:
/pear/Validate/tests credit_card.php
Log:
Credit card testing file.
Index: pear/Validate/tests/credit_card.php
+++ pear/Validate/tests/credit_card.php
<?php
require_once 'Validate.php';
function test($res, $expected) {
static $no = 1;
if ($res !== $expected) {
echo "test $no failed\n";
}
$no++;
}
// 1
test(Validate::creditCard(0), false);
// 2
test(Validate::creditCard(-1), false);
// 3
test(Validate::creditCard('6762195515061813'), true);
// 4
test(Validate::creditCard('6762195515061814'), false);
// 5
test(Validate::creditCard(array('number' => '4405771709596026')), true);
// 6
test(Validate::creditCard('Big brother is watching you'), false);
?>