protected function EntityConstraintViolationListTest::setupEntity in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::setupEntity()
Builds the entity.
Parameters
\Drupal\Core\Session\AccountInterface $account: An account.
Return value
\Drupal\Core\Field\FieldItemListInterface A fieldable entity.
4 calls to EntityConstraintViolationListTest::setupEntity()
- EntityConstraintViolationListTest::testFilterByFieldAccess in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFieldAccess
- EntityConstraintViolationListTest::testFilterByFieldAccessWithCompositeConstraint in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFieldAccess
- EntityConstraintViolationListTest::testFilterByFields in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFields
- EntityConstraintViolationListTest::testFilterByFieldsWithCompositeConstraints in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFields
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php, line 87
Class
- EntityConstraintViolationListTest
- @coversDefaultClass \Drupal\Core\Entity\EntityConstraintViolationList @group entity
Namespace
Drupal\Tests\Core\EntityCode
protected function setupEntity(AccountInterface $account) {
$prophecy = $this
->prophesize('\\Drupal\\Core\\Field\\FieldItemListInterface');
$prophecy
->access('edit', $account)
->willReturn(FALSE);
$name_field_item_list = $prophecy
->reveal();
$prophecy = $this
->prophesize('\\Drupal\\Core\\Field\\FieldItemListInterface');
$prophecy
->access('edit', $account)
->willReturn(TRUE);
$type_field_item_list = $prophecy
->reveal();
$prophecy = $this
->prophesize('\\Drupal\\Core\\Entity\\FieldableEntityInterface');
$prophecy
->hasField('name')
->willReturn(TRUE);
$prophecy
->hasField('type')
->willReturn(TRUE);
$prophecy
->get('name')
->willReturn($name_field_item_list);
$prophecy
->get('type')
->willReturn($type_field_item_list);
return $prophecy
->reveal();
}