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

From: Date: Fri, 21 Jan 2005 03:02:27 +0000
Subject: cvs: pear /Validate package_ISPN.xml /Validate/tests issn.php product_numbers.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-28717@lists.php.net to get a copy of this message
dufuz Thu Jan 20 22:02:27 2005 EDT Removed files: /pear/Validate/tests issn.php Modified files: /pear/Validate/tests product_numbers.php /pear/Validate package_ISPN.xml Log: moved ISSN test over to the product number test http://cvs.php.net/diff.php/pear/Validate/tests/product_numbers.php?r1=1.2&r2=1.3&ty=u Index: pear/Validate/tests/product_numbers.php diff -u pear/Validate/tests/product_numbers.php:1.2 pear/Validate/tests/product_numbers.php:1.3 --- pear/Validate/tests/product_numbers.php:1.2 Thu Jan 20 10:18:32 2005 +++ pear/Validate/tests/product_numbers.php Thu Jan 20 22:02:25 2005 @@ -2,7 +2,7 @@ require_once 'PHPUnit.php'; require 'Validate/ISPN.php'; -class Validate_Trade_Test extends PHPUnit_TestCase +class Validate_ISPN_Test extends PHPUnit_TestCase { var $ucc12 = array( '614141210220' => true, @@ -29,15 +29,34 @@ '106141411928374651' => false ); - function Validate_Trade_Test($name) + 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_ISPN_Test($name) { $this->PHPUnit_TestCase($name); } - function testUCC12() + function testISSN() { - foreach ($this->ucc12 as $ucc12 => $expected_result) { - $r = Validate_ISPN::ucc12($ucc12); + foreach ($this->issn as $issn => $expected_result) { + $r = Validate_ISPN::issn($issn); $this->assertEquals($r, $expected_result); } } @@ -66,6 +85,14 @@ } } + function testUCC12() + { + foreach ($this->ucc12 as $ucc12 => $expected_result) { + $r = Validate_ISPN::ucc12($ucc12); + $this->assertEquals($r, $expected_result); + } + } + function testSSCC() { foreach ($this->sscc as $sscc => $expected_result) { @@ -73,12 +100,11 @@ $this->assertEquals($r, $expected_result); } } - } // runs the tests -$suite = new PHPUnit_TestSuite('Validate_Trade_Test'); +$suite = new PHPUnit_TestSuite('Validate_ISPN_Test'); $result = PHPUnit::run($suite); // prints the tests echo $result->toString(); http://cvs.php.net/diff.php/pear/Validate/package_ISPN.xml?r1=1.1&r2=1.2&ty=u Index: pear/Validate/package_ISPN.xml diff -u pear/Validate/package_ISPN.xml:1.1 pear/Validate/package_ISPN.xml:1.2 --- pear/Validate/package_ISPN.xml:1.1 Thu Jan 20 10:18:32 2005 +++ pear/Validate/package_ISPN.xml Thu Jan 20 22:02:26 2005 @@ -30,7 +30,7 @@ <notes> - Split from Validate into independent package - CS fixes -- Added issn and product_numbers tests +- Added product_numbers test (tests for ISSN, EAN8, EAN13, EAN14, UCC12 and SSCC) </notes> <filelist> <dir name="/"> @@ -39,7 +39,6 @@ </dir> <dir name="tests" role="test"> <file>product_numbers.php</file> - <file>issn.php</file> </dir> </dir> </filelist>

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