aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/php/global_vars_runme.php
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2024-04-10 14:15:29 -0700
committerAlistair Delva <adelva@google.com>2024-04-11 12:58:28 -0700
commitd0f0f90be16c2ac553b5fa08512045273135147a (patch)
tree5d9ebb7a04807ea8a609ddd18b0162bc87530e4b /Examples/test-suite/php/global_vars_runme.php
parent6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030 (diff)
downloadswig-d0f0f90be16c2ac553b5fa08512045273135147a.tar.gz
Update to v4.2.1HEADmastermain
Change-Id: I47cef2be94299220d80265d949a95b58eee2c23b
Diffstat (limited to 'Examples/test-suite/php/global_vars_runme.php')
-rw-r--r--Examples/test-suite/php/global_vars_runme.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/Examples/test-suite/php/global_vars_runme.php b/Examples/test-suite/php/global_vars_runme.php
new file mode 100644
index 000000000..c3fe7d8aa
--- /dev/null
+++ b/Examples/test-suite/php/global_vars_runme.php
@@ -0,0 +1,27 @@
+<?php
+
+require "tests.php";
+
+check::functions(array('init','read_b','read_x'));
+check::classes(array('A','global_vars'));
+check::globals(array('b','a','ap','cap','ar','x','xp','c_member','vp','h','hp','hr'));
+
+$an = new A();
+check::classname('A', $an);
+ap_set($an);
+check::classname('A', ap_get());
+check::equivalent(ap_get(), $an, "global var assignment");
+
+x_set(17);
+check::equal(x_get(), 17, "global var assignment");
+check::equal(read_x(), 17, "PHP global var change visible in C++");
+init();
+check::equal(x_get(), 1234, "C++ global var change visible in PHP");
+
+b_set('test');
+check::equal(b_get(), 'test', "global var assignment");
+check::equal(read_b(), 'test', "PHP global var change visible in C++");
+init();
+check::equal(b_get(), 'string b', "C++ global var change visible in PHP");
+
+check::done();