You are here

public function BetterExposedFiltersTest::providerTestRewriteTaxonomy in Better Exposed Filters 8.3

File

tests/src/Unit/BetterExposedFiltersTest.php, line 132

Class

BetterExposedFiltersTest
@coversDefaultClass \Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters @group bef

Namespace

Drupal\better_exposed_filters\Tests

Code

public function providerTestRewriteTaxonomy() {
  $data = [];

  // Replace a single item, no change in order.
  $data[] = [
    [
      (object) [
        'option' => [
          123 => 'term1',
        ],
      ],
      (object) [
        'option' => [
          456 => 'term2',
        ],
      ],
      (object) [
        'option' => [
          789 => 'term3',
        ],
      ],
    ],
    "term2|Two",
    [
      (object) [
        'option' => [
          123 => 'term1',
        ],
      ],
      (object) [
        'option' => [
          456 => 'Two',
        ],
      ],
      (object) [
        'option' => [
          789 => 'term3',
        ],
      ],
    ],
  ];

  // Replace all items, no change in order.
  $data[] = [
    [
      (object) [
        'option' => [
          123 => 'term1',
        ],
      ],
      (object) [
        'option' => [
          456 => 'term2',
        ],
      ],
      (object) [
        'option' => [
          789 => 'term3',
        ],
      ],
    ],
    "term2|Two\nterm3|Three\nterm1|One",
    [
      (object) [
        'option' => [
          123 => 'One',
        ],
      ],
      (object) [
        'option' => [
          456 => 'Two',
        ],
      ],
      (object) [
        'option' => [
          789 => 'Three',
        ],
      ],
    ],
  ];

  // @TODO:
  // Replace a single item, with change in order.

  //$data[] = [

  //  [
  //    (object)['option' => [123 => 'term1']],
  //    (object)['option' => [456 => 'term2']],
  //    (object)['option' => [789 => 'term3']],
  //  ],
  //  "term2|Two",
  //  [
  //    (object)['option' => [456 => 'Two']],
  //    (object)['option' => [123 => 'term1']],
  //    (object)['option' => [789 => 'term3']],
  //  ],
  //  TRUE,

  //];

  //// Replace all items, with change in order.

  //$data[] = [

  //  [
  //    (object)['option' => [123 => 'term1']],
  //    (object)['option' => [456 => 'term2']],
  //    (object)['option' => [789 => 'term3']],
  //  ],
  //  "term2|Two\nterm3|Three\nterm1|One",
  //  [
  //    (object)['option' => [456 => 'Two']],
  //    (object)['option' => [789 => 'Three']],
  //    (object)['option' => [123 => 'One']],
  //  ],
  //  TRUE,

  //];
  return $data;
}