You are here

protected function OEmbedResourceConstraintValidatorTest::getValue in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php \Drupal\Tests\media\Kernel\OEmbedResourceConstraintValidatorTest::getValue()
  2. 9 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.

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) {
    private $entity;
    public function __construct($entity) {
      $this->entity = $entity;
    }
    public function getEntity() {
      return $this->entity;
    }

  };
}