@@ -1063,34 +1063,60 @@ public function test_list_languages() {
10631063 $ stage = new mlang_stage ();
10641064 $ component = new mlang_component ('langconfig ' , 'en ' , mlang_version::by_branch ('MOODLE_19_STABLE ' ));
10651065 $ component ->add_string (new mlang_string ('thislanguageint ' , 'English ' ));
1066+ $ component ->add_string (new mlang_string ('thislanguage ' , 'English ' ));
10661067 $ stage ->add ($ component );
10671068 $ component ->clear ();
10681069
10691070 $ component = new mlang_component ('langconfig ' , 'cs ' , mlang_version::by_branch ('MOODLE_20_STABLE ' ));
10701071 $ component ->add_string (new mlang_string ('thislanguageint ' , 'Czech ' ));
1072+ $ component ->add_string (new mlang_string ('thislanguage ' , 'Česky ' ));
10711073 $ stage ->add ($ component );
10721074 $ component ->clear ();
10731075
10741076 $ component = new mlang_component ('langconfig ' , 'cs ' , mlang_version::by_branch ('MOODLE_19_STABLE ' ));
10751077 $ component ->add_string (new mlang_string ('thislanguageint ' , 'CS ' ));
1078+ $ component ->add_string (new mlang_string ('thislanguage ' , 'ČS ' ));
10761079 $ stage ->add ($ component );
10771080 $ component ->clear ();
10781081
1079- $ stage ->commit ('Registering two languages ' , array ('source ' => 'unittest ' ));
1082+ $ component = new mlang_component ('langconfig ' , 'xx ' , mlang_version::by_branch ('MOODLE_21_STABLE ' ));
1083+ $ component ->add_string (new mlang_string ('thislanguage ' , 'Xx ' ));
1084+ $ stage ->add ($ component );
1085+ $ component ->clear ();
1086+
1087+ $ component = new mlang_component ('langconfig ' , 'yy ' , mlang_version::by_branch ('MOODLE_23_STABLE ' ));
1088+ $ component ->add_string (new mlang_string ('thislanguageint ' , 'Yy ' ));
1089+ $ stage ->add ($ component );
1090+ $ component ->clear ();
1091+
1092+ $ stage ->commit ('Registering languages ' , array ('source ' => 'unittest ' ));
10801093
10811094 $ langs = mlang_tools::list_languages (true , true , false );
10821095 $ this ->assertEquals (gettype ($ langs ), 'array ' );
1083- $ this ->assertEquals (count ($ langs ), 2 );
1096+ $ this ->assertEquals (count ($ langs ), 4 );
10841097 $ this ->assertTrue (array_key_exists ('cs ' , $ langs ));
10851098 $ this ->assertTrue (array_key_exists ('en ' , $ langs ));
10861099 $ this ->assertEquals ($ langs ['en ' ], 'English ' );
10871100 $ this ->assertEquals ($ langs ['cs ' ], 'Czech ' );
1101+ $ this ->assertEquals ($ langs ['xx ' ], '??? ' );
1102+ $ this ->assertEquals ($ langs ['yy ' ], 'Yy ' );
10881103
10891104 $ langs = mlang_tools::list_languages (false , true , true );
10901105 $ this ->assertEquals (gettype ($ langs ), 'array ' );
1091- $ this ->assertEquals (count ($ langs ), 1 );
1106+ $ this ->assertEquals (count ($ langs ), 3 );
1107+ $ this ->assertTrue (array_key_exists ('cs ' , $ langs ));
1108+ $ this ->assertEquals ($ langs ['cs ' ], 'Czech [cs] ' );
1109+ $ this ->assertEquals ($ langs ['xx ' ], '??? [xx] ' );
1110+ $ this ->assertEquals ($ langs ['yy ' ], 'Yy [yy] ' );
1111+
1112+ $ langs = mlang_tools::list_languages (true , true , true , true );
1113+ $ this ->assertEquals (gettype ($ langs ), 'array ' );
1114+ $ this ->assertEquals (count ($ langs ), 4 );
10921115 $ this ->assertTrue (array_key_exists ('cs ' , $ langs ));
1093- $ this ->assertEquals ($ langs ['cs ' ], 'Czech (cs) ' );
1116+ $ this ->assertEquals ($ langs ['en ' ], 'English [en] ' );
1117+ $ this ->assertEquals ($ langs ['cs ' ], 'Czech / Česky [cs] ' );
1118+ $ this ->assertEquals ($ langs ['xx ' ], '??? / Xx [xx] ' );
1119+ $ this ->assertEquals ($ langs ['yy ' ], 'Yy / ??? [yy] ' );
10941120 }
10951121
10961122 public function test_list_components () {
0 commit comments