PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
PHP | 61 lines | 39 code | 19 blank | 3 comment | 1 complexity | 2de66e03dd6b755e76bb3d40295a6c34 MD5 | raw file
 1<?php
 2
 3require "tests.php";
 4require "director_finalizer.php";
 5
 6// No new functions
 7check::functions(array(foo_orstatus,deletefoo,getstatus,launder,resetstatus));
 8// No new classes
 9check::classes(array(director_finalizer,Foo));
10// now new vars
11check::globals(array());
12
13class MyFoo extends Foo {
14  function __destruct() {
15    $this->orStatus(2);
16    if (method_exists(parent, "__destruct")) {
17      parent::__destruct();
18    }
19  }
20}
21
22resetStatus();
23
24$a = new MyFoo();
25unset($a);
26
27check::equal(getStatus(), 3, "getStatus() failed #1");
28
29resetStatus();
30
31$a = new MyFoo();
32launder($a);
33
34check::equal(getStatus(), 0, "getStatus() failed #2");
35
36unset($a);
37
38check::equal(getStatus(), 3, "getStatus() failed #3");
39
40resetStatus();
41
42$a = new MyFoo();
43$a->thisown = 0;
44deleteFoo($a);
45unset($a);
46
47check::equal(getStatus(), 3, "getStatus() failed #4");
48
49resetStatus();
50
51$a = new MyFoo();
52$a->thisown = 0;
53deleteFoo(launder($a));
54unset($a);
55
56check::equal(getStatus(), 3, "getStatus() failed #5");
57
58resetStatus();
59
60check::done();
61?>