Unverified Commit 001fdae1 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3097765 by Krzysztof Domański, 2pha, Lendude, alexpott: Numerical...

Issue #3097765 by Krzysztof Domański, 2pha, Lendude, alexpott: Numerical machine names create problems in view filters
parent 1d367555
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public function getValueOptions() {
        $options[$type] = $info['label'];
      }

      array_multisort($options, SORT_ASC, SORT_REGULAR, array_keys($options));
      asort($options);
      $this->valueOptions = $options;
    }

+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ display:
          field: type
          relationship: none
          value:
            180575: '180575'
            test_bundle: test_bundle
            test_bundle_2: test_bundle_2
          plugin_id: bundle
+5 −3
Original line number Diff line number Diff line
@@ -30,15 +30,16 @@ class FilterEntityBundleTest extends ViewsKernelTestBase {
  public function testFilterEntity() {
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    NodeType::create(['type' => 'test_bundle'])->save();
    NodeType::create(['type' => 'test_bundle_2'])->save();
    NodeType::create(['type' => 'test_bundle', 'name' => 'Test 1'])->save();
    NodeType::create(['type' => 'test_bundle_2', 'name' => 'Test 2'])->save();
    NodeType::create(['type' => '180575', 'name' => '180575'])->save();

    $bundle_info = $this->container->get('entity_type.bundle.info')->getBundleInfo('node');

    $entities['count'] = 0;

    foreach ($bundle_info as $key => $info) {
      for ($i = 0; $i < 5; $i++) {
      for ($i = 0; $i < 3; $i++) {
        $entity = Node::create([
          'title' => $this->randomString(),
          'uid' => 1,
@@ -54,6 +55,7 @@ public function testFilterEntity() {
    // Tests \Drupal\views\Plugin\views\filter\Bundle::calculateDependencies().
    $expected = [
      'config' => [
        'node.type.180575',
        'node.type.test_bundle',
        'node.type.test_bundle_2',
      ],