A simple regex based exhaustive validator for PIN codes in India
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
india-pincode-regex/tests/SimpleTest.php

20 lines
503 B

<?php
use PIN\Validator as P;
use PHPUnit\Framework\TestCase;
class SimpleTest extends TestCase {
const PINS = ['244713', '560029', '560030', '110011'];
const INVALID_PINS = ['999999', '99999', '9999', '999', '99', '9', '111111', '2447131'];
public function testSamplePins() {
foreach(self::PINS as $pin) {
$this->assertTrue(P::validate($pin), "$pin should be valid");
}
foreach(self::INVALID_PINS as $pin) {
$this->assertFalse(P::validate($pin), "$pin should be invalid");
}
}
}