/trunk/Examples/test-suite/php/director_basic_runme.php
PHP | 58 lines | 37 code | 18 blank | 3 comment | 0 complexity | eb0c862fedac87f21d4197ef005b6b06 MD5 | raw file
1<?php 2 3require "tests.php"; 4require "director_basic.php"; 5 6// No new functions 7check::functions(array(foo_ping,foo_pong,foo_get_self,a_f,a_rg,a1_ff,myclass_method,myclass_vmethod,myclass_pmethod,myclass_cmethod,myclass_get_self,myclass_call_pmethod,myclasst_i_method)); 8// No new classes 9check::classes(array(Foo,A,A1,Bar,MyClass,MyClassT_i)); 10// now new vars 11check::globals(array(bar_x)); 12 13class PhpFoo extends Foo { 14 function ping() { 15 return "PhpFoo::ping()"; 16 } 17} 18 19$a = new PhpFoo(); 20 21check::equal($a->ping(), "PhpFoo::ping()", "ping failed"); 22 23check::equal($a->pong(), "Foo::pong();PhpFoo::ping()", "pong failed"); 24 25$b = new Foo(); 26 27check::equal($b->ping(), "Foo::ping()", "ping failed"); 28 29check::equal($b->pong(), "Foo::pong();Foo::ping()", "pong failed"); 30 31$a = new A1(1); 32 33check::equal($a->rg(2), 2, "rg failed"); 34 35class PhpClass extends MyClass { 36 function vmethod($b) { 37 $b->x = $b->x + 31; 38 return $b; 39 } 40} 41 42$b = new Bar(3); 43$d = new MyClass(); 44$c = new PhpClass(); 45 46$cc = MyClass::get_self($c); 47$dd = MyClass::get_self($d); 48 49$bc = $cc->cmethod($b); 50$bd = $dd->cmethod($b); 51 52$cc->method($b); 53 54check::equal($bc->x, 34, "bc failed"); 55check::equal($bd->x, 16, "bd failed"); 56 57check::done(); 58?>