Changeset 897

Show
Ignore:
Timestamp:
09/07/07 11:44:14 (1 year ago)
Author:
mikey
Message:

add another try to retrieve instance by name

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/lang/stubEnum.php

    r895 r897  
    8585            return $enum->getStaticPropertyValue($name); 
    8686        } catch (ReflectionException $re) { 
    87             throw new stubIllegalArgumentException($re->getMessage()); 
     87            try { 
     88                return $enum->getStaticPropertyValue(strtoupper($name)); 
     89            } catch (ReflectionException $re) { 
     90                throw new stubIllegalArgumentException($re->getMessage()); 
     91            } 
    8892        } 
    8993    } 
  • trunk/src/test/php/net/stubbles/lang/stubEnumTestCase.php

    r895 r897  
    107107        $bar = stubEnum::forName(new ReflectionClass('TeststubEnum'), 'BAR'); 
    108108        $this->assertReference($bar, TeststubEnum::$BAR); 
     109        $foo = stubEnum::forName(new ReflectionClass('TeststubEnum'), 'foo'); 
     110        $this->assertReference($foo, TeststubEnum::$FOO); 
     111        $bar = stubEnum::forName(new ReflectionClass('TeststubEnum'), 'bar'); 
     112        $this->assertReference($bar, TeststubEnum::$BAR); 
    109113    } 
    110114