protected function QuickEditEntityFieldAccessCheckTest::createMockEntity in Drupal 9
Same name and namespace in other branches
- 8 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 128
Class
- QuickEditEntityFieldAccessCheckTest
- @coversDefaultClass \Drupal\quickedit\Access\QuickEditEntityFieldAccessCheck @group Access @group quickedit
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;
}