~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to tests/reflection/004.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
invoke() with non object or null value
 
3
--FILE--
 
4
<?php
 
5
 
 
6
class a {
 
7
        function a(){
 
8
        }
 
9
}
 
10
class b {
 
11
}
 
12
 
 
13
$b = new b();
 
14
 
 
15
$a=new ReflectionClass("a");
 
16
$m=$a->getMethod("a");
 
17
 
 
18
try {
 
19
        $m->invoke(null);
 
20
} catch (ReflectionException $E) {
 
21
        echo $E->getMessage()."\n";
 
22
}
 
23
 
 
24
 
 
25
try {
 
26
        $m->invoke($b);
 
27
} catch (ReflectionException $E) {
 
28
        echo $E->getMessage()."\n";
 
29
}
 
30
 
 
31
$b = new a();
 
32
try {
 
33
        $m->invoke($b);
 
34
} catch (ReflectionException $E) {
 
35
        echo $E->getMessage()."\n";
 
36
}
 
37
 
 
38
echo "===DONE===\n";?>
 
39
--EXPECT--
 
40
Non-object passed to Invoke()
 
41
Given object is not an instance of the class this method was declared in
 
42
===DONE===