"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/Examples/test-suite/php/abstract_inherit_ok_runme.php" (30 Nov 2022, 581 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "abstract_inherit_ok_runme.php": 4.0.2_vs_4.1.0.

    1 <?php
    2 
    3 require "tests.php";
    4 
    5 // No new functions
    6 check::functions(array());
    7 
    8 check::classes(array('Foo','Spam'));
    9 
   10 // No new vars
   11 check::globals(array());
   12 
   13 // We shouldn't be able to instantiate abstract class Foo.
   14 $class = 'Foo';
   15 try {
   16     $obj = eval("new $class();");
   17     check::fail("Should not be able to instantiate abstract class $class");
   18 } catch (Error $e) {
   19     check::equal($e->getMessage(), "Cannot instantiate abstract class $class", "Unexpected exception: {$e->getMessage()}");
   20 }
   21 
   22 $spam=new Spam();
   23 check::equal(0,$spam->blah(),"spam object method");
   24 
   25 check::done();