Update of /cvsroot/xmlrpccom/scriptserver/tests/php
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13869
Modified Files:
serializer.test.php unserializer.test.php
Log Message:
Modify to reflect changes to ScriptServer_Error
Index: serializer.test.php
===================================================================
RCS file: /cvsroot/xmlrpccom/scriptserver/tests/php/serializer.test.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** serializer.test.php 4 Oct 2004 21:59:38 -0000 1.7
--- serializer.test.php 8 Oct 2004 14:34:21 -0000 1.8
***************
*** 196,202 ****
function testError() {
$obj = new ScriptServer_Error();
! $obj->setError('TestError','testing');
$obj->foo = 'bar';
! $js = 'new Function("try { throw new TestError(\\\'testing\\\'); } catch(e) { function TestError(message) { this.name = \\\'TestError\\\'; this.message = message; }; TestError.prototype = new Error(); TestError.constructor = TestError; throw new TestError(\\\'testing\\\'); };");';
$res = ScriptServer_Serializer::serialize($obj);
$this->assertEqual($res,$js);
--- 196,202 ----
function testError() {
$obj = new ScriptServer_Error();
! $obj->setError(3000,'TestError','testing');
$obj->foo = 'bar';
! $js = 'new Function("var e = new Error(\\\'testing\\\');e.name = \\\'TestError\\\';e.code = \\\'3000\\\';throw e;");';
$res = ScriptServer_Serializer::serialize($obj);
$this->assertEqual($res,$js);
***************
*** 205,211 ****
function testErrorNested() {
$obj = new ScriptServer_Error();
! $obj->setError('TestError','testing');
$array = array('a',$obj,'b');
! $js = 'new Function("try { throw new TestError(\\\'testing\\\'); } catch(e) { function TestError(message) { this.name = \\\'TestError\\\'; this.message = message; }; TestError.prototype = new Error(); TestError.constructor = TestError; throw new TestError(\\\'testing\\\'); };");';
$res = ScriptServer_Serializer::serialize($array);
$this->assertEqual($res,$js);
--- 205,211 ----
function testErrorNested() {
$obj = new ScriptServer_Error();
! $obj->setError(3000,'TestError','testing');
$array = array('a',$obj,'b');
! $js = 'new Function("var e = new Error(\\\'testing\\\');e.name = \\\'TestError\\\';e.code = \\\'3000\\\';throw e;");';
$res = ScriptServer_Serializer::serialize($array);
$this->assertEqual($res,$js);
Index: unserializer.test.php
===================================================================
RCS file: /cvsroot/xmlrpccom/scriptserver/tests/php/unserializer.test.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** unserializer.test.php 6 Sep 2004 06:37:49 -0000 1.2
--- unserializer.test.php 8 Oct 2004 14:34:21 -0000 1.3
***************
*** 54,59 ****
function testUnserializeError() {
$var = new ScriptServer_Error();
! $var->setError('foo','bar');
$error = ScriptServer_Unserializer::unserialize(serialize($var));
$this->assertEqual($error->name,'foo');
$this->assertEqual($error->message,'bar');
--- 54,60 ----
function testUnserializeError() {
$var = new ScriptServer_Error();
! $var->setError(3000,'foo','bar');
$error = ScriptServer_Unserializer::unserialize(serialize($var));
+ $this->assertEqual($error->code,3000);
$this->assertEqual($error->name,'foo');
$this->assertEqual($error->message,'bar');
|