diff --git a/core/modules/language/tests/src/Unit/ConfigurableLanguageManagerTest.php b/core/modules/language/tests/src/Unit/ConfigurableLanguageManagerTest.php index 3ba4166..11d8b48 100644 --- a/core/modules/language/tests/src/Unit/ConfigurableLanguageManagerTest.php +++ b/core/modules/language/tests/src/Unit/ConfigurableLanguageManagerTest.php @@ -91,23 +91,23 @@ public function setUp() { } /** - * Test that multiple language-types can be initialized simultaneously. + * Test that multiple language types can be initialized simultaneously. * - * When a language-type (eg. the Interface language) is first requested, an + * When a language type (e.g. the interface language) is first requested, an * initialization phase is started. During this phase we might make more - * requests for language-types, and if we request the same type as the one + * requests for language types, and if we request the same type as the one * we're initializing, we risk an infinite loop. * - * To prevent this, Language Manager keeps track of which language-types it is - * currently initializing, and if asked for the language for one of these - * types it will return the default language. + * To prevent this, the language manager keeps track of which language types + * it is currently initializing, and if asked for the language for one of + * these types it will return the default language. * - * Language-types are not necessarily interdependent, and it should thus be + * Language types are not necessarily interdependent, and it should thus be * possible to fully initialize one while another is being initialized. In - * other words each language-type should have its own initialization-status. + * other words each language type should have its own initialization status. * - * This test initializes two language-types simultaneously by making an - * "outer" language-types initialization dependent on an inner language-type. + * This test initializes two language types simultaneously by making an + * "outer" language types initialization dependent on an inner language type. * * @covers ::getCurrentLanguage */ @@ -117,7 +117,7 @@ public function testCurrentLanguageShouldSupportRecursion() { // Mock the config for one configurable language, the actual language does // not matter, we just need at least two to be able to verify that we're not - // getting the default language when requesting the inner language-type. + // getting the default language when requesting the inner language type. $config_id = 'foo_bar'; $config = $this->prophesize(Config::class); $config->get()->willReturn([ @@ -134,35 +134,34 @@ public function testCurrentLanguageShouldSupportRecursion() { $language_negotiation_method_id = $config_id; - // Mock the default language. - // Notice that we have to use phpunit mocks for the language as php will - // throw a notice if we attempt to do a custom sort involving an - // ObjectProphecy as it will mutate its state when compared to another - // object. + // Mock the default language. Note that we have to use PHPUnit mocks for the + // languages, as Prophecy's method mocks will change their own state. During + // a custom array sort, this would trigger PHP "Array was modified by the + // user comparison function" errors. $default_language = $this->getMock(LanguageInterface::class); $this->defaultLanguage->get()->willReturn($default_language); - // These are the two language-types we will initialize. We will set up the - // test so that initialization of the outer language-type triggers an + // These are the two language types we will initialize. We will set up the + // test so that initialization of the outer language type triggers an // initialization of the inner. Thus setting up a situation where we test // whether the initialization-status of the outer type affects the inner. $outer_language_type = LanguageInterface::TYPE_INTERFACE; $inner_language_type = LanguageInterface::TYPE_URL; - // Setup the initialization of the inner language-type. We just return the + // Setup the initialization of the inner language type. We just return the // type straight away. $expected_inner_language = $this->getMock(LanguageInterface::class); $this->negotiator->initializeType($inner_language_type)->willReturn([ $language_negotiation_method_id => $expected_inner_language, ]); - // Setup initialization of the outer language-type. + // Setup initialization of the outer language type. // When initialization is requested we turn to the Language Manager and - // ask it to initialize the inner language-type. This will initialize the - // language-type fully as we just return the result straight away in the + // ask it to initialize the inner language type. This will initialize the + // language type fully as we just return the result straight away in the // above mocking. The Language Manager then caches the result and will from // now on return it when the type is requested. - // We then return the expected outer language-type. + // We then return the expected outer language type. $expected_outer_language = $this->getMock(LanguageInterface::class); $language_manager = $this->languageManager; $this->negotiator->initializeType($outer_language_type)->will( @@ -179,16 +178,16 @@ function ($type) use ( } ); - // Request the outer language-type from the Language Manager. This will + // Request the outer language type from the language manager. This will // initialize the inner language as a side-effect as described above. $actual_outer_language = $this->languageManager->getCurrentLanguage( $outer_language_type ); $this->assertSame($expected_outer_language, $actual_outer_language); - // This is the actual test: Request the inner language-type from the - // Language Manager. If it was able to initialize the language while the - // outer language-type was being initialized, we get the expected language. + // This is the actual test: request the inner language type from the + // language manager. If it was able to initialize the language while the + // outer language type was being initialized, we get the expected language. // If not, we will get the default language. $actual_inner_language = $this->languageManager->getCurrentLanguage( $inner_language_type