function TestBaseTest::getTestBaseForAssertionTests
Helper method for constructing a mock TestBase object.
TestBase is abstract, so we have to mock it. We'll also mock the storeAssertion() method so we don't need the database.
Parameters
string $test_id: An identifying name for the mocked test.
Return value
object Mock of Drupal\simpletest\TestBase.
15 calls to TestBaseTest::getTestBaseForAssertionTests()
- TestBaseTest::testAssert in core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php - @covers ::assert @dataProvider providerAssert
- TestBaseTest::testAssertEqual in core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php - @covers ::assertEqual @dataProvider providerEqualityAssertions
- TestBaseTest::testAssertFalse in core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php - @covers ::assertFalse @dataProvider providerAssertTrue
- TestBaseTest::testAssertIdentical in core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php - @covers ::assertIdentical @dataProvider providerEqualityAssertions
- TestBaseTest::testAssertIdenticalObject in core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php - @covers ::assertIdenticalObject @dataProvider providerAssertIdenticalObject
File
-
core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php, line 27
Class
- TestBaseTest
- @requires extension curl @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest @group TestBase
Namespace
Drupal\Tests\simpletest\UnitCode
public function getTestBaseForAssertionTests($test_id) {
$mock_test_base = $this->getMockBuilder('Drupal\\simpletest\\TestBase')
->setConstructorArgs([
$test_id,
])
->setMethods([
'storeAssertion',
])
->getMockForAbstractClass();
// Override storeAssertion() so we don't need a database.
$mock_test_base->expects($this->any())
->method('storeAssertion')
->will($this->returnValue(NULL));
return $mock_test_base;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.