Example #1
0
 /**
  * @covers Symfony\Components\DependencyInjection\Definition::addAnnotation
  * @covers Symfony\Components\DependencyInjection\Definition::getAnnotation
  * @covers Symfony\Components\DependencyInjection\Definition::getAnnotations
  */
 public function testAnnotations()
 {
     $def = new Definition('stdClass');
     $this->assertEquals(array(), $def->getAnnotation('foo'), '->getAnnotation() returns an empty array if the annotation is not defined');
     $this->assertEquals(spl_object_hash($def), spl_object_hash($def->addAnnotation('foo')), '->addAnnotation() implements a fluent interface');
     $this->assertEquals(array(array()), $def->getAnnotation('foo'), '->getAnnotation() returns attributes for an annotation name');
     $def->addAnnotation('foo', array('foo' => 'bar'));
     $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getAnnotation('foo'), '->addAnnotation() can adds the same annotation several times');
     $def->addAnnotation('bar', array('bar' => 'bar'));
     $this->assertEquals($def->getAnnotations(), array('foo' => array(array(), array('foo' => 'bar')), 'bar' => array(array('bar' => 'bar'))), '->getAnnotations() returns all annotations');
 }