/** * 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)); }
/** * testSetTokensDelegatesCallToCacheStoreWithFileId * * @return void */ public function testSetTokensDelegatesCallToCacheStoreWithFileId() { $cache = $this->createCacheFixture(); $cache->expects($this->once())->method('type')->with(self::equalTo('tokens'))->will($this->returnValue($cache)); $cache->expects($this->once())->method('store')->with(self::equalTo(__FUNCTION__), self::equalTo(array(1, 2, 3))); $compilationUnit = new ASTCompilationUnit(null); $compilationUnit->setCache($cache); $compilationUnit->setId(__FUNCTION__); $compilationUnit->setTokens(array(1, 2, 3)); }
/** * testAnalyzerIgnoresFilesWithoutFileName * * @return void */ public function testAnalyzerIgnoresFilesWithoutFileName() { $compilationUnit = new ASTCompilationUnit(null); $compilationUnit->setId(42); $analyzer = $this->_createAnalyzer(); $analyzer->visitCompilationUnit($compilationUnit); $metrics = $analyzer->getNodeMetrics($compilationUnit); $this->assertEquals(array(), $metrics); }