function MenuLinkParentTest::testConstructorException

Tests that an exception is thrown for invalid options.

@dataProvider providerConstructorException

Parameters

array $configuration: The plugin configuration being tested.

bool $is_valid: TRUE if the configuration is valid, FALSE if not.

File

core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php, line 92

Class

MenuLinkParentTest
Tests the menu link parent process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testConstructorException(array $configuration, bool $is_valid) : void {
    if (!$is_valid) {
        $this->expectException('TypeError');
        $this->expectExceptionMessage('Cannot assign string to property ' . MenuLinkParent::class . '::$lookupMigrations of type array');
    }
    $plugin = new MenuLinkParent($configuration, 'map', [], $this->migrateLookup
        ->reveal(), $this->menuLinkManager
        ->reveal(), $this->menuLinkStorage
        ->reveal(), $this->migration
        ->reveal());
    if ($is_valid) {
        $this->assertInstanceOf(MenuLinkParent::class, $plugin);
    }
}

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