/**
  * Test case for the execution chain bug 14.
  *
  * @return void
  */
 public function testAnalyzerExecutionChain()
 {
     $namespaces = self::parseCodeResourceForTest();
     $this->assertEquals(1, $namespaces->count());
     $this->assertEquals(1, $namespaces->current()->getFunctions()->count());
     $analyzer = new CouplingAnalyzer();
     $analyzer->analyze($namespaces);
     $project = $analyzer->getProjectMetrics();
     $this->assertEquals(3, $project['calls']);
 }
 /**
  * Tests that the analyzer calculates the expected result.
  *
  * @return void
  */
 public function testAnalyzerDetectsObjectAllocation()
 {
     $namespaces = self::parseCodeResourceForTest();
     $analyzer = new CouplingAnalyzer();
     $analyzer->analyze($namespaces);
     $project = $analyzer->getProjectMetrics();
     $this->assertEquals(0, $project['calls']);
 }
 /**
  * Parses the source code for the currently calling test method and returns
  * the calculated project metrics.
  *
  * @param string $testCase Optional name of the calling test case.
  *
  * @return array(string=>mixed)
  * @since 0.10.2
  */
 private function _calculateProjectMetrics($testCase = null)
 {
     $testCase = $testCase ? $testCase : self::getCallingTestMethod();
     $analyzer = new CouplingAnalyzer();
     $analyzer->analyze(self::parseTestCaseSource($testCase));
     return $analyzer->getProjectMetrics();
 }