function MigrateSearchPageTest::assertEntity

Same name in other branches
  1. 9 core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d7\MigrateSearchPageTest::assertEntity()
  2. 8.9.x core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d7\MigrateSearchPageTest::assertEntity()
  3. 10 core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php \Drupal\Tests\search\Kernel\Migrate\d7\MigrateSearchPageTest::assertEntity()

Asserts various aspects of a SearchPage entity.

@internal

Parameters

string $id: The expected search page ID.

string $path: The expected path of the search page.

bool $status: The expected status of the search page.

array $expected_config: An array of expected configuration for the search page.

3 calls to MigrateSearchPageTest::assertEntity()
MigrateSearchPageTest::testModuleExists in core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
Tests that search page is only migrated for modules enabled on D8 site.
MigrateSearchPageTest::testSearchPage in core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
Tests migration of search status and settings to search page entity.
MigrateSearchPageTest::testUserSearchCreate in core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php
Tests that a search page will be created if it does not exist.

File

core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php, line 39

Class

MigrateSearchPageTest
Tests migration of search page status and settings.

Namespace

Drupal\Tests\search\Kernel\Migrate\d7

Code

protected function assertEntity(string $id, string $path, bool $status = FALSE, ?array $expected_config = NULL) : void {
    
    /** @var \Drupal\search\Entity\SearchPage $search_page */
    $search_page = SearchPage::load($id);
    $this->assertSame($id, $search_page->id());
    $this->assertSame($path, $search_page->getPath());
    $this->assertSame($status, $search_page->status());
    if (isset($expected_config)) {
        $configuration = $search_page->getPlugin()
            ->getConfiguration();
        $this->assertSame($expected_config, $configuration);
    }
}

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