PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/php/director_basic_runme.php

#
PHP | 58 lines | 37 code | 18 blank | 3 comment | 0 complexity | eb0c862fedac87f21d4197ef005b6b06 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. <?php
  2. require "tests.php";
  3. require "director_basic.php";
  4. // No new functions
  5. check::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));
  6. // No new classes
  7. check::classes(array(Foo,A,A1,Bar,MyClass,MyClassT_i));
  8. // now new vars
  9. check::globals(array(bar_x));
  10. class PhpFoo extends Foo {
  11. function ping() {
  12. return "PhpFoo::ping()";
  13. }
  14. }
  15. $a = new PhpFoo();
  16. check::equal($a->ping(), "PhpFoo::ping()", "ping failed");
  17. check::equal($a->pong(), "Foo::pong();PhpFoo::ping()", "pong failed");
  18. $b = new Foo();
  19. check::equal($b->ping(), "Foo::ping()", "ping failed");
  20. check::equal($b->pong(), "Foo::pong();Foo::ping()", "pong failed");
  21. $a = new A1(1);
  22. check::equal($a->rg(2), 2, "rg failed");
  23. class PhpClass extends MyClass {
  24. function vmethod($b) {
  25. $b->x = $b->x + 31;
  26. return $b;
  27. }
  28. }
  29. $b = new Bar(3);
  30. $d = new MyClass();
  31. $c = new PhpClass();
  32. $cc = MyClass::get_self($c);
  33. $dd = MyClass::get_self($d);
  34. $bc = $cc->cmethod($b);
  35. $bd = $dd->cmethod($b);
  36. $cc->method($b);
  37. check::equal($bc->x, 34, "bc failed");
  38. check::equal($bd->x, 16, "bd failed");
  39. check::done();
  40. ?>