PhpBench\Tests\Unit\Report\Generator\TableGeneratorTest::testAggregate PHP Method

testAggregate() public method

It should build an aggregate table.
public testAggregate ( )
    public function testAggregate()
    {
        $collection = TestUtil::createCollection([['benchmarks' => ['oneBench', 'twoBench'], 'subjects' => ['subjectOne', 'subjectTwo'], 'output_time_unit' => 'milliseconds', 'output_time_precision' => 7, 'output_mode' => 'throughput', 'groups' => ['one', 'two', 'three'], 'break' => []]]);
        $report = $this->generate($collection);
        $this->assertXPathCount($report, 1, '//table');
        $this->assertXPathCount($report, 4, '//row');
        $this->assertXPathCount($report, 4, '//row[formatter-param[@name="output_time_unit"] = "milliseconds"]');
        $this->assertXPathCount($report, 4, '//row[formatter-param[@name="output_mode"] = "throughput"]');
        $this->assertXPathCount($report, 4, '//row[formatter-param[@name="output_time_precision"] = 7]');
        $this->assertXPathCount($report, 4, '//row[formatter-param[@name="output_time_precision"] = 7]');
        $this->assertXPathCount($report, 4, '//cell[@name="best"]');
        $this->assertXPathCount($report, 4, '//cell[@name="worst"]');
        $this->assertXPathCount($report, 2, '//cell[text() = "oneBench"]');
        $this->assertXPathCount($report, 2, '//cell[text() = "subjectOne"]');
        $this->assertXPathCount($report, 2, '//cell[text() = "subjectTwo"]');
        $this->assertXPathEval($report, 'one,two,three', 'string(//cell[@name="groups"])');
        $this->assertXPathEval($report, '{"param1":"value1"}', 'string(//cell[@name="params"])');
        $this->assertXPathEval($report, 5, 'string(//cell[@name="revs"])');
        $this->assertXPathEval($report, 2, 'string(//cell[@name="its"])');
        $this->assertXPathEval($report, '200', 'string(//cell[@name="mem_peak"])');
        $this->assertXPathEval($report, '2.000', 'string(//cell[@name="best"])');
        $this->assertXPathEval($report, '3.000', 'string(//cell[@name="mean"])');
        $this->assertXPathEval($report, '3.200', 'string(//row[2]//cell[@name="mean"])');
        $this->assertXPathEval($report, '4.000', 'string(//cell[@name="worst"])');
        $this->assertXPathEval($report, '1.000', 'string(//cell[@name="stdev"])');
        $this->assertXPathEval($report, '33.333333333333', 'string(//cell[@name="rstdev"])');
        $this->assertXPathEval($report, '0', 'string(//cell[@name="diff"])');
        $this->assertXPathEval($report, '6.6666666666667', 'string(//row[2]//cell[@name="diff"])');
    }