protected function ContentLoaderTestBase::getContentLoaderMock in YAML Content 8
Mock the ContentLoader class to support test inspections.
Mock the ContentLoader 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
5 calls to ContentLoaderTestBase::getContentLoaderMock()
- ContentLoaderTest::testEmptyContentFile in tests/
src/ Unit/ ContentLoader/ ContentLoaderTest.php - Tests the correct return value when parsing an empty file.
- ContentLoaderTestBase::setUp in tests/
src/ Unit/ ContentLoader/ ContentLoaderTestBase.php - ExistenceCheckingTest::testBuildEntityCallsCreateEntity in tests/
src/ Unit/ ContentLoader/ ExistenceCheckingTest.php - Tests `buildEntity()` always calls `createEntity()`.
- ExistenceCheckingTest::testCreateEntityDoesCallEntityExistsWhenEnabled in tests/
src/ Unit/ ContentLoader/ ExistenceCheckingTest.php - Confirm createEntity does check for existing entities when enabled.
- ExistenceCheckingTest::testCreateEntityDoesNotCallEntityExistsWhenDisabled in tests/
src/ Unit/ ContentLoader/ ExistenceCheckingTest.php - Confirm createEntity doesn't check for existing entities when disabled.
File
- tests/
src/ Unit/ ContentLoader/ ContentLoaderTestBase.php, line 35
Class
- ContentLoaderTestBase
- Base test class for all ContentLoader testing.
Namespace
Drupal\Tests\yaml_content\Unit\ContentLoaderCode
protected function getContentLoaderMock($stubbed_methods = NULL) {
// Partially mock the ContentLoader for testing specific methods.
$this->contentLoader = $this
->getMockBuilder(ContentLoader::class)
->disableOriginalConstructor()
->setMethods($stubbed_methods)
->getMock();
return $this->contentLoader;
}