function NaturalSortTest::testCurrentLanguage
Tests that the current language is used when no language code is given.
Attributes
#[RequiresPhpExtension('intl')]
File
-
core/
tests/ Drupal/ Tests/ Core/ Utility/ NaturalSortTest.php, line 48
Class
Namespace
Drupal\Tests\Core\UtilityCode
public function testCurrentLanguage() : void {
$language_manager = $this->createMock(LanguageManagerInterface::class);
$language_manager->expects($this->atLeastOnce())
->method('getCurrentLanguage')
->willReturn(new Language([
'id' => 'fr',
]));
$container = new ContainerBuilder();
$container->set('language_manager', $language_manager);
\Drupal::setContainer($container);
$this->assertLessThan(0, NaturalSort::strnatcasecmp('Émission', 'Format'));
$this->assertGreaterThan(0, NaturalSort::strnatcasecmp('Format 100x100', 'Format 10x10'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.