Skip to content
Snippets Groups Projects
Verified Commit 23da7683 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3074595 by Lendude, ravi.shankar, sime, jian he, Kristen Pol, longwave:...

Issue #3074595 by Lendude, ravi.shankar, sime, jian he, Kristen Pol, longwave: var_export only returns if the second parameter set to TRUE

(cherry picked from commit 98856bb1)
parent 46ee6c8e
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
......@@ -452,7 +452,7 @@ public function validate() {
}
}
elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) {
$errors[] = $this->t('The value @value is not an array for @operator on filter: @filter', ['@value' => var_export($this->value), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE)]);
$errors[] = $this->t('The value @value is not an array for @operator on filter: @filter', ['@value' => var_export($this->value, TRUE), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE)]);
}
return $errors;
}
......
<?php
namespace Drupal\Tests\views\Unit\Plugin\filter;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\filter\InOperator;
/**
* @coversDefaultClass \Drupal\views\Plugin\views\filter\InOperator
* @group views
*/
class InOperatorTest extends UnitTestCase {
/**
* @covers ::validate
*/
public function testValidate() {
$definition = [
'title' => 'Is InOperator Test',
'group' => 'Test',
'options callback' => '\Drupal\Tests\views\Unit\Plugin\filter\InOperatorTest::validate_options_callback',
];
$filter = new InOperator([], 'in_operator', $definition);
$filter->value = 'string';
$filter->operator = 'in';
$translation_stub = $this->getStringTranslationStub();
$filter->setStringTranslation($translation_stub);
$errors = $filter->validate();
$this->assertSame('The value &#039;string&#039; is not an array for in on filter: ' . $filter->adminLabel(TRUE), (string) $errors[0]);
}
/**
* @return array
*/
public static function validate_options_callback() {
return ['Yes', 'No'];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment