Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/framework/extension_functional_test_case.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,33 @@ protected function is_available()

return $is_available;
}

/**
* Add Language Items from an extension
*
* @param mixed $lang_set specifies the language entries to include
*/
protected function add_lang_ext($lang_file)
{
if (is_array($lang_file))
{
foreach ($lang_file as $file)
{
$this->add_lang_ext($file);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should return after this or you'll have an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually doesn't error :)

In the case of passing along an array, lang_path simply won't exist, so no include will be attempted, and an empty array would be merged in to the existing filled lang array.

This is an exact copy of the add_lang() function used in the main phpbb functional test case, only difference being the $lang_path here points to the extension's language files instead of phpBB's language files.


return;
}

$lang_path = __DIR__ . "/../../language/en/$lang_file.php";

$lang = array();

if (file_exists($lang_path))
{
include($lang_path);
}

$this->lang = array_merge($this->lang, $lang);
}
}