You are here

public function TextInputWidgetTest::testIsApplicable in Typed Data API enhancements 8

@covers ::isApplicable

Overrides FormWidgetBrowserTestBase::testIsApplicable

File

tests/src/Functional/TypedDataFormWidget/TextInputWidgetTest.php, line 37

Class

TextInputWidgetTest
Class TextInputWidgetTest.

Namespace

Drupal\Tests\typed_data\Functional\TypedDataFormWidget

Code

public function testIsApplicable() {
  $this
    ->assertFalse($this->widget
    ->isApplicable(DataDefinition::create('any')));
  $this
    ->assertFalse($this->widget
    ->isApplicable(DataDefinition::create('binary')));
  $this
    ->assertFalse($this->widget
    ->isApplicable(DataDefinition::create('boolean')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('datetime_iso8601')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('duration_iso8601')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('email')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('float')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('integer')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('string')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('timespan')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('timestamp')));
  $this
    ->assertTrue($this->widget
    ->isApplicable(DataDefinition::create('uri')));
  $this
    ->assertFalse($this->widget
    ->isApplicable(ListDataDefinition::create('string')));
  $this
    ->assertFalse($this->widget
    ->isApplicable(MapDataDefinition::create()));
}