[ticket/11467] Add language variables to tests

Convert the hardcoded strings to language variables.

PHPBB3-11467
This commit is contained in:
n-aleha 2014-05-12 02:17:37 +03:00
parent 031273de72
commit 56959a2f83
3 changed files with 13 additions and 13 deletions

View file

@ -97,7 +97,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e){} catch(\phpbb\extension\exception $e){}
$this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json'); $this->assertEquals((string) $e, $this->user->lang('FILE_NOT_FOUND', $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json'));
} }
// Should be the same as a direct json_decode of the composer.json file // Should be the same as a direct json_decode of the composer.json file
@ -136,7 +136,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'name'));
} }
try try
@ -147,7 +147,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'type'));
} }
try try
@ -158,7 +158,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'license\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'license'));
} }
try try
@ -169,7 +169,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'version'));
} }
try try
@ -180,7 +180,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'authors'));
} }
$manager->merge_metadata(array( $manager->merge_metadata(array(
@ -197,7 +197,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'author name'));
} }
} }
@ -224,7 +224,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Meta field \'name\' is invalid.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'name'));
} }
try try
@ -235,7 +235,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Meta field \'type\' is invalid.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'type'));
} }
try try
@ -246,7 +246,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Meta field \'license\' is invalid.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'license'));
} }
try try
@ -257,7 +257,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->assertEquals((string) $e, 'Meta field \'version\' is invalid.'); $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'version'));
} }
} }

View file

@ -180,7 +180,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
{ {
// test2 is not available (error) // test2 is not available (error)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid);
$this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('.errorbox')->text());
// foo is not disabled (redirect to list) // foo is not disabled (redirect to list)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid);

View file

@ -82,6 +82,6 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=not%2Fexists&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=not%2Fexists&sid=' . $this->sid);
// Error message because the files do not exist // Error message because the files do not exist
$this->assertContains('The required file does not exist:', $crawler->filter('#main')->text()); $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('#main')->text());
} }
} }