protected function QuickEditEntityFieldAccessCheckTest::createMockEntity in Drupal 8
Same name and namespace in other branches
- 9 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')
->will($this
->returnValueMap([
[
LanguageInterface::LANGCODE_NOT_SPECIFIED,
TRUE,
],
[
'xx-lolspeak',
FALSE,
],
]));
$entity
->expects($this
->any())
->method('hasField')
->will($this
->returnValueMap([
[
'valid',
TRUE,
],
[
'not_valid',
FALSE,
],
]));
return $entity;
}