1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander
2019-10-03 11:07:03 +02:00
7 changed files with 84 additions and 13 deletions

View File

@@ -0,0 +1,23 @@
{
"name": "vendor5/foo",
"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",
"license": "GPL-2.0",
"authors": [{
"name": "John Smith",
"email": "email@phpbb.com",
"homepage": "http://phpbb.com",
"role": "N/A"
}],
"require": {
"php": ">=5.3"
},
"extra": {
"display-name": "phpBB Bar Extension",
"soft-require": {
"phpbb/phpbb": "3.3.*@dev"
}
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace vendor5\foo;
class ext extends \phpbb\extension\base
{
static public $enabled;
public function is_enableable()
{
return array('Reason 1', 'Reason 2');
}
public function enable_step($old_state)
{
self::$enabled = true;
return self::$enabled;
}
}

View File

@@ -36,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_all_available()
{
// barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure.
$this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo', 'vendor4/bar'), array_keys($this->extension_manager->all_available()));
$this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo', 'vendor4/bar', 'vendor5/foo'), array_keys($this->extension_manager->all_available()));
}
public function test_all_enabled()

View File

@@ -86,7 +86,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
$this->assertCount(1, $crawler->filter('.ext_enabled'));
$this->assertCount(6, $crawler->filter('.ext_disabled'));
$this->assertCount(7, $crawler->filter('.ext_disabled'));
$this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text());
@@ -165,9 +165,14 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$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('#main')->text());
// Correctly submit the enable form
// Correctly submit the enable form, default not enableable message
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor3%2Ffoo&sid=' . $this->sid);
$this->assertContainsLang('EXTENSION_NOT_ENABLEABLE', $crawler->filter('.errorbox')->text());
// Custom reason messages returned by not enableable extension
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor5%2Ffoo&sid=' . $this->sid);
$this->assertContains('Reason 1', $crawler->filter('.errorbox')->text());
$this->assertContains('Reason 2', $crawler->filter('.errorbox')->text());
}
public function test_disable_pre()