cvs: pear /Validate package_FI.xml /Validate/Validate FI.php /Validate/tests validate_FI_bikeLicensePlate.phpt validate_FI_carLicensePlate.phpt

From: Date: Thu, 05 Jul 2007 11:31:17 +0000
Subject: cvs: pear /Validate package_FI.xml /Validate/Validate FI.php /Validate/tests validate_FI_bikeLicensePlate.phpt validate_FI_carLicensePlate.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-47867@lists.php.net to get a copy of this message
janisto Thu Jul 5 11:31:17 2007 UTC Modified files: /pear/Validate/Validate FI.php /pear/Validate package_FI.xml /pear/Validate/tests validate_FI_bikeLicensePlate.phpt validate_FI_carLicensePlate.phpt Log: Prepare for release 0.4.0 beta

http://cvs.php.net/viewvc.cgi/pear/Validate/Validate/FI.php?r1=1.2&r2=1.3&diff_format=u Index: pear/Validate/Validate/FI.php diff -u pear/Validate/Validate/FI.php:1.2 pear/Validate/Validate/FI.php:1.3 --- pear/Validate/Validate/FI.php:1.2 Fri Jun 1 11:53:10 2007 +++ pear/Validate/Validate/FI.php Thu Jul 5 11:31:17 2007 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ // +----------------------------------------------------------------------+ -// | Copyright (c) 2006-2007 Jani Mikkonen | +// | Copyright (c) 2006-2007 Jani Mikkonen | // +----------------------------------------------------------------------+ // | This source file is subject to the New BSD license, That is bundled | // | with this package in the file LICENSE, and is available through | @@ -23,7 +23,7 @@ * @author Jani Mikkonen <jani@mikkonen.info> * @copyright 2006-2007 Jani Mikkonen * @license http://www.opensource.org/licenses/bsd-license.php New BSD - * @version CVS: $Id: FI.php,v 1.2 2007/06/01 11:53:10 janisto Exp $ + * @version CVS: $Id: FI.php,v 1.3 2007/07/05 11:31:17 janisto Exp $ * @link http://pear.php.net/package/Validate_FI */ @@ -48,7 +48,7 @@ * @category Validate * @package Validate_FI * @author Jani Mikkonen <jani@mikkonen.info> - * @copyright 2006 Jani Mikkonen + * @copyright 2006-2007 Jani Mikkonen * @license http://www.opensource.org/licenses/bsd-license.php New BSD * @version Release: @package_version@ * @link http://pear.php.net/package/Validate_FI @@ -129,9 +129,9 @@ /** * Validate Finnish car license plate number. * - * Format: AAA-XXX, CD-XXXX or C-XXXXX + * Format: AAA-XXX, CD-XXXX or C-XXXXX. First or only number cannot be zero. * - * AAA-XXX: AAA is 2-3 letters UPPERCASE A-Z and XXX is 1-3 numbers + * AAA-XXX: AAA is 2-3 letters UPPERCASE A-Z + ÅÄÖ and XXX is 1-3 numbers. * CD-XXXX: CD- and XXXX is 1-4 numbers (diplomat licence plate) * C-XXXXX: C- and XXXXX is 1-5 numbers (other tax-free diplomat licence plate) * @@ -158,15 +158,15 @@ */ function carLicensePlate($number){ // diplomat licence plate - if (preg_match("/^CD-[0-9]{1,4}$/", $number)) { + if (preg_match("/^CD-[1-9]{1}[0-9]{0,3}$/", $number)) { return true; } // other tax-free diplomat licence plate - if (preg_match("/^C-[0-9]{1,5}$/", $number)) { + if (preg_match("/^C-[1-9]{1}[0-9]{0,4}$/", $number)) { return true; } // regular licence plate - if (preg_match("/^[A-Z]{2,3}-[0-9]{1,3}$/", $number)) { + if (preg_match("/^[A-ZÅÄÖ]{2,3}-[1-9]{1}[0-9]{0,2}$/", $number)) { return true; } return false; @@ -177,9 +177,9 @@ /** * Validate Finnish motorbike license plate number. * - * Format: AAAXXX + * Format: AAAXXX. First or only number cannot be zero. * - * Where AAA is 2-3 letters UPPERCASE A-Z and XXX is 1-3 numbers. + * Where AAA is 2-3 letters UPPERCASE A-Z + ÅÄÖ and XXX is 1-3 numbers. * Letters and numbers are actually in separate lines. * * <code> @@ -204,7 +204,7 @@ * @link http://www.ake.fi/AKE/Rekisterointi/Suomen_rekisterikilvet/ */ function bikeLicensePlate($number){ - return (preg_match("/^[A-Z]{2,3}(\n)?[0-9]{1,3}$/", $number)) ? true : false; + return (preg_match("/^[A-ZÅÄÖ]{2,3}(\n)?[1-9]{1}[0-9]{0,2}$/", $number)) ? true : false; } // }}} http://cvs.php.net/viewvc.cgi/pear/Validate/package_FI.xml?r1=1.2&r2=1.3&diff_format=u Index: pear/Validate/package_FI.xml diff -u pear/Validate/package_FI.xml:1.2 pear/Validate/package_FI.xml:1.3 --- pear/Validate/package_FI.xml:1.2 Fri Jun 1 12:13:10 2007 +++ pear/Validate/package_FI.xml Thu Jul 5 11:31:17 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.4.11" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.6.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>Validate_FI</name> <channel>pear.php.net</channel> <summary>Validation class for Finland</summary> @@ -23,10 +23,10 @@ <email>jani@mikkonen.info</email> <active>yes</active> </lead> - <date>2007-06-01</date> + <date>2007-07-05</date> <version> - <release>0.3.0</release> - <api>0.3.0</api> + <release>0.4.0</release> + <api>0.4.0</api> </version> <stability> <release>beta</release> @@ -34,9 +34,9 @@ </stability> <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD</license> <notes> - - Minor changes in documentation + copyright - - Check Code fixes (Variable 'regs' is used before it was assigned.). - - Move to beta + - carLicensePlate(): Added new chars and first or only number cannot be zero. + - bikeLicensePlate(): Added new chars and first or only number cannot be zero. + - Added new unit tests. Thanks to Markku Uttula. </notes> <contents> <dir name="/"> @@ -72,6 +72,23 @@ <changelog> <release> <version> + <release>0.4.0</release> + <api>0.4.0</api> + </version> + <stability> + <release>beta</release> + <api>beta</api> + </stability> + <date>2007-07-05</date> + <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD</license> + <notes> + - carLicensePlate(): Added new chars and first or only number cannot be zero. + - bikeLicensePlate(): Added new chars and first or only number cannot be zero. + - Added new unit tests. Thanks to Markku Uttula. + </notes> + </release> + <release> + <version> <release>0.3.0</release> <api>0.3.0</api> </version> http://cvs.php.net/viewvc.cgi/pear/Validate/tests/validate_FI_bikeLicensePlate.phpt?r1=1.1&r2=1.2&diff_format=u Index: pear/Validate/tests/validate_FI_bikeLicensePlate.phpt diff -u pear/Validate/tests/validate_FI_bikeLicensePlate.phpt:1.1 pear/Validate/tests/validate_FI_bikeLicensePlate.phpt:1.2 --- pear/Validate/tests/validate_FI_bikeLicensePlate.phpt:1.1 Fri Mar 23 08:54:10 2007 +++ pear/Validate/tests/validate_FI_bikeLicensePlate.phpt Thu Jul 5 11:31:17 2007 @@ -2,7 +2,7 @@ validate_FI_bikeLicensePlate.phpt: Unit tests for bikeLicensePlate method 'Validate/FI.php' --FILE-- <?php -// $Id: validate_FI_bikeLicensePlate.phpt,v 1.1 2007/03/23 08:54:10 janisto Exp $ +// $Id: validate_FI_bikeLicensePlate.phpt,v 1.2 2007/07/05 11:31:17 janisto Exp $ // Validate test script $noYes = array('NO', 'YES'); require_once 'Validate/FI.php'; @@ -21,7 +21,12 @@ 'abc123', // NOK '0', // NOK '-1', // NOK - 'valid' // NOK + 'valid', // NOK + 'ÅÖÄ123', // OK + 'ÖÄ12', // OK + 'ABC0', // NOK + 'ABC01', // NOK + 'ABC012' // NOK ); echo "\nTest bikeLicensePlate\n"; @@ -47,3 +52,8 @@ 0: NO -1: NO valid: NO +ÅÖÄ123: YES +ÖÄ12: YES +ABC0: NO +ABC01: NO +ABC012: NO \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/Validate/tests/validate_FI_carLicensePlate.phpt?r1=1.1&r2=1.2&diff_format=u Index: pear/Validate/tests/validate_FI_carLicensePlate.phpt diff -u pear/Validate/tests/validate_FI_carLicensePlate.phpt:1.1 pear/Validate/tests/validate_FI_carLicensePlate.phpt:1.2 --- pear/Validate/tests/validate_FI_carLicensePlate.phpt:1.1 Fri Mar 23 08:54:10 2007 +++ pear/Validate/tests/validate_FI_carLicensePlate.phpt Thu Jul 5 11:31:17 2007 @@ -2,7 +2,7 @@ validate_FI_carLicensePlate.phpt: Unit tests for carLicensePlate method 'Validate/FI.php' --FILE-- <?php -// $Id: validate_FI_carLicensePlate.phpt,v 1.1 2007/03/23 08:54:10 janisto Exp $ +// $Id: validate_FI_carLicensePlate.phpt,v 1.2 2007/07/05 11:31:17 janisto Exp $ // Validate test script $noYes = array('NO', 'YES'); require_once 'Validate/FI.php'; @@ -31,7 +31,14 @@ 'c-12345', // NOK '0', // NOK '-1', // NOK - 'valid' // NOK + 'valid', // NOK + 'ÅÖÄ-123', // OK + 'ÖÄ-12', // OK + 'ABC-0', // NOK + 'ABC-01', // NOK + 'ABC-012', // NOK + 'CD-0234', // NOK + 'C-02345' // NOK ); echo "\nTest carLicensePlate\n"; @@ -67,3 +74,10 @@ 0: NO -1: NO valid: NO +ÅÖÄ-123: YES +ÖÄ-12: YES +ABC-0: NO +ABC-01: NO +ABC-012: NO +CD-0234: NO +C-02345: NO \ No newline at end of file
« previous php.pear.cvs (#47867) next »