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

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

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



Modified: PHP-Sandwich/trunk/t/4.pl
==============================================================================
--- PHP-Sandwich/trunk/t/4.pl	(original)
+++ PHP-Sandwich/trunk/t/4.pl	Fri Apr 15 13:51:12 2005
@@ -1,10 +1,23 @@
 #!/opt/ecelerity/3rdParty/bin/perl 
-use ExtUtils::testlib;
-use PHP;
-use PHP::Interpreter;
+use strict;
+#use ExtUtils::testlib;
+use Test::More tests => 6;
 
-$p = new PHP::Interpreter();
-$p->eval('function dump($a) { var_dump($a); }');
-$hash = { 'a' => 'alpha', 'b' => 'beta', 'c' => 'charlie' };
-$arg = $p->dump($hash);
+BEGIN {
+  use_ok 'PHP' or die;
+  use_ok 'PHP::Interpreter' or die;
+}
+
+diag "Test pashing hashes from Perl->PHP->Perl";
+
+ok my $p = new PHP::Interpreter(), "Create new PHP interpreter";
+ok $p->include('test.inc'), "include() PHP testing functions.";
+my $hash = { 'a' => 'alpha', 'b' => 'beta', 'c' => 'charlie' };
+ok my $arg = $p->ident($hash), "Pass a hash into PHP, recieve a hash back";
+
+my $broken = 0;
+foreach(keys %$arg) {
+  $broken = 1 if $hash->{$_} ne $arg->{$_};
+}
+is $broken, 0, "Checking the return hash matches the passed hash.";