[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.
This commit is contained in:
parent
fa36d6fd28
commit
9e95f7f996
1 changed files with 28 additions and 0 deletions
28
Examples/test-suite/php/director_ownership_runme.php
Normal file
28
Examples/test-suite/php/director_ownership_runme.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
require "tests.php";
|
||||
|
||||
check::functions(array('make_content'));
|
||||
check::classes(array('ContentBase','ContentDerived','Container','director_ownership'));
|
||||
// No new vars
|
||||
check::globals(array());
|
||||
|
||||
function set_content_and_release(Container $container, ContentBase $content) {
|
||||
$content->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();
|
||||
Loading…
Add table
Add a link
Reference in a new issue