Changeset 1569 for trunk/src

Show
Ignore:
Timestamp:
05/05/08 21:37:13 (5 months ago)
Author:
mikey
Message:

allow annotations without prefix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationFactory.php

    r1301 r1569  
    2525     * @var  array 
    2626     */ 
    27     private static $prefixes    = array('stub'); 
     27    private static $prefixes    = array('stub', ''); 
    2828    /** 
    2929     * instance of the annotation parser 
  • trunk/src/test/php/net/stubbles/reflection/annotations/stubAnnotationFactoryTestCase.php

    r1305 r1569  
    8787} 
    8888 
     89/** 
     90 * Annotation without "annotation" in its name 
     91 * 
     92 * @My(foo='bar') 
     93 */ 
     94class OneMoreTestClass { } 
    8995 
    9096/** 
     
    334340        $this->fail('Found NonExistingAnnotation while this annotation should not be present.'); 
    335341    } 
     342 
     343    /** 
     344     * use the annotation but without any prefix and without the postfix "Annotation" 
     345     * 
     346     * @test 
     347     */ 
     348    public function noPrefixNoAnnotationInAnnotation() 
     349    { 
     350        $class = new stubReflectionClass('OneMoreTestClass'); 
     351        $this->assertTrue($class->hasAnnotation('My')); 
     352        $anno  = $class->getAnnotation('My'); 
     353        $this->assertType('MyAnnotation', $anno); 
     354        $this->assertEquals('bar', $anno->foo); 
     355    } 
    336356} 
    337357?>