From 9e95f7f996c616a931253c0ab795f00feb499f0a Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 29 Dec 2021 15:48:40 +1300 Subject: [PATCH] [php] Add director_ownership_runme.php This serves as a regression test for https://sourceforge.net/p/swig/bugs/1339/ which was presumably fixed by the change to use PHP's C API to wrap classes. --- .../php/director_ownership_runme.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Examples/test-suite/php/director_ownership_runme.php diff --git a/Examples/test-suite/php/director_ownership_runme.php b/Examples/test-suite/php/director_ownership_runme.php new file mode 100644 index 000000000..a78fb9c03 --- /dev/null +++ b/Examples/test-suite/php/director_ownership_runme.php @@ -0,0 +1,28 @@ +thisown = false; + $container->set_content($content); +} + +$container = new Container(); + +// make a content in PHP (newobject is 1) +$content_php = new ContentDerived(); + +// make a content in C++ (newobject is 1) +$content_cpp = make_content(); + +set_content_and_release($container, $content_php); +check::equal($container->get_content()->get_name(), "ContentDerived", "get_content() not ContentDerived"); + +set_content_and_release($container, $content_cpp); +check::equal($container->get_content()->get_name(), "ContentDerived", "get_content() not ContentDerived"); + +check::done();