1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 07:35:29 +02:00

Merge pull request #1845 from nickvergessen/ticket/11994

[ticket/11994] Make extension manager UI less misleading
This commit is contained in:
David King 2013-11-07 17:46:58 -08:00
commit 082a467cc8
7 changed files with 139 additions and 136 deletions

View File

@ -5,35 +5,35 @@
<h1>{L_EXTENSIONS_ADMIN}</h1>
<p>{L_EXTENSIONS_EXPLAIN}</p>
<p>{L_PURGE_EXPLAIN}</p>
<p>{L_EXTENSION_DELETE_DATA_EXPLAIN}</p>
<!-- IF MIGRATOR_ERROR -->
<div class="errorbox">
<p><strong>{L_MIGRATION_EXCEPTION_ERROR}</strong></p>
<p>{MIGRATOR_ERROR}</p>
<p><a href="{U_RETURN}">{L_RETURN}</a></p>
<p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p>
</div>
<!-- ELSEIF PRE -->
<div class="errorbox">
<p>{L_PURGE_CONFIRM}</p>
<p>{L_CONFIRM_MESSAGE}</p>
</div>
<form id="acp_extensions" method="post" action="{U_PURGE}">
<fieldset class="submit-buttons">
<legend>{L_PURGE}</legend>
<input class="button1" type="submit" name="purge" value="{L_PURGE}" />
<legend>{L_EXTENSION_DELETE_DATA}</legend>
<input class="button1" type="submit" name="purge" value="{L_EXTENSION_DELETE_DATA}" />
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
</fieldset>
</form>
<!-- ELSEIF S_NEXT_STEP -->
<div class="errorbox">
<p>{L_PURGE_IN_PROGRESS}</p>
<p>{L_EXTENSION_DELETE_DATA_IN_PROGRESS}</p>
</div>
<!-- ELSE -->
<div class="successbox">
<p>{L_PURGE_SUCCESS}</p>
<p>{L_EXTENSION_DELETE_DATA_SUCCESS}</p>
<br />
<p><a href="{U_RETURN}">{L_RETURN}</a></p>
<p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p>
</div>
<!-- ENDIF -->

View File

@ -5,29 +5,29 @@
<h1>{L_EXTENSIONS_ADMIN}</h1>
<p>{L_EXTENSIONS_EXPLAIN}</p>
<p>{L_DISABLE_EXPLAIN}</p>
<p>{L_EXTENSION_DISABLE_EXPLAIN}</p>
<!-- IF PRE -->
<div class="errorbox">
<p>{L_DISABLE_CONFIRM}</p>
<p>{L_CONFIRM_MESSAGE}</p>
</div>
<form id="acp_extensions" method="post" action="{U_DISABLE}">
<fieldset class="submit-buttons">
<legend>{L_DISABLE}</legend>
<input class="button1" type="submit" name="disable" value="{L_DISABLE}" />
<legend>{L_EXTENSION_DISABLE}</legend>
<input class="button1" type="submit" name="disable" value="{L_EXTENSION_DISABLE}" />
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
</fieldset>
</form>
<!-- ELSEIF S_NEXT_STEP -->
<div class="errorbox">
<p>{L_DISABLE_IN_PROGRESS}</p>
<p>{L_EXTENSION_DISABLE_IN_PROGRESS}</p>
</div>
<!-- ELSE -->
<div class="successbox">
<p>{L_DISABLE_SUCCESS}</p>
<p>{L_EXTENSION_DISABLE_SUCCESS}</p>
<br />
<p><a href="{U_RETURN}">{L_RETURN}</a></p>
<p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p>
</div>
<!-- ENDIF -->

View File

@ -5,35 +5,35 @@
<h1>{L_EXTENSIONS_ADMIN}</h1>
<p>{L_EXTENSIONS_EXPLAIN}</p>
<p>{L_ENABLE_EXPLAIN}</p>
<p>{L_EXTENSION_ENABLE_EXPLAIN}</p>
<!-- IF MIGRATOR_ERROR -->
<div class="errorbox">
<p><strong>{L_MIGRATION_EXCEPTION_ERROR}</strong></p>
<p>{MIGRATOR_ERROR}</p>
<p><a href="{U_RETURN}">{L_RETURN}</a></p>
<p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p>
</div>
<!-- ELSEIF PRE -->
<div class="errorbox">
<p>{L_ENABLE_CONFIRM}</p>
<p>{L_CONFIRM_MESSAGE}</p>
</div>
<form id="acp_extensions" method="post" action="{U_ENABLE}">
<fieldset class="submit-buttons">
<legend>{L_ENABLE}</legend>
<input class="button1" type="submit" name="enable" value="{L_ENABLE}" />
<legend>{L_EXTENSION_ENABLE}</legend>
<input class="button1" type="submit" name="enable" value="{L_EXTENSION_ENABLE}" />
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
</fieldset>
</form>
<!-- ELSEIF S_NEXT_STEP -->
<div class="errorbox">
<p>{L_ENABLE_IN_PROGRESS}</p>
<p>{L_EXTENSION_ENABLE_IN_PROGRESS}</p>
</div>
<!-- ELSE -->
<div class="successbox">
<p>{L_ENABLE_SUCCESS}</p>
<p>{L_EXTENSION_ENABLE_SUCCESS}</p>
<br />
<p><a href="{U_RETURN}">{L_RETURN}</a></p>
<p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p>
</div>
<!-- ENDIF -->

View File

@ -18,9 +18,7 @@
<tbody>
<!-- IF .enabled -->
<tr>
<td class="row3" colspan="3">
<strong>{L_ENABLED} {L_EXTENSIONS}</strong>
</td>
<td class="row3" colspan="3"><strong>{L_EXTENSIONS_ENABLED}</strong></td>
</tr>
<!-- BEGIN enabled -->
<tr class="ext_enabled">
@ -28,7 +26,7 @@
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td>
<td style="text-align: center;">
<!-- BEGIN actions -->
<a href="{enabled.actions.U_ACTION}" title="{enabled.actions.L_ACTION}">{enabled.actions.L_ACTION}</a>
<a href="{enabled.actions.U_ACTION}"<!-- IF enabled.actions.L_ACTION_EXPLAIN --> title="{enabled.actions.L_ACTION_EXPLAIN}"<!-- ENDIF -->>{enabled.actions.L_ACTION}</a>
<!-- IF not enabled.actions.S_LAST_ROW -->&nbsp;|&nbsp;<!-- ENDIF -->
<!-- END actions -->
</td>
@ -38,7 +36,7 @@
<!-- IF .disabled -->
<tr>
<td class="row3" colspan="3"><strong>{L_DISABLED} {L_EXTENSIONS}</strong></td>
<td class="row3" colspan="3"><strong>{L_EXTENSIONS_DISABLED}</strong></td>
</tr>
<!-- BEGIN disabled -->
<tr class="ext_disabled">
@ -48,7 +46,7 @@
</td>
<td style="text-align: center;">
<!-- BEGIN actions -->
<a href="{disabled.actions.U_ACTION}" title="{disabled.actions.L_ACTION}">{disabled.actions.L_ACTION}</a>
<a href="{disabled.actions.U_ACTION}"<!-- IF disabled.actions.L_ACTION_EXPLAIN --> title="{disabled.actions.L_ACTION_EXPLAIN}"<!-- ENDIF -->>{disabled.actions.L_ACTION}</a>
<!-- IF not disabled.actions.S_LAST_ROW -->&nbsp;|&nbsp;<!-- ENDIF -->
<!-- END actions -->
</td>

View File

@ -66,7 +66,7 @@ class acp_extensions
}
catch(\phpbb\extension\exception $e)
{
trigger_error($e);
trigger_error($e, E_USER_WARNING);
}
}
@ -96,8 +96,9 @@ class acp_extensions
$this->tpl_name = 'acp_ext_enable';
$template->assign_vars(array(
'PRE' => true,
'U_ENABLE' => $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name),
'PRE' => true,
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')),
'U_ENABLE' => $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name),
));
break;
@ -128,7 +129,7 @@ class acp_extensions
$this->tpl_name = 'acp_ext_enable';
$template->assign_vars(array(
'U_RETURN' => $this->u_action . '&amp;action=list',
'U_RETURN' => $this->u_action . '&amp;action=list',
));
break;
@ -141,8 +142,9 @@ class acp_extensions
$this->tpl_name = 'acp_ext_disable';
$template->assign_vars(array(
'PRE' => true,
'U_DISABLE' => $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name),
'PRE' => true,
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')),
'U_DISABLE' => $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name),
));
break;
@ -165,16 +167,21 @@ class acp_extensions
));
break;
case 'purge_pre':
$this->tpl_name = 'acp_ext_purge';
case 'delete_data_pre':
if ($phpbb_extension_manager->enabled($ext_name))
{
redirect($this->u_action);
}
$this->tpl_name = 'acp_ext_delete_data';
$template->assign_vars(array(
'PRE' => true,
'U_PURGE' => $this->u_action . '&amp;action=purge&amp;ext_name=' . urlencode($ext_name),
'PRE' => true,
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')),
'U_PURGE' => $this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name),
));
break;
case 'purge':
case 'delete_data':
try
{
while ($phpbb_extension_manager->purge_step($ext_name))
@ -184,7 +191,7 @@ class acp_extensions
{
$template->assign_var('S_NEXT_STEP', true);
meta_refresh(0, $this->u_action . '&amp;action=purge&amp;ext_name=' . urlencode($ext_name));
meta_refresh(0, $this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name));
}
}
}
@ -193,7 +200,7 @@ class acp_extensions
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
}
$this->tpl_name = 'acp_ext_purge';
$this->tpl_name = 'acp_ext_delete_data';
$template->assign_vars(array(
'U_RETURN' => $this->u_action . '&amp;action=list',
@ -233,7 +240,6 @@ class acp_extensions
$this->output_actions('enabled', array(
'DISABLE' => $this->u_action . '&amp;action=disable_pre&amp;ext_name=' . urlencode($name),
'PURGE' => $this->u_action . '&amp;action=purge_pre&amp;ext_name=' . urlencode($name),
));
}
catch(\phpbb\extension\exception $e)
@ -267,7 +273,7 @@ class acp_extensions
$this->output_actions('disabled', array(
'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name),
'PURGE' => $this->u_action . '&amp;action=purge_pre&amp;ext_name=' . urlencode($name),
'DELETE_DATA' => $this->u_action . '&amp;action=delete_data_pre&amp;ext_name=' . urlencode($name),
));
}
catch(\phpbb\extension\exception $e)
@ -325,8 +331,9 @@ class acp_extensions
foreach ($actions as $lang => $url)
{
$this->template->assign_block_vars($block . '.actions', array(
'L_ACTION' => $this->user->lang($lang),
'U_ACTION' => $url,
'L_ACTION' => $this->user->lang('EXTENSION_' . $lang),
'L_ACTION_EXPLAIN' => (isset($this->user->lang['EXTENSION_' . $lang . '_EXPLAIN'])) ? $this->user->lang('EXTENSION_' . $lang . '_EXPLAIN') : '',
'U_ACTION' => $url,
));
}
}

View File

@ -39,47 +39,39 @@ $lang = array_merge($lang, array(
'EXTENSIONS' => 'Extensions',
'EXTENSIONS_ADMIN' => 'Extensions Manager',
'EXTENSIONS_EXPLAIN' => 'The Extensions Manager is a tool in your phpBB Board which allows you to manage all of your extensions statuses and view information about them.',
'EXTENSION_INVALID_LIST' => 'The "%s" extension is not valid.<br />%s<br /><br />',
'EXTENSION_INVALID_LIST' => 'The “%s” extension is not valid.<br />%s<br /><br />',
'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).',
'DETAILS' => 'Details',
'AVAILABLE' => 'Available',
'ENABLED' => 'Enabled',
'DISABLED' => 'Disabled',
'PURGED' => 'Purged',
'UPLOADED' => 'Uploaded',
'EXTENSIONS_DISABLED' => 'Disabled Extensions',
'EXTENSIONS_ENABLED' => 'Enabled Extensions',
'ENABLE' => 'Enable',
'DISABLE' => 'Disable',
'PURGE' => 'Purge',
'EXTENSION_DELETE_DATA' => 'Delete data',
'EXTENSION_DISABLE' => 'Disable',
'EXTENSION_ENABLE' => 'Enable',
'ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.',
'DISABLE_EXPLAIN' => 'Disabling an extension retains its files and settings but removes any functionality added by the extension.',
'PURGE_EXPLAIN' => 'Purging an extension clears an extensions data while retaining its files.',
'DELETE_EXPLAIN' => 'Deleting an extension removes all of its files and settings. Log entries will remain, although any language variables added by the extension will not be available.',
'EXTENSION_DELETE_DATA_EXPLAIN' => 'Deleting an extensions data removes all of its data and settings. The extension files are retained so it can be enabled again.',
'EXTENSION_DISABLE_EXPLAIN' => 'Disabling an extension retains its files, data and settings but removes any functionality added by the extension.',
'EXTENSION_ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.',
'DISABLE_IN_PROGRESS' => 'The extension is currently being disabled, please do not leave this page or refresh until it is completed.',
'ENABLE_IN_PROGRESS' => 'The extension is currently being installed, please do not leave this page or refresh until it is completed.',
'PURGE_IN_PROGRESS' => 'The extension is currently being purged, please do not leave this page or refresh until it is completed.',
'ENABLE_SUCCESS' => 'The extension was enabled successfully',
'DISABLE_SUCCESS' => 'The extension was disabled successfully',
'PURGE_SUCCESS' => 'The extension was purged successfully',
'EXTENSION_DELETE_DATA_IN_PROGRESS' => 'The extensions data is currently being deleted. Please do not leave or refresh this page until it is completed.',
'EXTENSION_DISABLE_IN_PROGRESS' => 'The extension is currently being disabled. Please do not leave or refresh this page until it is completed.',
'EXTENSION_ENABLE_IN_PROGRESS' => 'The extension is currently being enabled. Please do not leave or refresh this page until it is completed.',
'ENABLE_FAIL' => 'The extension could not be enabled',
'DISABLE_FAIL' => 'The extension could not be disabled',
'PURGE_FAIL' => 'The extension could not be purged',
'EXTENSION_DELETE_DATA_SUCCESS' => 'The extensions data was deleted successfully',
'EXTENSION_DISABLE_SUCCESS' => 'The extension was disabled successfully',
'EXTENSION_ENABLE_SUCCESS' => 'The extension was enabled successfully',
'EXTENSION_NAME' => 'Extension Name',
'EXTENSION_ACTIONS' => 'Actions',
'EXTENSION_OPTIONS' => 'Options',
'ENABLE_CONFIRM' => 'Are you sure that you wish to enable this extension?',
'DISABLE_CONFIRM' => 'Are you sure that you wish to disable this extension?',
'PURGE_CONFIRM' => 'Are you sure that you wish to purge this extension&#39;s data? This will remove all settings stored for this extension and cannot be undone!',
'EXTENSION_DELETE_DATA_CONFIRM' => 'Are you sure that you wish to delete the data associated with “%s”?<br /><br />This removes all of its data and settings and cannot be undone!',
'EXTENSION_DISABLE_CONFIRM' => 'Are you sure that you wish to disable the “%s” extension?',
'EXTENSION_ENABLE_CONFIRM' => 'Are you sure that you wish to enable the “%s” extension?',
'WARNING' => 'Warning',
'RETURN' => 'Return',
'RETURN_TO_EXTENSION_LIST' => 'Return to the extension list',
'EXT_DETAILS' => 'Extension Details',
'DISPLAY_NAME' => 'Display Name',

View File

@ -77,59 +77,59 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
public function test_list()
{
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
$this->assertCount(1, $crawler->filter('.ext_enabled'));
$this->assertCount(5, $crawler->filter('.ext_disabled'));
$this->assertCount(1, $crawler->filter('.ext_enabled'));
$this->assertCount(5, $crawler->filter('.ext_disabled'));
$this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContainsLang('PURGE', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContains('The "test2" extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text());
$this->assertContains('The “test2” extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text());
$this->assertContains('The "test3" extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text());
$this->assertContains('The “test3” extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text());
$this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('PURGE', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(2)->text());
$this->assertContains('The "bar" extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text());
$this->assertContains('The “bar” extension is not valid.', $crawler->filter('.ext_disabled')->eq(3)->text());
}
public function test_details()
{
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo&sid=' . $this->sid);
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=foo&sid=' . $this->sid);
$validation = array(
'DISPLAY_NAME' => 'phpBB Foo Extension',
'CLEAN_NAME' => 'foo/example',
'TYPE' => 'phpbb-extension',
'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.',
'VERSION' => '1.0.0',
'TIME' => '2012-02-15 01:01:01',
'LICENCE' => 'GPL-2.0',
'PHPBB_VERSION' => '3.1.*@dev',
'PHP_VERSION' => '>=5.3',
'AUTHOR_NAME' => 'John Smith',
'AUTHOR_EMAIL' => 'email@phpbb.com',
'AUTHOR_HOMEPAGE' => 'http://phpbb.com',
'AUTHOR_ROLE' => 'N/A',
);
$validation = array(
'DISPLAY_NAME' => 'phpBB Foo Extension',
'CLEAN_NAME' => 'foo/example',
'TYPE' => 'phpbb-extension',
'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.',
'VERSION' => '1.0.0',
'TIME' => '2012-02-15 01:01:01',
'LICENCE' => 'GPL-2.0',
'PHPBB_VERSION' => '3.1.*@dev',
'PHP_VERSION' => '>=5.3',
'AUTHOR_NAME' => 'John Smith',
'AUTHOR_EMAIL' => 'email@phpbb.com',
'AUTHOR_HOMEPAGE' => 'http://phpbb.com',
'AUTHOR_ROLE' => 'N/A',
);
for ($i = 0; $i < $crawler->filter('dl')->count(); $i++)
{
$text = $crawler->filter('dl')->eq($i)->text();
for ($i = 0; $i < $crawler->filter('dl')->count(); $i++)
{
$text = $crawler->filter('dl')->eq($i)->text();
$match = false;
$match = false;
foreach ($validation as $language_key => $expected)
{
if (strpos($text, $this->lang($language_key)) === 0)
{
$match = true;
foreach ($validation as $language_key => $expected)
{
if (strpos($text, $this->lang($language_key)) === 0)
{
$match = true;
$this->assertContains($expected, $text);
$this->assertContains($expected, $text);
}
}
@ -143,46 +143,52 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
public function test_enable_pre()
{
// Foo is already enabled (redirect to list)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text());
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text());
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=foo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('ENABLE_CONFIRM', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text());
}
public function test_disable_pre()
{
// Moo is not enabled (redirect to list)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('html')->text());
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('html')->text());
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('html')->text());
// Moo is not enabled (redirect to list)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid);
$this->assertContainsLang('DISABLE_CONFIRM', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=foo&sid=' . $this->sid);
$this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text());
}
public function test_purge_pre()
public function test_delete_data_pre()
{
// test2 is not available (error)
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=test2&sid=' . $this->sid);
$this->assertContains('The required file does not exist', $crawler->filter('html')->text());
// 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);
$this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge_pre&ext_name=foo&sid=' . $this->sid);
$this->assertContainsLang('PURGE_CONFIRM', $crawler->filter('html')->text());
// 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=foo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NAME', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_OPTIONS', $crawler->filter('div.main thead')->text());
$this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContains('Are you sure that you wish to delete the data associated with “phpBB Moo Extension”?', $crawler->filter('.errorbox')->text());
}
public function test_actions()
{
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('ENABLE_SUCCESS', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('.successbox')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('DISABLE_SUCCESS', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('.successbox')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=purge&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('PURGE_SUCCESS', $crawler->filter('html')->text());
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text());
}
}