You are here

class TestMediaEntityConstraints in Media entity slideshow 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/ConstraintsTest.php \Drupal\Tests\media_entity_slideshow\Unit\TestMediaEntityConstraints

Mock class to test the ItemsCount constraint.

Hierarchy

Expanded class hierarchy of TestMediaEntityConstraints

File

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

Namespace

Drupal\Tests\media_entity_slideshow\Unit
View source
class TestMediaEntityConstraints {

  /**
   * The source field names.
   *
   * @var array
   */
  protected $sourceFields = array();

  /**
   * TestMediaEntityConstraints constructor.
   *
   * @param string $name
   *   The source field name used for this test.
   * @param string|null $value
   *   (optional) The source field value used for this test.
   */
  public function __construct($name, $value = NULL) {
    $this->sourceFields[$name] = new TestField($value);
  }

  /**
   * Mocks get() on \Drupal\Core\Entity\FieldableEntityInterface.
   */
  public function get($name) {
    return $this->sourceFields[$name];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestMediaEntityConstraints::$sourceFields protected property The source field names.
TestMediaEntityConstraints::get public function Mocks get() on \Drupal\Core\Entity\FieldableEntityInterface.
TestMediaEntityConstraints::__construct public function TestMediaEntityConstraints constructor.