/** * Creates an abstract item instance. * * @return \PDepend\Source\AST\AbstractASTArtifact */ protected function createItem() { $class = new ASTClass(__CLASS__); $class->setCompilationUnit(new ASTCompilationUnit(__FILE__)); $class->setCache(new MemoryCacheDriver()); $class->setContext($this->getMock('PDepend\\Source\\Builder\\BuilderContext')); return $class; }
/** * 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)); }
/** * Tests that build interface updates the source file information for null * values. * * @return void */ public function testSetSourceFileInformationForNullValue() { $file = new ASTCompilationUnit(__FILE__); $class = new ASTClass(__CLASS__); $class->setCompilationUnit($file); $method = new ASTMethod(__FUNCTION__); $method->setParent($class); $this->assertSame($file, $method->getCompilationUnit()); }
/** * Creates a ready to use class fixture. * * @param string $name Optional class name. * * @return \PDepend\Source\AST\ASTClass * @since 1.0.2 */ protected function createClassFixture($name = null) { $name = $name ? $name : get_class($this); $class = new ASTClass($name); $class->setCompilationUnit(new ASTCompilationUnit($GLOBALS['argv'][0])); $class->setCache(new MemoryCacheDriver()); $class->setContext($this->getMock('PDepend\\Source\\Builder\\BuilderContext')); return $class; }