コード例 #1
0
ファイル: SimpleTest.php プロジェクト: agpmedia/notoj
 /** yet another comment {{{
  * This is a bloody comment that nobody is going to read
  *
  * @zzexpect(True) 
  * @bar(False)
  * @bar hola que tal?
  */
 function testClass()
 {
     $reflection = new ReflectionClass($this);
     $annotation = $reflection->getAnnotations();
     $this->assertEquals(1, $annotation->count());
     $this->assertEquals($annotation[0]->getName(), 'test');
     $this->assertEquals($annotation[0]->getArgs(), array(array("foobar")));
     foreach ($reflection->getMethods() as $method) {
         $this->assertTrue($method instanceof \Notoj\ReflectionMethod);
         if ($method->getName() == 'testClass') {
             $annotation = $method->getAnnotations();
             $this->assertEquals(3, $annotation->count());
             $this->assertEquals($annotation[0]->getName(), 'zzexpect');
             $this->assertEquals(current($annotation[0]->getArgs()), true);
             $this->assertequals($annotation[1]->getName(), 'bar');
             $this->assertEquals(current($annotation[1]->getArgs()), false);
             $this->assertequals($annotation[2]->getName(), 'bar');
             $this->assertEquals(current($annotation[2]->getArgs()), 'hola que tal?');
         }
     }
     foreach ($reflection->getProperties() as $property) {
         $this->assertTrue($property instanceof \Notoj\ReflectionProperty);
         if ($property->getName() === 'bar') {
             $annotation = $property->getAnnotations();
             $this->assertEquals($annotation[0]->getName(), 'var_name');
             $this->assertEquals(current($annotation[0]->getArgs()), 'foo');
         }
     }
 }