$manager =
$this->container->
get('plugin.manager.views.filter'
);
/** @var \Drupal\views\Plugin\views\filter\InOperator $operator */
$operator =
$manager->
createInstance('in_operator'
);
$options =
['value' =>
['foo' =>
[], 'baz' =>
[]]];
$operator->
init($view->
reveal(),
$display->
reveal(),
$options);
$input_options =
[ 'foo' => 'bar',
'baz' =>
$this->
t('qux'
),
'quux' =>
(object) ['option' =>
['quux' => 'corge'
]],
];
$reduced_values =
$operator->
reduceValueOptions($input_options);
$this->
assertSame(['foo', 'baz'
],
array_keys($reduced_values));
$this->
assertInstanceOf(TranslatableMarkup::
class,
$reduced_values['baz'
]);
$this->
assertSame('qux',
(string) $reduced_values['baz'
]);
$this->
assertSame('bar',
$reduced_values['foo'
]);
}}