cvs: pear /Validate package.xml /Validate/tests issn.php product_numbers.php

From: Date: Tue, 18 Jan 2005 02:20:52 +0000
Subject: cvs: pear /Validate package.xml /Validate/tests issn.php product_numbers.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-28644@lists.php.net to get a copy of this message
dufuz Mon Jan 17 21:20:52 2005 EDT Added files: /pear/Validate/tests issn.php product_numbers.php Modified files: /pear/Validate package.xml Log: add ISSN and production tests, update changelog http://cvs.php.net/diff.php/pear/Validate/package.xml?r1=1.31&r2=1.32&ty=u Index: pear/Validate/package.xml diff -u pear/Validate/package.xml:1.31 pear/Validate/package.xml:1.32 --- pear/Validate/package.xml:1.31 Tue Jan 11 15:37:52 2005 +++ pear/Validate/package.xml Mon Jan 17 21:20:52 2005 @@ -45,6 +45,7 @@ <date>2004-03-17</date> <notes> - Bug #2936, typo +- Bug #2879, Issn wrong validation - Better email validation - CS fixes - Splitted country and finance classes and credit card functions into their own sub packages of Validate @@ -53,7 +54,7 @@ - _check_control_number renamed to _checkControlNumber _get_control_number renamed to _getControlNumber _mult_weights renamed to _multWeights -- added email test +- added email, issn and product_numbers tests </notes> <filelist> <dir name="/"> @@ -62,6 +63,8 @@ <file>number.php</file> <file>date.php</file> <file>email.php</file> + <file>product_numbers.php</file> + <file>issn.php</file> </dir> <dir name="docs" role="doc"> <file>sample_multiple.php</file> http://cvs.php.net/co.php/pear/Validate/tests/issn.php?r=1.1&p=1 Index: pear/Validate/tests/issn.php +++ pear/Validate/tests/issn.php <?php require_once 'PHPUnit.php'; require 'Validate.php'; class Validate_ISSN_Test extends PHPUnit_TestCase { var $issn = array( '0366-3590' => true, '03663590' => true, '0004-6620' => true, '0394-6320' => true, '0395-7500' => true, '8675-4548' => true, '4342-7677' => true, '4545-6569' => true, '3434-6872' => true, '9685-5656' => false, '8768-4564' => false, '4564-7786' => false, '2317-8472' => false, '8675-4543' => false, '4342-7675' => false ); function Validate_ISSN_Test($name) { $this->PHPUnit_TestCase($name); } function testISSN() { foreach ($this->issn as $issn => $expected_result) { $r = Validate::issn($issn); $this->assertEquals($r, $expected_result); } } } // runs the tests $suite = new PHPUnit_TestSuite('Validate_ISSN_Test'); $result = PHPUnit::run($suite); // prints the tests echo $result->toString(); ?> http://cvs.php.net/co.php/pear/Validate/tests/product_numbers.php?r=1.1&p=1 Index: pear/Validate/tests/product_numbers.php +++ pear/Validate/tests/product_numbers.php <?php require_once 'PHPUnit.php'; require 'Validate.php'; class Validate_Trade_Test extends PHPUnit_TestCase { var $ucc12 = array( '614141210220' => true, '614141210221' => false ); var $ean8 = array( '43210121' => true, '43210128' => false ); var $ean13 = array( '1014541210223' => true, '1014541210228' => false ); var $ean14 = array( '91014541210226' => true, '91014541210221' => false ); var $sscc = array( '106141411928374657' => true, '106141411928374651' => false ); function Validate_Trade_Test($name) { $this->PHPUnit_TestCase($name); } function testUCC12() { foreach ($this->ucc12 as $ucc12 => $expected_result) { $r = Validate::ucc12($ucc12); $this->assertEquals($r, $expected_result); } } function testEAN8() { foreach ($this->ean8 as $ean8 => $expected_result) { $r = Validate::ean8($ean8); $this->assertEquals($r, $expected_result); } } function testEAN13() { foreach ($this->ean13 as $ean13 => $expected_result) { $r = Validate::ean13($ean13); $this->assertEquals($r, $expected_result); } } function testEAN14() { foreach ($this->ean14 as $ean14 => $expected_result) { $r = Validate::ean14($ean14); $this->assertEquals($r, $expected_result); } } function testSSCC() { foreach ($this->sscc as $sscc => $expected_result) { $r = Validate::sscc($sscc); $this->assertEquals($r, $expected_result); } } } // runs the tests $suite = new PHPUnit_TestSuite('Validate_Trade_Test'); $result = PHPUnit::run($suite); // prints the tests echo $result->toString(); ?>

« previous php.pear.cvs (#28644) next »