Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactored: clsa and clsc metric inlined.

Now the node count analyzer calculates the CLSA und CLSC metrics,
instead of the hierarchy analyzer.
  • Loading branch information...
commit 2167606b8dcec1f68cd2c1f70a1835178f64249a 1 parent f065c8e
@manuelpichler authored
Showing with 238 additions and 465 deletions.
  1. +10 −0 src/main/php/PHP/Depend/AST/Class.php
  2. +0 −6 src/main/php/PHP/Depend/Metrics/Hierarchy/Analyzer.php
  3. +27 −10 src/main/php/PHP/Depend/Metrics/NodeCount/Analyzer.php
  4. +0 −27 src/test/php/PHP/Depend/Metrics/Hierarchy/AnalyzerTest.php
  5. +97 −113 src/test/php/PHP/Depend/Metrics/NodeCount/AnalyzerTest.php
  6. +0 −67 src/test/resources/files/Metrics/Hierarchy/testCalculatesExpectedNumberOfAbstractClasses.php
  7. +0 −67 src/test/resources/files/Metrics/Hierarchy/testCalculatesExpectedNumberOfConcreteClasses.php
  8. +0 −15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfClassesInPackages.php
  9. +0 −17 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfClassesInProject.php
  10. +0 −15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfFunctionsInPackages.php
  11. +0 −15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfFunctionsInProject.php
  12. +0 −15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfInterfacesInPackages.php
  13. +0 −18 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfInterfacesInProject.php
  14. +0 −30 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfMethodsInPackages.php
  15. +0 −15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfPackages.php
  16. +48 −0 src/test/resources/files/Metrics/NodeCount/testGetNodeMetricsOnNamespace.php
  17. +56 −0 src/test/resources/files/Metrics/NodeCount/testGetProjectMetricsReturnsExpectedSetOfMetrics.php
  18. +0 −35 src/test/resources/files/Metrics/NodeCount/testNumberOfMethodsInProject.php
View
10 src/main/php/PHP/Depend/AST/Class.php
@@ -151,6 +151,16 @@ public function isUserDefined()
}
/**
+ * Returns <b>true</b> when this class was declared as abstract.
+ *
+ * @return boolean
+ */
+ public function isAbstract()
+ {
+ return ( ( $this->type & self::MODIFIER_ABSTRACT ) === self::MODIFIER_ABSTRACT );
+ }
+
+ /**
* Magic wake up method that will register this object in the global node
* reference context.
*
View
6 src/main/php/PHP/Depend/Metrics/Hierarchy/Analyzer.php
@@ -82,12 +82,6 @@ class PHP_Depend_Metrics_Hierarchy_Analyzer /* TODO 2.0
const CLAZZ = __CLASS__;
/**
- * Metrics provided by the analyzer implementation.
- */
- const M_NUMBER_OF_ABSTRACT_CLASSES = 'clsa',
- M_NUMBER_OF_CONCRETE_CLASSES = 'clsc';
-
- /**
* Number of all analyzed functions.
*
* @var integer $_fcs
View
37 src/main/php/PHP/Depend/Metrics/NodeCount/Analyzer.php
@@ -69,11 +69,13 @@ class PHP_Depend_Metrics_NodeCount_Analyzer extends PHP_Depend_Metrics_AbstractA
/**
* Metrics provided by the analyzer implementation.
*/
- const M_NUMBER_OF_PACKAGES = 'nop',
- M_NUMBER_OF_CLASSES = 'noc',
- M_NUMBER_OF_INTERFACES = 'noi',
- M_NUMBER_OF_METHODS = 'nom',
- M_NUMBER_OF_FUNCTIONS = 'nof';
+ const M_NUMBER_OF_PACKAGES = 'nop',
+ M_NUMBER_OF_CLASSES = 'noc',
+ M_NUMBER_OF_INTERFACES = 'noi',
+ M_NUMBER_OF_METHODS = 'nom',
+ M_NUMBER_OF_FUNCTIONS = 'nof',
+ M_NUMBER_OF_ABSTRACT_CLASSES = 'clsa',
+ M_NUMBER_OF_CONCRETE_CLASSES = 'clsc';
/**
* Number Of Packages.
@@ -90,6 +92,13 @@ class PHP_Depend_Metrics_NodeCount_Analyzer extends PHP_Depend_Metrics_AbstractA
private $numberOfClasses = 0;
/**
+ * Number of abstract classes.
+ *
+ * @var integer
+ */
+ private $numberOfAbstractClasses = 0;
+
+ /**
* Number Of Interfaces.
*
* @var integer
@@ -163,11 +172,13 @@ public function getNodeMetrics( $node )
public function getProjectMetrics()
{
return array(
- self::M_NUMBER_OF_PACKAGES => $this->numberOfPackages,
- self::M_NUMBER_OF_CLASSES => $this->numberOfClasses,
- self::M_NUMBER_OF_INTERFACES => $this->numberOfInterfaces,
- self::M_NUMBER_OF_METHODS => $this->numberOfMethods,
- self::M_NUMBER_OF_FUNCTIONS => $this->numberOfFunctions
+ self::M_NUMBER_OF_PACKAGES => $this->numberOfPackages,
+ self::M_NUMBER_OF_CLASSES => $this->numberOfClasses,
+ self::M_NUMBER_OF_INTERFACES => $this->numberOfInterfaces,
+ self::M_NUMBER_OF_METHODS => $this->numberOfMethods,
+ self::M_NUMBER_OF_FUNCTIONS => $this->numberOfFunctions,
+ self::M_NUMBER_OF_ABSTRACT_CLASSES => $this->numberOfAbstractClasses,
+ self::M_NUMBER_OF_CONCRETE_CLASSES => ( $this->numberOfClasses - $this->numberOfAbstractClasses )
);
}
@@ -184,6 +195,11 @@ public function visitClassBefore( PHP_Depend_AST_Class $class, $data = null )
++$this->numberOfClasses;
+ if ( $class->isAbstract() )
+ {
+ ++$this->numberOfAbstractClasses;
+ }
+
$this->metrics[$class->getId()] = array( self::M_NUMBER_OF_METHODS => 0 );
$this->updateNamespace( $class->getNamespace(), self::M_NUMBER_OF_CLASSES );
@@ -221,6 +237,7 @@ public function visitInterfaceBefore( PHP_Depend_AST_Interface $interface, $data
* @param PHP_Depend_AST_Method $method
* @param mixed $data
* @return mixed
+ * @todo Do not count methods declared in an interface
*/
public function visitMethodBefore( PHP_Depend_AST_Method $method, $data = null )
{
View
27 src/test/php/PHP/Depend/Metrics/Hierarchy/AnalyzerTest.php
@@ -66,33 +66,6 @@
*/
class PHP_Depend_Metrics_Hierarchy_AnalyzerTest extends PHP_Depend_Metrics_AbstractTest
{
- /**
- * testCalculatesExpectedNumberOfAbstractClasses
- *
- * @return void
- */
- public function testCalculatesExpectedNumberOfAbstractClasses()
- {
- $analyzer = new PHP_Depend_Metrics_Hierarchy_Analyzer();
- $analyzer->analyze(self::parseTestCaseSource(__METHOD__));
-
- $metrics = $analyzer->getProjectMetrics();
- self::assertEquals(1, $metrics['clsa']);
- }
-
- /**
- * testCalculatesExpectedNumberOfConcreteClasses
- *
- * @return void
- */
- public function testCalculatesExpectedNumberOfConcreteClasses()
- {
- $analyzer = new PHP_Depend_Metrics_Hierarchy_Analyzer();
- $analyzer->analyze(self::parseTestCaseSource(__METHOD__));
-
- $metrics = $analyzer->getProjectMetrics();
- self::assertEquals(2, $metrics['clsc']);
- }
/**
* testAnalyzerIgnoresClassesThatAreNotUserDefined
View
210 src/test/php/PHP/Depend/Metrics/NodeCount/AnalyzerTest.php
@@ -70,154 +70,179 @@
class PHP_Depend_Metrics_NodeCount_AnalyzerTest extends PHP_Depend_Metrics_AbstractTest
{
/**
- * Tests that the analyzer calculates the correct number of packages value.
+ * testGetProjectMetricsReturnsExpectedSetOfMetrics
*
- * @return void
+ * @return array
*/
- public function testCalculatesExpectedNumberOfPackages()
+ public function testGetProjectMetricsReturnsExpectedSetOfMetrics()
{
$processor = new PHP_Depend_Metrics_Processor();
$processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
$processor->process( self::parseTestCaseSource( __METHOD__ ) );
$metrics = $analyzer->getProjectMetrics();
- self::assertEquals( 3, $metrics['nop'] );
+ $this->assertEquals(
+ array(
+ 'nop',
+ 'noc',
+ 'noi',
+ 'nom',
+ 'nof',
+ 'clsa',
+ 'clsc'
+ ),
+ array_keys( $metrics )
+ );
+
+ return $metrics;
}
/**
- * testCalculatesExpectedNumberOfClassesInProject
+ * Tests that the analyzer calculates the correct number of packages value.
*
+ * @param array $metrics
* @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
*/
- public function testCalculatesExpectedNumberOfClassesInProject()
+ public function testCalculatesExpectedNumberOfPackages( array $metrics )
{
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
-
- $metrics = $analyzer->getProjectMetrics();
- self::assertEquals( 6, $metrics['noc'] );
+ $this->assertEquals( 3, $metrics['nop'] );
}
/**
- * testCalculatesExpectedNumberOfClassesInPackages
+ * testCalculatesExpectedNumberOfClassesInProject
*
+ * @param array $metrics
* @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
*/
- public function testCalculatesExpectedNumberOfClassesInPackages()
+ public function testCalculatesExpectedNumberOfClassesInProject( array $metrics )
{
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
-
- self::assertEquals(
- array(
- 'A' => array( 'noc' => 3, 'noi' => 0, 'nom' => 0, 'nof' => 0 ),
- 'B' => array( 'noc' => 2, 'noi' => 0, 'nom' => 0, 'nof' => 0 ),
- 'C' => array( 'noc' => 1, 'noi' => 0, 'nom' => 0, 'nof' => 0 ),
- ),
- array(
- 'A' => $analyzer->getNodeMetrics( 'A#n' ),
- 'B' => $analyzer->getNodeMetrics( 'B#n' ),
- 'C' => $analyzer->getNodeMetrics( 'C#n' ),
- )
- );
+ $this->assertEquals( 6, $metrics['noc'] );
}
/**
* testCalculatesExpectedNumberOfInterfacesInProject
*
+ * @param array $metrics
* @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
*/
- public function testCalculatesExpectedNumberOfInterfacesInProject()
+ public function testCalculatesExpectedNumberOfInterfacesInProject( array $metrics )
{
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
+ $this->assertEquals( 8, $metrics['noi'] );
+ }
- $metrics = $analyzer->getProjectMetrics();
- self::assertEquals( 9, $metrics['noi'] );
+ /**
+ * testCalculatesExpectedNumberOfFunctionsInProject
+ *
+ * @param array $metrics
+ * @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
+ */
+ public function testCalculatesExpectedNumberOfFunctionsInProject( array $metrics )
+ {
+ $this->assertEquals( 6, $metrics['nof'] );
}
/**
- * testCalculatesExpectedNumberOfInterfacesInPackages
+ * testCalculatesExpectedNumberOfMethodsInProject
*
+ * @param array $metrics
* @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
*/
- public function testCalculatesExpectedNumberOfInterfacesInPackages()
+ public function testCalculatesExpectedNumberOfMethodsInProject( array $metrics )
{
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
+ $this->assertEquals( 13, $metrics['nom'] );
+ }
- self::assertEquals(
- array(
- 'A' => array( 'noc' => 0, 'noi' => 1, 'nom' => 0, 'nof' => 0 ),
- 'B' => array( 'noc' => 0, 'noi' => 2, 'nom' => 0, 'nof' => 0 ),
- 'C' => array( 'noc' => 0, 'noi' => 3, 'nom' => 0, 'nof' => 0 ),
- ),
- array(
- 'A' => $analyzer->getNodeMetrics( 'A#n' ),
- 'B' => $analyzer->getNodeMetrics( 'B#n' ),
- 'C' => $analyzer->getNodeMetrics( 'C#n' )
- )
- );
+ /**
+ * testCalculatesExpectedNumberOfAbstractClasses
+ *
+ * @param array $metrics
+ * @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
+ */
+ public function testCalculatesExpectedNumberOfAbstractClasses( array $metrics )
+ {
+ $this->assertEquals( 4, $metrics['clsa'] );
+ }
+
+ /**
+ * testCalculatesExpectedNumberOfConcreteClasses
+ *
+ * @param array $metrics
+ * @return void
+ * @depends testGetProjectMetricsReturnsExpectedSetOfMetrics
+ */
+ public function testCalculatesExpectedNumberOfConcreteClasses( array $metrics )
+ {
+ $this->assertEquals( 2, $metrics['clsc'] );
}
/**
- * testNumberOfMethodsInProject
+ * testGetNodeMetricsOnNamespace
*
* @return PHP_Depend_Metrics_NodeCount_Analyzer
*/
- public function testNumberOfMethodsInProject()
+ public function testGetNodeMetricsOnNamespace()
{
$processor = new PHP_Depend_Metrics_Processor();
$processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
$processor->process( self::parseTestCaseSource( __METHOD__ ) );
- $metrics = $analyzer->getProjectMetrics();
- $this->assertEquals( 12, $metrics['nom'] );
+ $metrics = $analyzer->getNodeMetrics( 'A#n' );
+ $this->assertEquals(
+ array(
+ 'noc',
+ 'noi',
+ 'nom',
+ 'nof'
+ ),
+ array_keys( $metrics )
+ );
return $analyzer;
}
/**
- * testNumberOfMethodsInPackages
+ * testNamespaceMetrics
*
* @param PHP_Depend_Metrics_NodeCount_Analyzer $analyzer
- *
* @return void
- * @depends testNumberOfMethodsInProject
+ * @depends testGetNodeMetricsOnNamespace
*/
- public function testNumberOfMethodsInPackages( PHP_Depend_Metrics_NodeCount_Analyzer $analyzer )
+ public function testNamespaceMetrics( $analyzer )
{
- $this->assertEquals(
+ self::assertEquals(
array(
- 'A' => array( 'noc' => 2, 'noi' => 1, 'nom' => 4, 'nof' => 0 ),
- 'B' => array( 'noc' => 1, 'noi' => 2, 'nom' => 6, 'nof' => 0 ),
- 'C' => array( 'noc' => 0, 'noi' => 1, 'nom' => 2, 'nof' => 0 ),
+ 'A' => array( 'noc' => 3, 'noi' => 1, 'nom' => 4, 'nof' => 3 ),
+ 'B' => array( 'noc' => 2, 'noi' => 2, 'nom' => 3, 'nof' => 2 ),
+ 'C' => array( 'noc' => 1, 'noi' => 3, 'nom' => 2, 'nof' => 1 ),
),
array(
'A' => $analyzer->getNodeMetrics( 'A#n' ),
'B' => $analyzer->getNodeMetrics( 'B#n' ),
- 'C' => $analyzer->getNodeMetrics( 'C#n' )
+ 'C' => $analyzer->getNodeMetrics( 'C#n' ),
)
);
+
+ return $analyzer;
}
/**
* testNumberOfMethodsInClass
*
* @param PHP_Depend_Metrics_NodeCount_Analyzer $analyzer
- *
* @return void
- * @depends testNumberOfMethodsInProject
+ * @depends testNamespaceMetrics
*/
public function testNumberOfMethodsInClass( PHP_Depend_Metrics_NodeCount_Analyzer $analyzer )
{
$this->assertEquals(
- array( 'nom' => 3 ),
- $analyzer->getNodeMetrics( 'B\\B3#c' )
+ array( 'nom' => 2 ),
+ $analyzer->getNodeMetrics( 'A\\A1#c' )
);
}
@@ -225,55 +250,14 @@ public function testNumberOfMethodsInClass( PHP_Depend_Metrics_NodeCount_Analyze
* testNumberOfMethodsInInterface
*
* @param PHP_Depend_Metrics_NodeCount_Analyzer $analyzer
- *
* @return void
- * @depends testNumberOfMethodsInProject
+ * @depends testNamespaceMetrics
*/
public function testNumberOfMethodsInInterface( PHP_Depend_Metrics_NodeCount_Analyzer $analyzer )
{
$this->assertEquals(
array( 'nom' => 2 ),
- $analyzer->getNodeMetrics( 'C\\C1#i' )
- );
- }
-
- /**
- * testCalculatesExpectedNumberOfFunctionsInProject
- *
- * @return void
- */
- public function testCalculatesExpectedNumberOfFunctionsInProject()
- {
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
-
- $metrics = $analyzer->getProjectMetrics();
- $this->assertEquals( 6, $metrics['nof'] );
- }
-
- /**
- * testCalculatesExpectedNumberOfFunctionsInPackages
- *
- * @return void
- */
- public function testCalculatesExpectedNumberOfFunctionsInPackages()
- {
- $processor = new PHP_Depend_Metrics_Processor();
- $processor->register( $analyzer = new PHP_Depend_Metrics_NodeCount_Analyzer() );
- $processor->process( self::parseTestCaseSource( __METHOD__ ) );
-
- self::assertEquals(
- array(
- 'A' => array( 'noc' => 0, 'noi' => 0, 'nom' => 0, 'nof' => 3 ),
- 'B' => array( 'noc' => 0, 'noi' => 0, 'nom' => 0, 'nof' => 2 ),
- 'C' => array( 'noc' => 0, 'noi' => 0, 'nom' => 0, 'nof' => 1 ),
- ),
- array(
- 'A' => $analyzer->getNodeMetrics( 'A#n' ),
- 'B' => $analyzer->getNodeMetrics( 'B#n' ),
- 'C' => $analyzer->getNodeMetrics( 'C#n' ),
- )
+ $analyzer->getNodeMetrics( 'B\\I1#i' )
);
}
}
View
67 src/test/resources/files/Metrics/Hierarchy/testCalculatesExpectedNumberOfAbstractClasses.php
@@ -1,67 +0,0 @@
-<?php
-
-
-/**
- * @package pkg1
- */
-function foo($foo = array()) {
- foreach ($foo as $bar) {
- FooBar::y($bar);
- }
-}
-/**
- * @package pkg2
- */
-interface Foo {
- const FOOBAR = 0x1742;
- function x();
-}
-
-/**
- * @package pkg3
- */
-abstract class Bar implements Foo {private $foo = 17;
- protected abstract function y(Bar $bar);
-}
-
-/**
- * @package pkg1
- */
-class FooBar extends Bar {
- const FOO = 42;
-
- /**
- * My BAR constant.
- */
- const BAR = 23;
-
-
- private $x = 0x1234;
- protected $y = null;
- public $z = 'pdepend';
-
- public final function x() {}
- protected function y(Bar $bar) {
- if ($bar !== null) {
- $bar = new BarBaz($bar);
- }
- }
-}
-
-/**
- * Enter description here...
- *
- * @return string
- */
-function bar() {
- return 'bar';
-}
-
-$bar = new FooBar();
-$bar->y();
-
-/**
- * @package pkg42
- */
-class BarFoo {}
-?>
View
67 src/test/resources/files/Metrics/Hierarchy/testCalculatesExpectedNumberOfConcreteClasses.php
@@ -1,67 +0,0 @@
-<?php
-
-
-/**
- * @package pkg1
- */
-function foo($foo = array()) {
- foreach ($foo as $bar) {
- FooBar::y($bar);
- }
-}
-/**
- * @package pkg2
- */
-interface Foo {
- const FOOBAR = 0x1742;
- function x();
-}
-
-/**
- * @package pkg3
- */
-abstract class Bar implements Foo {private $foo = 17;
- protected abstract function y(Bar $bar);
-}
-
-/**
- * @package pkg1
- */
-class FooBar extends Bar {
- const FOO = 42;
-
- /**
- * My BAR constant.
- */
- const BAR = 23;
-
-
- private $x = 0x1234;
- protected $y = null;
- public $z = 'pdepend';
-
- public final function x() {}
- protected function y(Bar $bar) {
- if ($bar !== null) {
- $bar = new BarBaz($bar);
- }
- }
-}
-
-/**
- * Enter description here...
- *
- * @return string
- */
-function bar() {
- return 'bar';
-}
-
-$bar = new FooBar();
-$bar->y();
-
-/**
- * @package pkg42
- */
-class BarFoo {}
-?>
View
15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfClassesInPackages.php
@@ -1,15 +0,0 @@
-<?php
-namespace A {
- class A1 {}
- class A2 {}
- class A3 {}
-}
-
-namespace B {
- class B1 {}
- class B2 {}
-}
-
-namespace C {
- class C1 {}
-}
View
17 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfClassesInProject.php
@@ -1,17 +0,0 @@
-<?php
-namespace A {
- class A1 {
- private $x;
- }
- class A2 {}
- class A3 {}
-}
-
-namespace B {
- class B1 {}
- class B2 {}
-}
-
-namespace C {
- class C1 extends \B\B1 {}
-}
View
15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfFunctionsInPackages.php
@@ -1,15 +0,0 @@
-<?php
-namespace A {
- function a1() {}
- function a2() {}
- function a3() {}
-}
-
-namespace B {
- function b1() {}
- function b2() {}
-}
-
-namespace C {
- function c1() {}
-}
View
15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfFunctionsInProject.php
@@ -1,15 +0,0 @@
-<?php
-namespace A {
- function a1() {}
- function a2() {}
- function a3() {}
-}
-
-namespace B {
- function b1() {}
- function b2() {}
-}
-
-namespace C {
- function c1() {}
-}
View
15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfInterfacesInPackages.php
@@ -1,15 +0,0 @@
-<?php
-namespace A {
- interface I1 {}
-}
-
-namespace B {
- interface I1 {}
- interface I2 {}
-}
-
-namespace C {
- interface I1 {}
- interface I2 {}
- interface I3 {}
-}
View
18 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfInterfacesInProject.php
@@ -1,18 +0,0 @@
-<?php
-namespace A {
- interface I1 {}
- interface I2 {}
- interface I3 {}
-}
-
-namespace B {
- interface I1 {}
- interface I2 {}
- interface I3 {}
-}
-
-namespace C {
- interface I1 {}
- interface I2 {}
- interface I3 {}
-}
View
30 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfMethodsInPackages.php
@@ -1,30 +0,0 @@
-<?php
-namespace A {
- class A1 {
- function a1a() {}
- function a1b() {}
- }
- class A2 {
- function a2a() {}
- }
- interface A3 {
- function a3a();
- }
-}
-
-namespace B {
- interface B1 {
- function b1a();
- function b2a();
- }
- interface B2 {
- function b2a();
- }
-}
-
-namespace C {
- interface C1 {
- function c1a();
- function c2a();
- }
-}
View
15 src/test/resources/files/Metrics/NodeCount/testCalculatesExpectedNumberOfPackages.php
@@ -1,15 +0,0 @@
-<?php
-namespace A {
- class A1 {}
- class A2 {}
- class A3 {}
-}
-
-namespace B {
- class B1 {}
- class B2 {}
-}
-
-namespace C {
- class C1 {}
-}
View
48 src/test/resources/files/Metrics/NodeCount/testGetNodeMetricsOnNamespace.php
@@ -0,0 +1,48 @@
+<?php
+namespace A {
+ class A1 {
+ function a1a() {}
+ function a1b() {}
+ }
+ class A2 {
+ function a2a() {}
+ }
+ class A3 {}
+
+ interface I1 {
+ function i3a();
+ }
+
+ function a1() {}
+ function a2() {}
+ function a3() {}
+}
+
+namespace B {
+ class B1 {}
+ class B2 {}
+
+ interface I1 {
+ function i1a();
+ function i1b();
+ }
+ interface I2 {
+ function i2a();
+ }
+
+ function b1() {}
+ function b2() {}
+}
+
+namespace C {
+ class C1 {}
+
+ interface I1 {}
+ interface I2 {
+ function i1a();
+ function i1b();
+ }
+ interface I3 {}
+
+ function c1() {}
+}
View
56 src/test/resources/files/Metrics/NodeCount/testGetProjectMetricsReturnsExpectedSetOfMetrics.php
@@ -0,0 +1,56 @@
+<?php
+namespace A {
+ abstract class A1 {
+ public function a1a() {}
+ public function a1b() {}
+ }
+ abstract class A2 {}
+ class A3 {
+ public function a3a() {}
+ }
+
+ interface I1 {}
+ interface I2 {}
+ interface I3 {
+ public function i3a();
+ public function i3b();
+ }
+
+ function a1() {}
+ function a2() {}
+ function a3() {}
+}
+
+namespace B {
+ class B1 {
+ public function b1a() {}
+ public function b1b() {}
+ }
+ abstract class B2 {}
+
+ interface I1 {}
+ interface I2 {
+ public function i2a();
+ public function i2b();
+ }
+ interface I3 {
+ public function i3a();
+ }
+
+ function b1() {}
+ function b2() {}
+}
+
+namespace C {
+ abstract class C1 {
+ public function c1a() {}
+ public function c1b() {}
+ }
+
+ interface I1 {
+ public function i1a();
+ }
+ interface I2 {}
+
+ function c1() {}
+}
View
35 src/test/resources/files/Metrics/NodeCount/testNumberOfMethodsInProject.php
@@ -1,35 +0,0 @@
-<?php
-namespace A {
- class A1 {
- function a1a() {}
- function a1b() {}
- }
- class A2 {
- function a2a() {}
- }
- interface A3 {
- function a3a();
- }
-}
-
-namespace B {
- interface B1 {
- function b1a();
- function b2a();
- }
- interface B2 {
- function b2a();
- }
- class B3 {
- function b3a() {}
- function b3b() {}
- function b3c() {}
- }
-}
-
-namespace C {
- interface C1 {
- function c1a();
- function c2a();
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.