/**
  * Tests that the {@link \PDepend\Source\AST\ASTMethod::getParent()} returns as
  * default value <b>null</b> and that the package could be set and unset.
  *
  * @return void
  */
 public function testGetSetParent()
 {
     $class = new ASTClass('clazz');
     $method = new ASTMethod('method');
     $method->setParent($class);
     $this->assertSame($class, $method->getParent());
 }
示例#2
0
    /**
     * Adds the given method to this type.
     *
     * @param \PDepend\Source\AST\ASTMethod $method
     * @return \PDepend\Source\AST\ASTMethod
     */
    public function addMethod(ASTMethod $method)
    {
        $method->setParent($this);

        $this->methods[] = $method;

        return $method;
    }
 /**
  * testBuilderCreatesCaseInSensitiveMethodIdentifiers
  *
  * @return void
  */
 public function testBuilderCreatesCaseInSensitiveMethodIdentifiers()
 {
     $compilationUnit = new ASTCompilationUnit(__FILE__);
     $compilationUnit->setId(__FUNCTION__);
     $class = new ASTClass(__FUNCTION__);
     $class->setCompilationUnit($compilationUnit);
     $method0 = new ASTMethod(__FUNCTION__);
     $method0->setParent($class);
     $method1 = new ASTMethod(strtolower(__FUNCTION__));
     $method1->setParent($class);
     $builder0 = new IdBuilder();
     $builder1 = new IdBuilder();
     $this->assertEquals($builder0->forMethod($method0), $builder1->forMethod($method1));
 }