Skip to content
Snippets Groups Projects

Issue #3130107: Extend unit test coverage for LanguageNegotiationContentEntity

Open Stefanos Petrakis requested to merge issue/drupal-3130107:3130107-add-unit-test into 10.1.x
2 files
+ 32
8
Compare changes
  • Side-by-side
  • Inline
Files
2
  • 3a049c52
    Issue #3123223 by Hardik_Patel_12, ranjith_kumar_k_u, jungle: Replace non-test... · 3a049c52
    catch authored
    Issue #3123223 by Hardik_Patel_12, ranjith_kumar_k_u, jungle: Replace non-test usages of \Drupal::moduleHandler() with IoC injection
@@ -7,6 +7,7 @@
use Drupal\views\Plugin\views\wizard\WizardException;
use Drupal\views\Plugin\ViewsPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
/**
* Form controller for the Views add form.
@@ -22,14 +23,24 @@ class ViewAddForm extends ViewFormBase {
*/
protected $wizardManager;
/**
* The module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a new ViewAddForm object.
*
* @param \Drupal\views\Plugin\ViewsPluginManager $wizard_manager
* The wizard plugin manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler service.
*/
public function __construct(ViewsPluginManager $wizard_manager) {
public function __construct(ViewsPluginManager $wizard_manager, ModuleHandlerInterface $module_handler) {
$this->wizardManager = $wizard_manager;
$this->moduleHandler = $module_handler;
}
/**
@@ -37,7 +48,8 @@ public function __construct(ViewsPluginManager $wizard_manager) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.views.wizard')
$container->get('plugin.manager.views.wizard'),
$container->get('module_handler')
);
}
@@ -126,7 +138,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#sort_options' => TRUE,
];
$show_form = &$form['displays']['show'];
$default_value = \Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'users';
$default_value = $this->moduleHandler->moduleExists('node') ? 'node' : 'users';
$show_form['wizard_key']['#default_value'] = WizardPluginBase::getSelected($form_state, ['show', 'wizard_key'], $default_value, $show_form['wizard_key']);
// Changing this dropdown updates the entire content of $form['displays'] via
// AJAX.
Loading