[svn:PHP-Sandwich] rev 993 - PHP-Sandwich/trunk/t

[email protected] 15 Apr 2005 20:36:47 -0000
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
Author: gschlossnagle
Date: Fri Apr 15 13:36:47 2005
New Revision: 993

Modified:
   PHP-Sandwich/trunk/t/3.pl
Log:
update to Test::More


Modified: PHP-Sandwich/trunk/t/3.pl
==============================================================================
--- PHP-Sandwich/trunk/t/3.pl	(original)
+++ PHP-Sandwich/trunk/t/3.pl	Fri Apr 15 13:36:47 2005
@@ -1,16 +1,23 @@
 #!/opt/ecelerity/3rdParty/bin/perl 
 use strict;
 use ExtUtils::testlib;
-use Test;
+use Test::More tests => 7;
 
-BEGIN { plan tests => 1 }
+BEGIN {
+    use_ok 'PHP' or die;
+    use_ok 'PHP::Interpreter' or die;
+}
 
-use PHP;
-use PHP::Interpreter;
+diag "Testing passing Perl AVs to PHP functions.";
 
-print "# Testing passing Perl AVs to PHP functions.\n";
-
-my $p = new PHP::Interpreter();
-$p->eval('function dump($a) { var_dump($a); }');
+ok my $p = PHP::Interpreter->new, "Create new PHP interpreter";
+ok $p->include('test.inc'), 
+  'include PHP testing suite';
 my @list = ('I', 'AM', 'AN', 'ARRAY');
-$p->dump(\@list);
+ok my $newlist = $p->ident(\@list), 'Pass an AV into PHP, return an AV.';
+is scalar(@$newlist), scalar(@list), "Arrays are the same size.";
+my $match = 1;
+for(my $i = 0; $i < scalar @$newlist; $i++) {
+  if($newlist->[$i] ne $list[$i]) { $match = 0; }
+}
+is $match, 1, "Checking arrays are identical.";