Skip to content
Snippets Groups Projects
Commit dd5018c2 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3113113: Drupal 9 readiness for [Varbase distribution] installation...

Issue #3113113: Drupal 9 readiness for [Varbase distribution] installation profile with Drupal coding standard and practice
parent 5d51369d
No related branches found
No related tags found
No related merge requests found
......@@ -15,4 +15,4 @@ span .cke_button__embed_icon {
span .cke_button__media_icon {
background-image: url('../images/embed-media.png') !important;
}
\ No newline at end of file
}
......@@ -67,13 +67,17 @@ class ConfigBit {
* Get a list of sub list of config.
*
* @param string $config_bit_file_name
* Config bit file name in the root configbit folder.
* The Config bit file name in the root configbit folder.
* @param string $condition_name
* Condition name in the config bit file.
* The Condition name in the config bit file.
* @param string|bool $condition_value
* Condition value for the condition name in the config bit file.
* The Condition value for the condition name in the config bit file.
* @param string $sublist
* Sub list item name to get a sub list of data. not all the list.
* The Sub list item name to get a sub list of data. not all the list.
* @param string $type
* The type of profile.
* @param string $project
* The project.
*
* @return array
* Get List config as an array.
......@@ -101,14 +105,18 @@ class ConfigBit {
}
/**
* Applay the action of archive files to the given config bit file.
* Apply the action of archive files to the given config bit file.
*
* @param string $config_bit_file_name
* Config bit file name in the root configbit folder.
* The Config bit file name in the root configbit folder.
* @param string $condition_name
* Condition name in the config bit file.
* The Condition name in the config bit file.
* @param string|bool $condition_value
* Condition value for the condition name in the config bit file.
* The Condition value for the condition name in the config bit file.
* @param string $type
* The type of profile.
* @param string $project
* The project.
*/
public static function actionArchiveFiles($config_bit_file_name, $condition_name, $condition_value, $type = 'profile', $project = 'varbase') {
$config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
......@@ -133,7 +141,7 @@ class ConfigBit {
}
/**
* Applay the action of Un archive files to the given config bit file.
* Apply the action of Un archive files to the given config bit file.
*
* @param string $config_bit_file_name
* Config bit file name in the root configbit folder.
......@@ -141,6 +149,10 @@ class ConfigBit {
* Condition name in the config bit file.
* @param string|bool $condition_value
* Condition value for the condition name in the config bit file.
* @param string $type
* The type of profile.
* @param string $project
* The project.
*/
public static function actionUnArchiveFiles($config_bit_file_name, $condition_name, $condition_value, $type = 'profile', $project = 'varbase') {
$config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
......@@ -164,16 +176,20 @@ class ConfigBit {
}
/**
* Applay the action of adding config bit in to the parent file.
* Apply the action of adding config bit in to the parent file.
*
* @param string $config_bit_file_name
* Config bit file name in the root configbit folder.
* The Config bit file name in the root configbit folder.
* @param string $condition_name
* Condition name in the config bit file.
* The Condition name in the config bit file.
* @param string|bool $condition_value
* Condition value for the condition name in the config bit file.
* The Condition value for the condition name in the config bit file.
* @param string $target
* Targent item in the parent config file.
* The Target item in the parent config file.
* @param string $type
* The type of profile.
* @param string $project
* The project.
*/
public static function actionAdd($config_bit_file_name, $condition_name, $condition_value, $target, $type = 'profile', $project = 'varbase') {
$config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
......@@ -211,16 +227,20 @@ class ConfigBit {
}
/**
* Applay the action of removing config bit from the parent file.
* Apply the action of removing config bit from the parent file.
*
* @param string $config_bit_file_name
* Config bit file name in the root configbit folder.
* The Config bit file name in the root configbit folder.
* @param string $condition_name
* Condition name in the config bit file.
* The Condition name in the config bit file.
* @param string|bool $condition_value
* Condition value for the condition name in the config bit file.
* The Condition value for the condition name in the config bit file.
* @param string $target
* Targent item in the parent config file.
* The Target item in the parent config file.
* @param string $type
* The type of profile.
* @param string $project
* The project.
*/
public static function actionRemove($config_bit_file_name, $condition_name, $condition_value, $target, $type = 'profile', $project = 'varbase') {
$config_bit_data = ConfigBit::getConfigBit($config_bit_file_name, $type, $project);
......
......@@ -68,14 +68,14 @@ final class VarbaseEntityDefinitionUpdateManager implements ContainerInjectionIn
*
* @param \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $entity_definition_update_manager
* The entity definition update manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
* @param \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository
* The last installed schema repository service.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
* @param \Drupal\Core\Entity\EntityTypeListenerInterface $entity_type_listener
* The entity type listener interface.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager service.
* @param \Drupal\Core\Field\FieldStorageDefinitionListenerInterface $field_storage_definition_listener
* The field storage definition listener service.
*/
......@@ -99,7 +99,7 @@ final class VarbaseEntityDefinitionUpdateManager implements ContainerInjectionIn
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
/** @noinspection PhpParamsInspection */
// @noinspection PhpParamsInspection.
return new static(
$container->get('entity.definition_update_manager'),
$container->get('entity.last_installed_schema.repository'),
......
......@@ -8,11 +8,16 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
* Defines form for selecting Varbase's Multiligual configuration options form.
*/
class ConfigureMultilingualForm extends FormBase {
class ConfigureMultilingualForm extends FormBase implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The Drupal application root.
......@@ -35,6 +40,13 @@ class ConfigureMultilingualForm extends FormBase {
*/
protected $formHelper;
/**
* The config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Configure Multilingual Form constructor.
*
......@@ -46,12 +58,15 @@ class ConfigureMultilingualForm extends FormBase {
* The string translation service.
* @param \Drupal\varbase\Form\FormHelper $form_helper
* The form helper.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
*/
public function __construct($root, InfoParserInterface $info_parser, TranslationInterface $translator, FormHelper $form_helper) {
public function __construct($root, InfoParserInterface $info_parser, TranslationInterface $translator, FormHelper $form_helper, ConfigFactoryInterface $config_factory) {
$this->root = $root;
$this->infoParser = $info_parser;
$this->stringTranslation = $translator;
$this->formHelper = $form_helper;
$this->configFactory = $config_factory;
}
/**
......@@ -59,10 +74,11 @@ class ConfigureMultilingualForm extends FormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->get('info_parser'),
$container->get('string_translation'),
$container->get('varbase.form_helper')
$container->get('app.root'),
$container->get('info_parser'),
$container->get('string_translation'),
$container->get('varbase.form_helper'),
$container->get('config.factory')
);
}
......@@ -88,7 +104,7 @@ class ConfigureMultilingualForm extends FormBase {
}
asort($select_options);
$default_langcode = \Drupal::configFactory()->getEditable('system.site')->get('default_langcode');
$default_langcode = $this->configFactory->getEditable('system.site')->get('default_langcode');
// Save the default language name.
$default_language_name = $select_options[$default_langcode];
......
......@@ -66,7 +66,7 @@ function varbase_auth_submit_formbit(array $editable_config_values) {
if (isset($auth_modules) && is_array($auth_modules) && count($auth_modules) > 0) {
$modules_to_install = [];
foreach ($auth_modules as $auth_module_index => $auth_module) {
foreach ($auth_modules as $auth_module) {
if (is_string($auth_module)) {
array_push($modules_to_install, $auth_module);
}
......
......@@ -174,6 +174,7 @@ class ScriptHandler {
* Find and return the path to .git repository in root folder.
*
* @param string $root
* The Drupal root directory.
*/
private static function removeWindowsGitDirectories($root) {
foreach (scandir($root) as $dirOrFile) {
......@@ -194,6 +195,7 @@ class ScriptHandler {
* Remove a directory on Windows.
*
* @param string $dirname
* The directory name.
*/
private static function rmdirWindows($dirname) {
if (is_file($dirname)) {
......
<?php
/**
* @file
*/
namespace Drupal\varbase\tests\features\bootstrap\SelectorsContext;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Selector\CssSelector;
use Behat\Mink\Selector\NamedSelector;
use Behat\Mink\Exception\ExpectationException;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Symfony\Component\Yaml\Yaml;
/**
......@@ -27,14 +17,14 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
*
* @var array
*/
protected $cssSelectors = array();
protected $cssSelectors = [];
/**
* Holed a list of XPaht Selectors.
*
* @var array
*/
protected $xpathSelectors = array();
protected $xpathSelectors = [];
/**
* Holed the file path for where we could have selector files.
......@@ -111,6 +101,8 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* Register Selectors.
*
* @BeforeStep @javascript
*/
public function registerSelectors() {
......@@ -130,9 +122,9 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #Selector : To add a new selector name with a css selector.
* Selector : To add a new selector name with a css selector.
*
* Exmaple 1: When I add "mobile logo" selector for "header img#logo" css selector
* Example 1: When I add "mobile logo" selector for "header img#logo" css selector
* Example 2: And I add "breadcrumb" selector for ".breadcrumb" css selector
* Example 3: And I add "breadcrumb first link" selector for ".breadcrumb li:nth-child(1) a" css selector.
*
......@@ -172,7 +164,7 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #Selector : To add a new selector name with a XPath selector.
* Selector : To add a new selector name with a XPath selector.
*
* Exmaple 1: When I add "page title" selector for "//h1[contains(@class, 'page-header')" xpath selector
* Example 2: And I add "Dashboard" selector for "//*[@id='navbar-link-admin-dashboard']" xpath selector
......@@ -195,7 +187,7 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
*
* @When /^I add "(?P<selectorName>[^"]*)" selector for "(?P<xpathSelector>[^"]*)" xpath selector$/
*/
public function addSelectorNameForXPathSelector($selectorName, $xpathSelector) {
public function addSelectorNameForXpathSelector($selectorName, $xpathSelector) {
if (!empty($selectorName) && $selectorName != '' && !empty($xpathSelector) && $xpathSelector != '') {
// Add the selector name for the XPath selector to the selectors array.
$this->xpathSelectors[$selectorName] = $xpathSelector;
......@@ -210,15 +202,15 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #Selector : To add a new selector name with a css selector.
* Selector : To add a new selector name with a css selector.
*
* Exmaple 1: When I load selectors from "" file
* Example 1: When I load selectors from "" file
* Example 2: And I add "breadcrumb" selector for ".breadcrumb" css selector
* Example 3: And I add "breadcrumb first link" selector for ".breadcrumb li:nth-child(1) a" css selector.
*
* @When /^I add selectors from "(?P<fileName>[^"]*)" file$/
*/
public function IAddSelectorsFromFile($fileName) {
public function iAddSelectorsFromFile($fileName) {
if (!empty($fileName) && $fileName != '' &&
isset($this->filesPath) && $this->filesPath != '') {
......@@ -268,9 +260,9 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #Selector : To print list of CSS selectors which has been registered.
* Selector: To print list of CSS selectors which has been registered.
*
* Exmaple : When I print css selectors.
* Example: When I print css selectors.
*
* @Then /^(?:|I )print css selectors$/
*/
......@@ -279,53 +271,53 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #Selector : To print list of XPath selectors which has been registered.
* Selector: To print list of XPath selectors which has been registered.
*
* Exmaple : When I print xpath selectors.
* Example: When I print xpath selectors.
*
* @Then /^(?:|I )print xpath selectors$/
*/
public function printXPathSelectors() {
public function printXpathSelectors() {
echo Yaml::dump($this->xpathSelectors);
}
/**
* #vardot : Move the focus to selected field input element.
* Move the focus to selected field input element.
*
* Example #1: When I move focus to "Title" field
* Example #2: And I move focus to "Body" field.
*
* @When /^(?:|I )move focus to "(?P<selectedField>[^"]*)" field$/
*/
function moveFocusToField($selectedField) {
public function moveFocusToField($selectedField) {
$field = $this->getSession()->getPage()->findField($selectedField);
$fieldid = $field->getAttribute('id');
$this->getSession()->getDriver()->evaluateScript("jQuery('#{$fieldid}').focus();");
}
/**
* #vardot : Select all text in selected field input element.
* Select all text in selected field input element.
*
* Example #1: When I select all text in "Title" field
* Example #2: And I select all text in "Description" field.
*
* @When /^(?:|I )select all text in "(?P<selectedField>[^"]*)" field$/
*/
function selectAllTextInField($selectedField) {
public function selectAllTextInField($selectedField) {
$field = $this->getSession()->getPage()->findField($selectedField);
$fieldid = $field->getAttribute('id');
$this->getSession()->getDriver()->evaluateScript('document.getElementById("' . $fieldid . '").select();');
}
/**
* #vardot : Select part of the text in selected field input element.
* Select part of the text in selected field input element.
*
* Example #1: When I select from 0 to 5 text in "Title" field
* Example #2: And I select from 0 to 5 text in "Description" field.
*
* @When /^(?:|I )select from (?P<from>\d+) to (?P<to>\d+) text in "(?P<selectedField>[^"]*)" field$/
*/
function setSelectionRangeFromField($from, $to, $selectedField) {
public function setSelectionRangeFromField($from, $to, $selectedField) {
$field = $this->getSession()->getPage()->findField($selectedField);
$fieldid = $field->getAttribute('id');
......@@ -341,14 +333,14 @@ class SelectorsContext extends RawDrupalContext implements SnippetAcceptingConte
}
/**
* #vardot : Select a part text in selected field input element.
* Select a part text in selected field input element.
*
* Example #1: When I select "title name" text in "Title" field
* Example #2: And I select "some content" text in "Description" field.
*
* @When /^(?:|I )select "(?P<selectedText>[^"]*)" text in "(?P<selectedField>[^"]*)" field$/
*/
function selectTextInField($selectedText, $selectedField) {
public function selectTextInField($selectedText, $selectedField) {
$field = $this->getSession()->getPage()->findField($selectedField);
$fieldid = $field->getAttribute('id');
......
This diff is collapsed.
......@@ -11,4 +11,4 @@ test_seo_admin: { email: 'seo.admin.test@vardot.com', password: 'dD.123123ddd' }
test_site_admin: { email: 'site.admin.test@vardot.com', password: 'dD.123123ddd' }
test_super_admin: { email: 'super.admin.test@vardot.com', password: 'dD.123123ddd' }
```
* Feature: Add Arabic language if we do not have it to languages in the system
\ No newline at end of file
* Feature: Add Arabic language if we do not have it to languages in the system
......@@ -14,4 +14,4 @@ test_super_admin
* Feature: Delete Arabic language from the system
* Feature: Cleanup after [entityqueue] module tests
* Feature: Cleanup leftover media from the Media Library
\ No newline at end of file
* Feature: Cleanup leftover media from the Media Library
......@@ -2,6 +2,7 @@ name: Varbase
type: profile
description: 'Varbase is an enhanced Drupal distribution with a lot of necessities.'
core: 8.x
core_version_requirement: ^8 || ^9
project: varbase
distribution:
name: Varbase
......
......@@ -70,9 +70,5 @@ function varbase_install() {
$response = new RedirectResponse($homepage_with_tour);
$response->send();
exit;
include_once __DIR__ . '/../../core/includes/install.core.inc';
include_once __DIR__ . '/../../core/includes/install.inc';
install_goto('?tour');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment