public function MinisiteTestBase::browseFixtureMinisiteAliased in Mini site 8
Helper to browse aliased fixture pages.
2 calls to MinisiteTestBase::browseFixtureMinisiteAliased()
- UploadBrowseAliasPathautoTest::testUploadAndBrowsingAlias in tests/
src/ Functional/ UploadBrowseAliasPathautoTest.php - Tests ZIP file upload and browsing minisite pages with Pathauto alias.
- UploadBrowseAliasTest::testUploadAndBrowsingAlias in tests/
src/ Functional/ UploadBrowseAliasTest.php - Tests ZIP file upload and browsing minisite pages with alias.
File
- tests/
src/ Functional/ MinisiteTestBase.php, line 497
Class
- MinisiteTestBase
- Provides methods specifically for testing Minisite module's field handling.
Namespace
Drupal\Tests\minisite\FunctionalCode
public function browseFixtureMinisiteAliased($alias, $description, $assets_paths) {
$this
->drupalGet($alias);
$this
->assertResponse(200);
// Assert that a link to a minisite is present.
$this
->assertLink($description);
$this
->assertLinkByHref($alias . '/' . $assets_paths[0]);
// Start browsing the minisite.
$this
->clickLink($description);
// Assert first index path as aliased.
$this
->assertUrl($alias . '/' . $assets_paths[0]);
$this
->assertResponse(200);
$this
->assertHeader('Content-Type', 'text/html; charset=UTF-8');
// Brose minisite pages starting from index page.
$this
->assertText('Index page');
$this
->assertLink('Go to Page 1');
$this
->clickLink('Go to Page 1');
$this
->assertResponse(200);
$this
->assertHeader('Content-Type', 'text/html; charset=UTF-8');
$this
->assertText('Page 1');
$this
->assertUrl($alias . '/' . $assets_paths[1]);
$this
->assertLink('Go to Page 2');
$this
->clickLink('Go to Page 2');
$this
->assertResponse(200);
$this
->assertHeader('Content-Type', 'text/html; charset=UTF-8');
$this
->assertText('Page 2');
$this
->assertUrl($alias . '/' . $assets_paths[2]);
// Navigate to the page using URL with a query.
$this
->drupalGet($alias . '/' . $assets_paths[1], [
'query' => [
'param' => 'val',
],
'fragment' => 'someid',
]);
$this
->assertResponse(200);
$this
->assertHeader('Content-Type', 'text/html; charset=UTF-8');
// Get non-document file through an alias.
$this
->drupalGet($alias . '/' . $assets_paths[3]);
$this
->assertResponse(200);
$this
->assertHeader('Content-Type', 'image/jpeg');
$this
->assertHeader('Content-Length', (string) filesize($this
->getFixtureFileDir() . DIRECTORY_SEPARATOR . 'example.jpeg'));
}