You are here

protected function EntityConstraintViolationListTest::setupEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 92
Contains \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest.

Class

EntityConstraintViolationListTest
@coversDefaultClass \Drupal\Core\Entity\EntityConstraintViolationList @group entity

Namespace

Drupal\Tests\Core\Entity

Code

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();
}