public function testCreateDefinition()
 {
     $definition = new Definition('Demo', array(new Reference('service_id')));
     $definition->addArgument('welcome')->setProperty('message', 'Hello world')->addMethodCall('setMessage', array('Just Hello'))->setAbstract('DemoInterface')->share();
     $this->assertEquals('Demo', $definition->getClass());
     $this->assertCount(2, $definition->getArgument()->all());
     $this->assertInstanceOf('\\Borobudur\\DependencyInjection\\Reference', $definition->getArgument()->get(0));
     $this->assertCount(1, $definition->getProperty()->all());
     $this->assertEquals('Hello world', $definition->getProperty()->get('message'));
     $this->assertCount(1, $definition->getMethodCall()->all());
     $this->assertSame(array('setMessage', array('Just Hello')), $definition->getMethodCall()->get(0));
     $this->assertTrue($definition->isAbstract());
     $this->assertEquals('DemoInterface', $definition->getAbstract());
     $this->assertTrue($definition->isShared());
 }
 /**
  * Register abstract definition if possible.
  *
  * @param string     $id
  * @param Definition $definition
  */
 private function setAlias($id, Definition $definition)
 {
     if ($definition->isAbstract()) {
         $class = $definition->getAbstract();
     } else {
         $class = $definition->getClass();
     }
     $class = '\\' . ltrim($class, '\\');
     $this->aliases[$class][] = $id;
     $this->lockAlias[$id] = true;
 }