You are here

public function TestBaseTest::testError in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/tests/src/Unit/TestBaseTest.php \Drupal\Tests\simpletest\Unit\TestBaseTest::testError()

@covers ::error @dataProvider providerError

File

core/modules/simpletest/tests/src/Unit/TestBaseTest.php, line 440
Contains \Drupal\Tests\simpletest\Unit\TestBaseTest.

Class

TestBaseTest
@coversDefaultClass \Drupal\simpletest\TestBase @group simpletest

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(array(
    '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', array(
    'msg',
    $group,
  )));
}