You are here

public function TestBaseTest::getTestBaseForAssertionTests 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::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

... See full list

File

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

Class

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

Namespace

Drupal\Tests\simpletest\Unit

Code

public function getTestBaseForAssertionTests($test_id) {
  $mock_test_base = $this
    ->getMockBuilder('Drupal\\simpletest\\TestBase')
    ->setConstructorArgs(array(
    $test_id,
  ))
    ->setMethods(array(
    '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;
}