function OEmbedResourceConstraintValidatorTest::getValue

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

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

};
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.