diff --git a/modules/video_embed_wysiwyg/config/install/image.style.video_embed_wysiwyg_preview.yml b/modules/video_embed_wysiwyg/config/install/image.style.video_embed_wysiwyg_preview.yml index e9b142f..f8f044f 100644 --- a/modules/video_embed_wysiwyg/config/install/image.style.video_embed_wysiwyg_preview.yml +++ b/modules/video_embed_wysiwyg/config/install/image.style.video_embed_wysiwyg_preview.yml @@ -1,9 +1,6 @@ langcode: en status: true -dependencies: - enforced: - module: - - video_embed_wysiwyg +dependencies: {} name: video_embed_wysiwyg_preview label: 'Video Embed Wysiwyg: Thumbnail Preview' effects: diff --git a/tests/src/Functional/InstallationTest.php b/tests/src/Functional/InstallationTest.php new file mode 100644 index 0000000..69b267c --- /dev/null +++ b/tests/src/Functional/InstallationTest.php @@ -0,0 +1,81 @@ +drupalLogin($this->createAdminUser()); + } + + /** + * Test the installation and uninstallation of the the modules. + */ + public function testInstallation() { + $this->assertInstallationStatus(FALSE); + $this->installModules(); + $this->assertInstallationStatus(TRUE); + $this->uninstallModules(); + $this->assertInstallationStatus(FALSE); + $this->installModules(); + $this->assertInstallationStatus(TRUE); + } + + /** + * Assert the installation status of the modules. + * + * @param bool $installed + * If the modules should be installed or not. + */ + protected function assertInstallationStatus($installed) { + $this->drupalGet('admin/modules'); + // @todo, add video_embed_media once infrastructure places version + // information in module info files. + foreach (['video_embed_field', 'video_embed_wyswiyg'] as $module) { + $this->getSession()->getPage()->{$installed ? 'hasCheckedField' : 'hasUncheckedField'}('modules[Video Embed Field][' . $module . '][enable]'); + } + } + + /** + * Uninstall the module using the UI. + */ + protected function uninstallModules() { + $this->drupalPostForm('admin/modules/uninstall', [ + 'uninstall[video_embed_wysiwyg]' => TRUE, + ], 'Uninstall'); + $this->getSession()->getPage()->pressButton('Uninstall'); + $this->drupalPostForm('admin/modules/uninstall', [ + 'uninstall[video_embed_field]' => TRUE, + ], 'Uninstall'); + $this->getSession()->getPage()->pressButton('Uninstall'); + } + + /** + * Install the modules using the UI. + */ + protected function installModules() { + $this->drupalPostForm('admin/modules', [ + 'modules[Video Embed Field][video_embed_field][enable]' => TRUE, + 'modules[Video Embed Field][video_embed_wysiwyg][enable]' => TRUE, + ], 'Install'); + // Continue is only required to confirm dependencies being enabled on the + // first call of this function. + if ($button = $this->getSession()->getPage()->findButton('Continue')) { + $button->press(); + } + } + +}