You are here

protected function EntityLoadHelperTest::getEntityLoadHelperMock in YAML Content 8

Mock the EntityLoadHelper class to support test inspections.

Mock the EntityLoadHelper class with a configurable list of stubbed methods.

Parameters

array|null $stubbed_methods: (Optional) An array of method names to leave active on the mock object. All other declared methods on the ContentLoader class will be stubbed. If this argument is omitted all methods are mocked and execute their original code.

Return value

\PHPUnit_Framework_MockObject_MockObject The mocked ContentLoader object with

13 calls to EntityLoadHelperTest::getEntityLoadHelperMock()
EntityLoadHelperTest::setUpCategorizeAttributesTests in tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php
Prepare the EntityLoadHelper mock for testing categorizeAttributes.
EntityLoadHelperTest::testEntityExistsAttemptsToLoadEntity in tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php
Test entityExists uses content data to load matching entities.
EntityLoadHelperTest::testEntityExistsReturnsFalseWhenAnEntityIsNotLoaded in tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php
Test entityExists method returns false when an entity is not loaded.
EntityLoadHelperTest::testEntityExistsReturnsTrueWhenAnEntityIsLoaded in tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php
Test entityExists method returns true when an entity is loaded.
EntityLoadHelperTest::testExtractContentPropertiesOnlyReturnsProperties in tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php
Test extractContentProperties returns property attributes.

... See full list

File

tests/src/Unit/EntityLoadHelper/EntityLoadHelperTest.php, line 43

Class

EntityLoadHelperTest
Test functionality of the EntityLoadHelper class.

Namespace

Drupal\Tests\yaml_content\Unit\EntityLoadHelper

Code

protected function getEntityLoadHelperMock($stubbed_methods = NULL) {

  // Partially mock the ContentLoader for testing specific methods.
  $mock = $this
    ->getMockBuilder(EntityLoadHelper::class)
    ->disableOriginalConstructor()
    ->setMethods($stubbed_methods)
    ->getMock();
  return $mock;
}