function TestRunTest::testProcessPhpErrorLogFile

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php \Drupal\KernelTests\Core\Test\TestRunTest::testProcessPhpErrorLogFile()

@covers ::createNew @covers ::setDatabasePrefix @covers ::processPhpErrorLogFile @covers ::getLogEntriesByTestClass

File

core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php, line 156

Class

TestRunTest
@coversDefaultClass \Drupal\Core\Test\TestRun @group Test

Namespace

Drupal\KernelTests\Core\Test

Code

public function testProcessPhpErrorLogFile() : void {
    $test_run = TestRun::createNew($this->testRunResultsStorage);
    $test_run->setDatabasePrefix('oddity1234');
    $test_run->processPhpErrorLogFile('core/tests/fixtures/test-error.log', 'Test\\PlanetEarth');
    $this->assertEquals([
        0 => (object) [
            'message_id' => '1',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "Argument 1 passed to Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer::Drupal\\FunctionalTests\\Bootstrap\\{closure}() must be an instance of Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer, int given, called",
            'message_group' => 'TypeError',
            'function' => 'Unknown',
            'line' => '18',
            'file' => '/var/www/core/tests/Drupal/FunctionalTests/Bootstrap/ErrorContainer.php on line 20 in /var/www/core/tests/Drupal/FunctionalTests/Bootstrap/ErrorContainer.php',
        ],
        1 => (object) [
            'message_id' => '2',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#1 /var/www/core/lib/Drupal/Core/DrupalKernel.php(1396): Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer->get('http_kernel')\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        2 => (object) [
            'message_id' => '3',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#2 /var/www/core/lib/Drupal/Core/DrupalKernel.php(693): Drupal\\Core\\DrupalKernel->getHttpKernel()\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        3 => (object) [
            'message_id' => '4',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#3 /var/www/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        4 => (object) [
            'message_id' => '5',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#4 {main}\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        5 => (object) [
            'message_id' => '6',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "Thrown exception during Container::get",
            'message_group' => 'Exception',
            'function' => 'Unknown',
            'line' => '17',
            'file' => '/var/www/core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php',
        ],
        6 => (object) [
            'message_id' => '7',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#1 /var/www/core/lib/Drupal/Core/DrupalKernel.php(693): Drupal\\Core\\DrupalKernel->getHttpKernel()\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        7 => (object) [
            'message_id' => '8',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#2 /var/www/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
        8 => (object) [
            'message_id' => '9',
            'test_id' => '1',
            'test_class' => 'Test\\PlanetEarth',
            'status' => 'fail',
            'message' => "#3 {main}\n",
            'message_group' => 'Fatal error',
            'function' => 'Unknown',
            'line' => '0',
            'file' => 'Unknown',
        ],
    ], $test_run->getLogEntriesByTestClass());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.