Loading core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -1509,7 +1509,7 @@ public function acceptExposedInput($input) { } if ($this->operator != 'empty' && $this->operator != 'not empty') { if ($value == 'All' || $value === []) { if ($value == 'All' || $value === 0 || $value === []) { return FALSE; } Loading core/modules/views/tests/src/Unit/Plugin/filter/FilterPluginBaseTest.php 0 → 100644 +64 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\views\Unit\Plugin\filter; use Drupal\Tests\UnitTestCase; use Drupal\views\Plugin\views\filter\FilterPluginBase; /** * @coversDefaultClass \Drupal\views\Plugin\views\filter\FilterPluginBase * @group views */ class FilterPluginBaseTest extends UnitTestCase { /** * @covers ::acceptExposedInput * * @dataProvider acceptExposedInputProvider */ public function testAcceptExposedInput(bool $expected_result, array $options, array $input) { $definition = [ 'title' => 'Accept exposed input Test', 'group' => 'Test', ]; $filter = new FilterPluginBaseStub([], 'stub', $definition); $filter->options = $options; $this->assertSame($expected_result, $filter->acceptExposedInput($input)); } /** * The data provider for testAcceptExposedInput. * * @return array * The data set. */ public function acceptExposedInputProvider() { return [ 'not-exposed' => [TRUE, ['exposed' => FALSE], []], 'exposed-no-input' => [TRUE, ['exposed' => TRUE], []], 'exposed-zero-input' => [FALSE, [ 'exposed' => TRUE, 'is_grouped' => FALSE, 'expose' => [ 'use_operator' => TRUE, 'operator_id' => '=', 'identifier' => 'identifier', ], ], ['identifier' => 0], ], 'exposed-empty-array-input' => [FALSE, [ 'exposed' => TRUE, 'is_grouped' => FALSE, 'expose' => [ 'use_operator' => TRUE, 'operator_id' => '=', 'identifier' => 'identifier', ], ], ['identifier' => []], ], ]; } } class FilterPluginBaseStub extends FilterPluginBase {} Loading
core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -1509,7 +1509,7 @@ public function acceptExposedInput($input) { } if ($this->operator != 'empty' && $this->operator != 'not empty') { if ($value == 'All' || $value === []) { if ($value == 'All' || $value === 0 || $value === []) { return FALSE; } Loading
core/modules/views/tests/src/Unit/Plugin/filter/FilterPluginBaseTest.php 0 → 100644 +64 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\views\Unit\Plugin\filter; use Drupal\Tests\UnitTestCase; use Drupal\views\Plugin\views\filter\FilterPluginBase; /** * @coversDefaultClass \Drupal\views\Plugin\views\filter\FilterPluginBase * @group views */ class FilterPluginBaseTest extends UnitTestCase { /** * @covers ::acceptExposedInput * * @dataProvider acceptExposedInputProvider */ public function testAcceptExposedInput(bool $expected_result, array $options, array $input) { $definition = [ 'title' => 'Accept exposed input Test', 'group' => 'Test', ]; $filter = new FilterPluginBaseStub([], 'stub', $definition); $filter->options = $options; $this->assertSame($expected_result, $filter->acceptExposedInput($input)); } /** * The data provider for testAcceptExposedInput. * * @return array * The data set. */ public function acceptExposedInputProvider() { return [ 'not-exposed' => [TRUE, ['exposed' => FALSE], []], 'exposed-no-input' => [TRUE, ['exposed' => TRUE], []], 'exposed-zero-input' => [FALSE, [ 'exposed' => TRUE, 'is_grouped' => FALSE, 'expose' => [ 'use_operator' => TRUE, 'operator_id' => '=', 'identifier' => 'identifier', ], ], ['identifier' => 0], ], 'exposed-empty-array-input' => [FALSE, [ 'exposed' => TRUE, 'is_grouped' => FALSE, 'expose' => [ 'use_operator' => TRUE, 'operator_id' => '=', 'identifier' => 'identifier', ], ], ['identifier' => []], ], ]; } } class FilterPluginBaseStub extends FilterPluginBase {}