Skip to content

The code line $this->run(); not find in the file TestRunnerHTML.php #3

@CesarBetancurth

Description

@CesarBetancurth

When we chose the method of test runner " TestRunnerHTML ()" this does not work well because the line code: $this->run(); is not in the " TestRunnerHTML.php " file.

Here the solution and use:
1.
In the "TestRunnerHTML.php" file, modify the function get_output()

<?php
class TestRunnerHTML extends TestRunner 
{
    protected $total_results = 0;
    protected $total_failed = 0;
    protected $total_assertions = 0;

    public function get_output()
    {   

        $this-> run();  //**Add this line**

        $output = "";
        foreach($this->get_results() as $case_name => $test_results)
        {
            $output .= $this->get_case_results($case_name, $test_results);
        }

        return $this->summary().$output;
    }...

In the test script in step three (3) , change the method of test runner and then print the HTML echo result , as detailed below:

 // 3. Choose a TestRunner and add your TestCase

$runner = new TestRunnerHTML();
$runner ->add_test_case(new TestCaseMyClass());
echo $runner->get_output(); //**Print the result HTML**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions