You are here

public function TestBaseTest::testError in Drupal 8

@covers ::error @dataProvider providerError

File

core/modules/simpletest/tests/src/Unit/TestBaseTest.php, line 437

Class

TestBaseTest
@requires extension curl @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest @group TestBase

Namespace

Drupal\Tests\simpletest\Unit

Code

public function testError($status, $group) {

  // Mock up a TestBase object.
  $mock_test_base = $this
    ->getMockBuilder('Drupal\\simpletest\\TestBase')
    ->setMethods([
    'assert',
  ])
    ->getMockForAbstractClass();

  // Set expectations for assert().
  $mock_test_base
    ->expects($this
    ->once())
    ->method('assert')
    ->with($status)
    ->willReturn("{$status}:{$group}");

  // Invoke error().
  $this
    ->assertEquals("{$status}:{$group}", $this
    ->invokeProtectedMethod($mock_test_base, 'error', [
    'msg',
    $group,
  ]));
}