/** * Tests the `analyze` method which compacts the test results and provides a convenient * summary of the complexity filter (class average and worst offenders). * * @see lithium\test\filter\Complexity::analyze() */ public function testAnalyze() { extract($this->_paths); $group = new Group(); $group->add($testClassTest); $this->report->group = $group; Complexity::apply($this->report, $group->tests()); $results = Complexity::analyze($this->report); $expected = array('class' => array($testClass => 3)); foreach ($this->_metrics as $method => $metric) { $expected['max'][$testClass . '::' . $method . '()'] = $metric; } $this->assertEqual($expected['max'], $results['max']); $this->assertEqual($expected['class'][$testClass], round($results['class'][$testClass])); }
/** * Tests the `analyze` method which compacts the test results and provides a convenient * summary of the complexity filter (class average and worst offenders). * * @see lithium\test\filter\Complexity::analyze() */ public function testAnalyze() { extract($this->_paths); $group = new GroupMock(); $group->add($testClassTest); $this->report->group = $group; $this->report->results['filters'] = array('lithium\\test\\filter\\Complexity' => $this->_metrics); $results = Complexity::analyze($this->report); $expected = array('class' => array($testClass => 3.5), 'max' => array('FooObject::invokeMethod()' => 8, 'FooObject::applyFilter()' => 5, 'FooObject::_filter()' => 3, 'FooObject::_parents()' => 2, 'FooObject::_instance()' => 2, 'FooObject::_stop()' => 1)); $this->assertEqual($expected['max'], $results['max']); $result = round($results['class'][$testClass], 1); $this->assertIdentical($expected['class'][$testClass], $result); }