You are here

protected function OEmbedResourceConstraintValidatorTest::getValue in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php \Drupal\Tests\media\Kernel\OEmbedResourceConstraintValidatorTest::getValue()

Wraps a media entity in an anonymous class to mock a field value.

Parameters

\Drupal\media\Entity\Media $media: The media object.

Return value

object The mock field value to validate.

2 calls to OEmbedResourceConstraintValidatorTest::getValue()
OEmbedResourceConstraintValidatorTest::testValidateEmptySource in core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php
@covers ::validate
OEmbedResourceConstraintValidatorTest::testValidateUrlResolverInvoked in core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php
@covers ::validate

File

core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php, line 104

Class

OEmbedResourceConstraintValidatorTest
@coversDefaultClass \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraintValidator

Namespace

Drupal\Tests\media\Kernel

Code

protected function getValue(Media $media) {
  return new class($media) {
    public function __construct($entity) {
      $this->entity = $entity;
    }
    public function getEntity() {
      return $this->entity;
    }

  };
}