svn: /pear2/Pyrus/trunk/tests/DER/ objectidentifier.phpt
| From: | Helgi Þormar Þorbjörnsson | Date: | Sun, 28 Feb 2010 02:53:38 +0000 |
| Subject: | svn: /pear2/Pyrus/trunk/tests/DER/ objectidentifier.phpt | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9217@lists.php.net to get a copy of this message | ||
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--