Issue #2223251 by Berdir: InputRequired plugin passes incorrect dependency to init method.

8.0.x
Nathaniel Catchpole 2014-05-13 15:01:03 +01:00
parent f1c278e8f4
commit c056dd6e5e
2 changed files with 26 additions and 2 deletions

View File

@ -83,7 +83,7 @@ class InputRequired extends ExposedFormPluginBase {
'format' => $this->options['text_input_required_format'],
);
$handler = Views::handlerManager('area')->getHandler($options);
$handler->init($this->view, $options);
$handler->init($this->view, $this->displayHandler, $options);
$this->displayHandler->handlers['empty'] = array(
'area' => $handler,
);

View File

@ -45,7 +45,7 @@ class ExposedFormTest extends ViewTestBase {
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this->drupalCreateNode();
$this->drupalCreateNode(array('type' => 'article'));
}
}
@ -161,6 +161,30 @@ class ExposedFormTest extends ViewTestBase {
$this->assertEqual(count($elements), 1, 'One exposed form block found.');
}
/**
* Test the input required exposed form type.
*/
public function testInputRequired() {
$view = entity_load('view', 'test_exposed_form_buttons');
$display = &$view->getDisplay('default');
$display['display_options']['exposed_form']['type'] = 'input_required';
$view->save();
$this->drupalGet('test_exposed_form_buttons');
$this->assertResponse(200);
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', t('Apply'));
// Ensure that no results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 0, 'No rows are displayed by default when no input is provided.');
$this->drupalGet('test_exposed_form_buttons', array('query' => array('type' => 'article')));
// Ensure that results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
$this->assertEqual(count($rows), 5, 'All rows are displayed by default when input is provided.');
}
/**
* Returns a views exposed form ID.
*