You are here

protected function ConstraintsTest::getMockFieldItem in Media entity Twitter 8

Creates a string_long FieldItemInterface wrapper around a value.

Parameters

string $value: The wrapped value.

Return value

\Drupal\Core\Field\FieldItemInterface Mocked string field item.

3 calls to ConstraintsTest::getMockFieldItem()
ConstraintsTest::testBadUrlsOnVisibleConstraint in tests/src/Unit/ConstraintsTest.php
Tests whether the TweetVisible constraint is robust against bad URLs.
ConstraintsTest::testTweetEmbedCodeConstraint in tests/src/Unit/ConstraintsTest.php
Tests TweetEmbedCode constraint.
ConstraintsTest::testTweetVisibleConstraint in tests/src/Unit/ConstraintsTest.php
Tests TweetVisible constraint.

File

tests/src/Unit/ConstraintsTest.php, line 29

Class

ConstraintsTest
Tests media_entity_twitter constraints.

Namespace

Drupal\Tests\media_entity_twitter\Unit

Code

protected function getMockFieldItem($value) {
  $definition = $this
    ->prophesize(ComplexDataDefinitionInterface::class);
  $definition
    ->getPropertyDefinitions()
    ->willReturn([]);
  $item = new StringLongItem($definition
    ->reveal());
  $item
    ->set('value', $value);
  return $item;
}