diff --git a/.gitignore b/.gitignore
index 92a9bbd..ea27d7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
vendor/
workbench/
.phpunit.result.cache
+.phpunit.cache/
+coverage.xml
diff --git a/phpunit.xml b/phpunit.xml
index dd49387..8ba5871 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,16 +1,27 @@
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
+ bootstrap="vendor/autoload.php"
+ cacheResultFile=".phpunit.cache/test-results"
+ executionOrder="depends,defects"
+ forceCoversAnnotation="true"
+ beStrictAboutCoversAnnotation="false"
+ beStrictAboutOutputDuringTests="true"
+ beStrictAboutTodoAnnotatedTests="true"
+ convertDeprecationsToExceptions="true"
+ failOnRisky="false"
+ failOnWarning="true"
+ verbose="true">
-
+
tests
-
-
-
+
+
+
+ src
+
+
diff --git a/src/BprofLib.php b/src/BprofLib.php
index 649bb5b..8ccc95a 100755
--- a/src/BprofLib.php
+++ b/src/BprofLib.php
@@ -161,18 +161,15 @@ public function computeExclusiveMetrics(array $perfdata, array &$symbolTab, arra
}
}
+
/**
- * Compute inclusive metrics for function. This code was factored out
- * of bprof_compute_flat_info().
+ * Computes the inclusive times and call count for each function in the given performance data.
*
- * The raw data contains inclusive metrics of a function for each
- * unique parent function it is called from. The total inclusive metrics
- * for a function is therefore the sum of inclusive metrics for the
- * function across all parents.
+ * @param array $perfdata The performance data containing parent-child relationships and metrics.
+ *
+ * @return array The computed inclusive times and call count for each function.
+ * @throws RuntimeException If the parent and child are the same.
*
- * @param array> $perfdata bprof format raw profiler data.
- * @return array> Returns a map of function name to total (across all parents) inclusive metrics for the function.
- * @covers BprofLib::computeInclusiveTimes
*/
public function computeInclusiveTimes(array $perfdata): array
{
diff --git a/tests/BprofLibTest.php b/tests/BprofLibTest.php
index 3d6d14c..24d652c 100644
--- a/tests/BprofLibTest.php
+++ b/tests/BprofLibTest.php
@@ -7,6 +7,7 @@
/**
* Tests for BprofLib class.
+ * @coversDefaultClass \Nexelity\Bprof\BprofLib
*/
class BprofLibTest extends TestCase
{
@@ -24,7 +25,7 @@ protected function setUp(): void
/**
* Tests initMetrics method.
* Asserts if metrics are initialized properly, without any errors.
- * @covers BprofLib::initMetrics
+ * @covers ::initMetrics
*/
public function testInitMetrics(): void
{
@@ -52,7 +53,7 @@ public function testInitMetrics(): void
/**
* Tests getPossibleMetrics methods.
* Asserts if method returns expected possible metrics.
- * @covers BprofLib::getPossibleMetrics
+ * @covers ::getPossibleMetrics
*/
public function testGetPossibleMetrics(): void
{
@@ -71,7 +72,7 @@ public function testGetPossibleMetrics(): void
/**
* Test to confirm that the getMetrics method
* in BprofLib returns the correct metric array
- * @covers BprofLib::getMetrics
+ * @covers ::getMetrics
*/
public function testGetMetrics(): void
{
@@ -106,7 +107,7 @@ public function testGetMetrics(): void
}
/**
- * @covers BprofLib::parseParentChild
+ * @covers ::parseParentChild
*/
public function testParseParentChild(): void
{
@@ -122,7 +123,7 @@ public function testParseParentChild(): void
}
/**
- * @covers BprofLib::computeFlatInfo
+ * @covers ::computeFlatInfo
*/
public function testComputeFlatInfo()
{
@@ -176,6 +177,7 @@ public function testComputeFlatInfo()
* 2. when a function call is part of the parent function but the parent function is not in the symbol table
* 3. when a function call is part of the parent function and the parent function is also in the symbol table
* 4. when a function call itself is the parent function
+ * @covers ::computeExclusiveMetrics
*/
public function testComputeExclusiveMetrics(): void
{
@@ -208,6 +210,10 @@ public function testComputeExclusiveMetrics(): void
}
+ /**
+ * @return void
+ * @covers ::computeInclusiveTimes
+ */
public function testComputeInclusiveTimes(): void
{
$perfData = [
diff --git a/tests/PerfDataTest.php b/tests/PerfDataTest.php
index c2755e7..620918b 100644
--- a/tests/PerfDataTest.php
+++ b/tests/PerfDataTest.php
@@ -21,6 +21,10 @@ protected function setUp(): void
$this->cast = new PerfData();
}
+ /**
+ * @return void
+ * @covers \Nexelity\Bprof\Casts\PerfData::get
+ */
#[Test]
public function testGet(): void
{
@@ -34,6 +38,10 @@ public function testGet(): void
$this->assertEquals(['foo' => 'bar'], $result);
}
+ /**
+ * @return void
+ * @covers \Nexelity\Bprof\Casts\PerfData::get
+ */
#[Test]
public function testGetNullValue(): void
{
@@ -43,6 +51,10 @@ public function testGetNullValue(): void
$this->cast->get($trace, '', null, []);
}
+ /**
+ * @return void
+ * @covers \Nexelity\Bprof\Casts\PerfData::get
+ */
#[Test]
public function testGetUnzippedFailure(): void
{