[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-cvs
Subject:    [PEAR-CVS] =?utf-8?q?svn:_/pear2/Pyrus/trunk/tests/DER/_objectidentifier.phpt?=
From:       Helgi_Þormar_Þorbjörnsson <dufuz () php ! net>
Date:       2010-02-28 2:53:38
Message-ID: svn-dufuz-1267325618-295572-786764976 () svn ! php ! net
[Download RAW message or body]

dufuz                                    Sun, 28 Feb 2010 02:53:38 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=295572

Log:
Test exceptions

Changed paths:
    U   pear2/Pyrus/trunk/tests/DER/objectidentifier.phpt

Modified: pear2/Pyrus/trunk/tests/DER/objectidentifier.phpt
===================================================================
--- pear2/Pyrus/trunk/tests/DER/objectidentifier.phpt	2010-02-28 02:53:29 UTC (rev \
                295571)
+++ pear2/Pyrus/trunk/tests/DER/objectidentifier.phpt	2010-02-28 02:53:38 UTC (rev \
295572) @@ -5,6 +5,29 @@
 require __DIR__ . '/setup.php.inc';
 $test->assertEquals('06062a864886f70d', \
bin2hex($der->objectIdentifier('1.2.840.113549')->serialize()),  'RSA Object \
Identifier test'); +
+try {
+    // RSA Object Identifier test with invalid data input
+    $der->objectIdentifier(12840113549)->serialize();
+} catch (pear2\Pyrus\DER\Exception $e) {
+    $test->assertEquals('Object Identifier must be a string', $e->getMessage(), \
'error'); +}
+
+// Test by running without serialize (or else we do not catch the exception in the \
objectIdentifier call) +try {
+    // RSA Object Identifier test with data input missing delimiters
+    $der->objectIdentifier('12840113549');
+} catch (pear2\Pyrus\DER\Exception $e) {
+    $test->assertEquals('Object Identifier must be a period-delimited string of \
numbers', $e->getMessage(), 'error'); +}
+
+try {
+    // RSA Object Identifier test with data input missing delimiters
+    $der->objectIdentifier('12840113549')->serialize();
+} catch (pear2\Pyrus\DER\Exception $e) {
+    $test->assertEquals('The Object Identifier value can be no less than 4 numbers \
in a period-delimited string', $e->getMessage(), 'error'); +}
+
 ?>
 ===DONE===
 --EXPECT--



-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic