function QuickEditEntityFieldAccessCheckTest::createMockEntity
Same name in other branches
- 8.9.x core/modules/quickedit/tests/src/Unit/Access/QuickEditEntityFieldAccessCheckTest.php \Drupal\Tests\quickedit\Unit\Access\QuickEditEntityFieldAccessCheckTest::createMockEntity()
Returns a mock entity.
Return value
\Drupal\Core\Entity\EntityInterface|\PHPUnit\Framework\MockObject\MockObject
2 calls to QuickEditEntityFieldAccessCheckTest::createMockEntity()
- QuickEditEntityFieldAccessCheckTest::testAccess in core/
modules/ quickedit/ tests/ src/ Unit/ Access/ QuickEditEntityFieldAccessCheckTest.php - Tests the method for checking access to routes.
- QuickEditEntityFieldAccessCheckTest::testAccessForbidden in core/
modules/ quickedit/ tests/ src/ Unit/ Access/ QuickEditEntityFieldAccessCheckTest.php - Tests checking access to routes that result in AccessResult::isForbidden().
File
-
core/
modules/ quickedit/ tests/ src/ Unit/ Access/ QuickEditEntityFieldAccessCheckTest.php, line 129
Class
- QuickEditEntityFieldAccessCheckTest
- @coversDefaultClass \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck @group Access @group quickedit @group legacy
Namespace
Drupal\Tests\quickedit\Unit\AccessCode
protected function createMockEntity() {
$entity = $this->getMockBuilder('Drupal\\entity_test\\Entity\\EntityTest')
->disableOriginalConstructor()
->getMock();
$entity->expects($this->any())
->method('hasTranslation')
->willReturnMap([
[
LanguageInterface::LANGCODE_NOT_SPECIFIED,
TRUE,
],
[
'xx-lolspeak',
FALSE,
],
]);
$entity->expects($this->any())
->method('hasField')
->willReturnMap([
[
'valid',
TRUE,
],
[
'not_valid',
FALSE,
],
]);
return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.