Creates a new instance with the installed languages.
public static createWithLocales ( string $defaultLocale, string $rootDir ) : static | ||
$defaultLocale | string | |
$rootDir | string | |
return | static |
/** * Tests the createWithLocales() method. */ public function testCreateWithLocales() { $listener = LocaleListener::createWithLocales('de', $this->getRootDir() . '/app'); $this->assertInstanceOf('Contao\\CoreBundle\\EventListener\\LocaleListener', $listener); $reflection = new \ReflectionClass($listener); $property = $reflection->getProperty('availableLocales'); $property->setAccessible(true); $locales = $property->getValue($listener); $this->assertContains('de', $locales); $this->assertContains('en', $locales); $this->assertContains('it', $locales); }