Annotation of embedaddon/php/tests/classes/__call_007.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Ensure exceptions are handled properly when thrown in a statically declared __call.  
                      3: --FILE--
                      4: <?php
                      5: class A {
                      6:        static function __call($strMethod, $arrArgs) {
                      7:                @var_dump($this);
                      8:                throw new Exception;
                      9:                echo "You should not see this";
                     10:        }
                     11:        function test() {
                     12:                A::unknownCalledWithSRO(1,2,3);
                     13:        }
                     14: }
                     15: 
                     16: class B extends A {
                     17:        function test() {
                     18:                B::unknownCalledWithSROFromChild(1,2,3);
                     19:        }
                     20: }
                     21: 
                     22: $a = new A();
                     23: 
                     24: echo "---> Invoke __call via simple method call.\n";
                     25: try {
                     26:        $a->unknown();
                     27: } catch (Exception $e) {
                     28:        echo "Exception caught OK; continuing.\n";
                     29: }
                     30: 
                     31: echo "\n\n---> Invoke __call via scope resolution operator within instance.\n";
                     32: try {
                     33:        $a->test();
                     34: } catch (Exception $e) {
                     35:        echo "Exception caught OK; continuing.\n";
                     36: }
                     37: 
                     38: echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n";
                     39: $b = new B();
                     40: try {
                     41:        $b->test();
                     42: } catch (Exception $e) {
                     43:        echo "Exception caught OK; continuing.\n";
                     44: }
                     45: 
                     46: echo "\n\n---> Invoke __call via callback.\n";
                     47: try {
                     48:        call_user_func(array($b, 'unknownCallback'), 1,2,3);
                     49: } catch (Exception $e) {
                     50:        echo "Exception caught OK; continuing.\n";
                     51: }
                     52: ?>
                     53: ==DONE==
                     54: --EXPECTF--
                     55: Warning: The magic method __call() must have public visibility and cannot be static in %s on line 3
                     56: ---> Invoke __call via simple method call.
                     57: NULL
                     58: Exception caught OK; continuing.
                     59: 
                     60: 
                     61: ---> Invoke __call via scope resolution operator within instance.
                     62: NULL
                     63: Exception caught OK; continuing.
                     64: 
                     65: 
                     66: ---> Invoke __call via scope resolution operator within child instance.
                     67: NULL
                     68: Exception caught OK; continuing.
                     69: 
                     70: 
                     71: ---> Invoke __call via callback.
                     72: NULL
                     73: Exception caught OK; continuing.
                     74: ==DONE==

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>