Repository: phpbench/phpbench (php)

Issue:
Subject used as benchmark class in "default" report
Fixing would produce the following test failure:

```
 '+------+--------------+--------------+-----+------+----------+----------+--------------+----------------+\n
 | iter | benchmark    | subject      | set | revs | mem_peak | time_avg | comp_z_value | comp_deviation |\n
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+\n
-| 0    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |\n
+| 0    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |\n
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
```

Pull request description:
Fix incorrect report column definition, fixes #840

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d2b2084..4dd094a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,13 @@
 CHANGELOG
 =========
 
+1.0.x
+-----
+
+Bug fix:
+
+- Fix incorrect benchmark column definition in report #840
+
 1.0.1 (2021-05-11)
 ------------------
 
diff --git a/examples/Command/report-generators-composite b/examples/Command/report-generators-composite
index 1578a8d1..e655aa08 100644
--- a/examples/Command/report-generators-composite
+++ b/examples/Command/report-generators-composite
@@ -16,7 +16,7 @@ phpbench run --report=all
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
 | iter | benchmark    | subject      | set | revs | mem_peak | time_avg | comp_z_value | comp_deviation |
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
-| 0    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
+| 0    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
 
 
diff --git a/examples/Command/run-reports-default b/examples/Command/run-reports-default
index b6f8b35f..7d978a98 100644
--- a/examples/Command/run-reports-default
+++ b/examples/Command/run-reports-default
@@ -9,9 +9,9 @@ phpbench run --report=default --iterations=4
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
 | iter | benchmark    | subject      | set | revs | mem_peak | time_avg | comp_z_value | comp_deviation |
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
-| 0    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
-| 1    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
-| 2    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
-| 3    | benchNothing | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
+| 0    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
+| 1    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
+| 2    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
+| 3    | NothingBench | benchNothing | 0   | 1    | 100b     | 10.000μs | +0.00σ       | +0.00%         |
 +------+--------------+--------------+-----+------+----------+----------+--------------+----------------+
 
diff --git a/lib/Extension/config/report/generators.php b/lib/Extension/config/report/generators.php
index c8d4b521..e67f7fdf 100644
--- a/lib/Extension/config/report/generators.php
+++ b/lib/Extension/config/report/generators.php
@@ -31,7 +31,7 @@ return [
         'generator' => 'expression',
         'cols' => [
             'iter' => 'first(iteration_index)',
-            'benchmark' => 'first(subject_name)',
+            'benchmark' => 'first(benchmark_name)',
             'subject' => 'first(subject_name)',
             'set' => 'first(variant_name)',
             'revs' => 'first(variant_revs)',


Test patch:
diff --git a/tests/Integration/generator/default-csv b/tests/Integration/generator/default-csv
index 75927783..a9b6003d 100644
--- a/tests/Integration/generator/default-csv
+++ b/tests/Integration/generator/default-csv
@@ -1,3 +1,3 @@
 iter,benchmark,subject,set,revs,mem_peak,time_avg,comp_z_value,comp_deviation
-0,benchOne,benchOne,0,5,200,0,-1.00σ,-100.00%
-1,benchOne,benchOne,0,5,200,10,+1.00σ,+100.00%
+0,TestBench,benchOne,0,5,200,0,-1.00σ,-100.00%
+1,TestBench,benchOne,0,5,200,10,+1.00σ,+100.00%