InstallTest.php in Lightning Layout 8.2
File
modules/lightning_landing_page/tests/src/Functional/InstallTest.php
View source
<?php
namespace Drupal\Tests\lightning_landing_page\Functional;
use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
use Drupal\layout_library\Entity\Layout;
use Drupal\node\Entity\Node;
use Drupal\Tests\BrowserTestBase;
class InstallTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'lightning_landing_page',
'metatag',
];
public function testInstall() {
$node = Node::create([
'type' => 'landing_page',
]);
$this
->assertTrue($node
->hasField(OverridesSectionStorage::FIELD_NAME));
$account = $this
->drupalCreateUser([
'create landing_page content',
]);
$this
->drupalLogin($account);
$this
->drupalGet('/node/add/landing_page');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->fieldNotExists('Layout');
$meta_tags = $this
->getSession()
->getPage()
->findAll('css', '[name^="field_meta_tags[0]["]');
$this
->assertGreaterThan(0, count($meta_tags));
Layout::create([
'id' => 'test_layout',
'label' => 'Test Layout',
'targetEntityType' => 'node',
'targetBundle' => 'landing_page',
])
->save();
$this
->getSession()
->reload();
$this
->assertSession()
->optionExists('Layout', 'Test Layout');
}
}
Classes
Name |
Description |
InstallTest |
Tests install-time logic of Lightning Landing Page. |