This is a follow-on from #3109923: Deprecation: add $defaultTheme - create FormWidgetBrowserTestBase class which adds a new FormWidgetBrowserTestBase class.

In that base class we can define protected functions assertIsApplicable($widget, $type) and assertIsNotApplicable($widget, $type) to simplify the testIsApplicable function then the subclasses don't need to deal with DataDefinition at all.

Instead of the subclasses having to do $this->assertFalse($this->widget->isApplicable(DataDefinition::create('boolean'))); etc, this will now be in the helper function, and the subclasses just substitute $this->assertIsApplicable($this->widget, 'boolean'); etc.

Credit to TR for this idea

Issue fork typed_data-3110036

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes

Actually I don't think we need to pass $this->widget as the first parameter, as that is consistent for all calls and can be accessed directly from the base class. We only need to pass the datatype that is being checked.

tr’s picture

Yes, once $widgetId is straightened out and available in the base class(#3109923-7: Deprecation: add $defaultTheme - create FormWidgetBrowserTestBase class), there will be no need to pass $this->widget since that will be assigned in the base class.

jonathan1055’s picture

tr’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
jonathan1055’s picture

Status: Postponed » Active
tr’s picture

Version: 2.0.x-dev » 2.1.x-dev