[svn:PHP-Sandwich] r1440 - PHP-Sandwich/trunk/t
[email protected] 31 Jul 2005 15:53:57 -0000
| Newsgroups | perl.php.sandwich.dev |
|---|---|
| Message-ID | <[email protected]> |
Author: theory
Date: Sun Jul 31 08:53:56 2005
New Revision: 1440
Modified:
PHP-Sandwich/trunk/t/test_perl_classes.t
Log:
Add test using call() to construct an object (call a class method). Also,
added a comment about the need for exit. It really shouldn't need it...
Modified: PHP-Sandwich/trunk/t/test_perl_classes.t
==============================================================================
--- PHP-Sandwich/trunk/t/test_perl_classes.t (original)
+++ PHP-Sandwich/trunk/t/test_perl_classes.t Sun Jul 31 08:53:56 2005
@@ -1,6 +1,6 @@
#!/opt/ecelerity/3rdParty/bin/perl -w
use strict;
-use Test::More tests => 6;
+use Test::More tests => 8;
use Test::Builder;
use IO::File;
@@ -30,4 +30,22 @@ ok my $ret = $php->eval(q^
}
^), "We should get a value back from the file";
like $ret, qr/^#\!.*perl\s+-w$/, "We should have a shebang line";
+
+# Make sure that call() works on class methods, too.
+ok my $ret = $php->eval(q^
+ $perl = Perl::getInstance();
+ $file = $perl->call('file');
+ $fh = $perl->call("IO::File::new", "IO::File", "<$file");
+ if ($fh) {
+ return $fh->getline();
+ } else {
+ throw new Exception("Couldn't open $file");
+ }
+^), "We should get a value back from the file";
+like $ret, qr/^#\!.*perl\s+-w$/, "We should have a shebang line";
+
+# XXX Without this exit, an extra, unlabled test runs and we get an error:
+# 'Can't call method "eval" on an undefined value at t/test_perl_classes.t
+# line 22, <GEN1> line 1.' Huh? Is there any way to fix that?
+
exit;