function TestBaseTest::testError
@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\UnitCode
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,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.