You are here

protected function FieldRawValueTest::mockFieldItem in Twig Field Value 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/FieldValue/FieldRawValueTest.php \Drupal\Tests\twig_field_value\Unit\FieldValue\FieldRawValueTest::mockFieldItem()

Returns a mock FieldItem.

Parameters

mixed $values:

Return value

\Drupal\Core\Field\FieldItemBase

1 call to FieldRawValueTest::mockFieldItem()
FieldRawValueTest::providerTestRawValues in tests/src/Unit/FieldValue/FieldRawValueTest.php
Provides data and expected results for the test method.

File

tests/src/Unit/FieldValue/FieldRawValueTest.php, line 35

Class

FieldRawValueTest
@coversDefaultClass \Drupal\twig_field_value\Twig\Extension\FieldValueExtension @group twig_field_value

Namespace

Drupal\Tests\twig_field_value\Unit\FieldValue

Code

protected function mockFieldItem($values) {
  $field_item = $this
    ->getMockBuilder('Drupal\\Core\\Field\\FieldItemBase')
    ->disableOriginalConstructor()
    ->getMock();
  $field_item
    ->expects($this
    ->any())
    ->method('getValue')
    ->will($this
    ->returnValue($values));
  return $field_item;
}