class BookInstallTest
Same name and namespace in other branches
- 10 core/modules/book/tests/src/Kernel/BookInstallTest.php \Drupal\Tests\book\Kernel\BookInstallTest
- 8.9.x core/modules/book/tests/src/Kernel/BookInstallTest.php \Drupal\Tests\book\Kernel\BookInstallTest
Test installation of Book module.
@group book
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\book\Kernel\BookInstallTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of BookInstallTest
File
-
core/
modules/ book/ tests/ src/ Kernel/ BookInstallTest.php, line 13
Namespace
Drupal\Tests\book\KernelView source
class BookInstallTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'system',
];
/**
* Tests Book install with pre-existing content type.
*
* Tests that Book module can be installed if content type with machine name
* 'book' already exists.
*/
public function testBookInstallWithPreexistingContentType() {
// Create a 'book' content type.
NodeType::create([
'type' => 'book',
])->save();
// Install the Book module. Using the module installer service ensures that
// all the install rituals, including default and optional configuration
// import, are performed.
$status = $this->container
->get('module_installer')
->install([
'book',
]);
$this->assertTrue($status, 'Book module installed successfully');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.