class SearchSetLocaleTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/search/tests/src/Functional/SearchSetLocaleTest.php \Drupal\Tests\search\Functional\SearchSetLocaleTest
- 9 core/modules/search/tests/src/Functional/SearchSetLocaleTest.php \Drupal\Tests\search\Functional\SearchSetLocaleTest
Tests that search works with numeric locale settings.
@group search
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\search\Functional\SearchSetLocaleTest
Expanded class hierarchy of SearchSetLocaleTest
3 string references to 'SearchSetLocaleTest'
- drupal7.php in core/
modules/ tracker/ tests/ fixtures/ drupal7.php - A database agnostic dump for testing purposes.
- drupal7.php in core/
modules/ rdf/ tests/ fixtures/ drupal7.php - A database agnostic dump for testing purposes.
- drupal7.php in core/
modules/ migrate_drupal/ tests/ fixtures/ drupal7.php - A database agnostic dump for testing purposes.
File
- core/
modules/ search/ tests/ src/ Functional/ SearchSetLocaleTest.php, line 12
Namespace
Drupal\Tests\search\FunctionalView source
class SearchSetLocaleTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'comment',
'node',
'search',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* A node search plugin instance.
*
* @var \Drupal\search\Plugin\SearchInterface
*/
protected $nodeSearchPlugin;
protected function setUp() : void {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
// Create a plugin instance.
$this->nodeSearchPlugin = $this->container
->get('plugin.manager.search')
->createInstance('node_search');
// Create a node with a very simple body.
$this
->drupalCreateNode([
'body' => [
[
'value' => 'tapir',
],
],
]);
// Update the search index.
$this->nodeSearchPlugin
->updateIndex();
}
/**
* Verify that search works with a numeric locale set.
*/
public function testSearchWithNumericLocale() {
// French decimal point is comma.
setlocale(LC_NUMERIC, 'fr_FR');
$this->nodeSearchPlugin
->setSearch('tapir', [], []);
// The call to execute will throw an exception if a float in the wrong
// format is passed in the query to the database, so an assertion is not
// necessary here.
$this->nodeSearchPlugin
->execute();
}
}