mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/11842
Conflicts: phpBB/includes/acp/acp_groups.php
This commit is contained in:
@@ -112,7 +112,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||
public function test_get_driver_enabled($driver_name, $expected)
|
||||
{
|
||||
$driver = $this->manager->get_driver($driver_name);
|
||||
$this->assertEquals($expected, $driver);
|
||||
$this->assertEquals($expected, ($driver === null) ? null : $driver->get_name());
|
||||
}
|
||||
|
||||
public function get_driver_data_all()
|
||||
@@ -133,7 +133,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||
public function test_get_driver_all($driver_name, $expected)
|
||||
{
|
||||
$driver = $this->manager->get_driver($driver_name, false);
|
||||
$this->assertEquals($expected, $driver);
|
||||
$this->assertEquals($expected, ($driver === null) ? $driver : $driver->get_name());
|
||||
}
|
||||
|
||||
public function test_get_avatar_settings()
|
||||
@@ -152,31 +152,20 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => '',
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => '',
|
||||
'user_avatar_height' => '',
|
||||
'group_avatar' => '',
|
||||
),
|
||||
array(
|
||||
'avatar' => '',
|
||||
'avatar_type' => '',
|
||||
'avatar_width' => '',
|
||||
'avatar_height' => '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'group_avatar' => '',
|
||||
'group_avatar_type' => '',
|
||||
'group_avatar_width' => '',
|
||||
'group_avatar_height' => '',
|
||||
),
|
||||
array(
|
||||
'avatar' => '',
|
||||
'avatar_type' => '',
|
||||
'avatar_width' => '',
|
||||
'avatar_height' => '',
|
||||
'user_avatar' => '',
|
||||
'user_avatar_type' => '',
|
||||
'user_avatar_width' => '',
|
||||
'user_avatar_height' => '',
|
||||
'group_avatar' => '',
|
||||
),
|
||||
'foobar',
|
||||
),
|
||||
array(
|
||||
array(),
|
||||
@@ -189,32 +178,57 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'foobar_avatar' => '',
|
||||
'foobar_avatar_type' => '',
|
||||
'foobar_avatar_width' => '',
|
||||
'foobar_avatar_height' => '',
|
||||
'user_avatar' => '',
|
||||
'user_id' => 5,
|
||||
'group_id' => 4,
|
||||
),
|
||||
array(
|
||||
'foobar_avatar' => '',
|
||||
'foobar_avatar_type' => '',
|
||||
'foobar_avatar_width' => '',
|
||||
'foobar_avatar_height' => '',
|
||||
'user_avatar' => '',
|
||||
'user_id' => 5,
|
||||
'group_id' => 4,
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'user_avatar' => '',
|
||||
'user_id' => 5,
|
||||
'group_id' => 4,
|
||||
),
|
||||
array(
|
||||
'avatar' => '',
|
||||
'id' => 5,
|
||||
'group_id' => 4,
|
||||
),
|
||||
'user',
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'group_avatar' => '',
|
||||
'user_id' => 5,
|
||||
'group_id' => 4,
|
||||
),
|
||||
array(
|
||||
'avatar' => '',
|
||||
'id' => 'g4',
|
||||
'user_id' => 5,
|
||||
),
|
||||
'group',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider database_row_data
|
||||
*/
|
||||
public function test_clean_row(array $input, array $output)
|
||||
public function test_clean_row(array $input, array $output, $prefix = '')
|
||||
{
|
||||
$cleaned_row = array();
|
||||
|
||||
$cleaned_row = \phpbb\avatar\manager::clean_row($input);
|
||||
foreach ($output as $key => $null)
|
||||
$cleaned_row = \phpbb\avatar\manager::clean_row($input, $prefix);
|
||||
foreach ($output as $key => $value)
|
||||
{
|
||||
$this->assertArrayHasKey($key, $cleaned_row);
|
||||
$this->assertEquals($cleaned_row[$key], $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,35 +20,24 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
|
||||
public function test_add()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
}
|
||||
|
||||
public function test_add_twice()
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->fail('Exception not thrown');
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
$this->tool->add('foo', 'bar2');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
}
|
||||
|
||||
public function test_update()
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
try
|
||||
{
|
||||
$this->tool->update('foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
|
||||
$this->tool->update('foo', 'bar2');
|
||||
$this->assertEquals('bar2', $this->config['foo']);
|
||||
}
|
||||
|
||||
@@ -56,24 +45,10 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->update_if_equals('', 'foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->update_if_equals('', 'foo', 'bar2');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
||||
$this->assertEquals('bar2', $this->config['foo']);
|
||||
}
|
||||
|
||||
@@ -81,41 +56,31 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->remove('foo');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->remove('foo');
|
||||
$this->assertFalse(isset($this->config['foo']));
|
||||
}
|
||||
|
||||
public function test_reverse()
|
||||
public function test_reverse_add()
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->reverse('add', 'foo');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->reverse('add', 'foo');
|
||||
$this->assertFalse(isset($this->config['foo']));
|
||||
}
|
||||
|
||||
public function test_reverse_remove()
|
||||
{
|
||||
$this->config->delete('foo');
|
||||
|
||||
$this->tool->reverse('remove', 'foo');
|
||||
$this->assertEquals('', $this->config['foo']);
|
||||
}
|
||||
|
||||
public function test_reverse_update_if_equals()
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
||||
$this->assertEquals('test', $this->config['foo']);
|
||||
}
|
||||
}
|
||||
|
@@ -50,6 +50,15 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av
|
||||
'avatar_delete' => array('tick', ''),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'The URL you specified is invalid.',
|
||||
'avatar_driver_remote',
|
||||
array(
|
||||
'avatar_remote_url' => 'https://www.phpbb.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
|
||||
'avatar_remote_width' => 80,
|
||||
'avatar_remote_height' => 80,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -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,73 @@ 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());
|
||||
// Access enable page without hash
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->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());
|
||||
// Correctly submit the enable form
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('enable')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('EXTENSION_ENABLE_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());
|
||||
// Access disable page without hash
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text());
|
||||
|
||||
// Correctly submit the disable form
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('disable')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $crawler->filter('.successbox')->text());
|
||||
|
||||
// Access delete_data page without hash
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$this->assertContainsLang('FORM_INVALID', $crawler->filter('.errorbox')->text());
|
||||
|
||||
// Correctly submit the delete data form
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('delete_data')->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $crawler->filter('.successbox')->text());
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/config/',
|
||||
'foo/bar/controller/',
|
||||
'foo/bar/event/',
|
||||
'foo/bar/language/en/',
|
||||
'foo/bar/styles/prosilver/template/',
|
||||
);
|
||||
|
||||
|
@@ -17,8 +17,9 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_
|
||||
static private $helper;
|
||||
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/language/en/',
|
||||
'foo/bar/config/',
|
||||
'foo/bar/event/',
|
||||
'foo/bar/language/en/',
|
||||
);
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
|
@@ -17,8 +17,9 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
|
||||
static private $helper;
|
||||
|
||||
static protected $fixtures = array(
|
||||
'foo/bar/language/en/',
|
||||
'foo/bar/config/',
|
||||
'foo/bar/event/',
|
||||
'foo/bar/language/en/',
|
||||
);
|
||||
|
||||
static public function setUpBeforeClass()
|
||||
|
@@ -14,7 +14,7 @@
|
||||
}],
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"phpbb": "3.1.*@dev"
|
||||
"phpbb/phpbb": "3.1.*@dev"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "phpBB 3.1 Extension Testing"
|
||||
|
@@ -4,3 +4,12 @@ services:
|
||||
arguments:
|
||||
- @controller.helper
|
||||
- @template
|
||||
foo_bar.listener.permission:
|
||||
class: foo\bar\event\permission
|
||||
tags:
|
||||
- { name: event.listener }
|
||||
foo_bar.listener.user_setup:
|
||||
class: foo\bar\event\user_setup
|
||||
tags:
|
||||
- { name: event.listener }
|
||||
|
||||
|
@@ -10,15 +10,6 @@
|
||||
|
||||
namespace foo\bar\event;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener
|
||||
*/
|
||||
|
@@ -10,15 +10,6 @@
|
||||
|
||||
namespace foo\bar\event;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener
|
||||
*/
|
||||
|
@@ -52,4 +52,37 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
|
||||
$this->assert_checkbox_is_unchecked($cplist, $checkbox_name);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_mark_notifications_read()
|
||||
{
|
||||
// Create a new standard user
|
||||
$this->create_user('notificationtestuser');
|
||||
$this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser'));
|
||||
$this->login('notificationtestuser');
|
||||
$crawler = self::request('GET', 'index.php');
|
||||
$this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text());
|
||||
|
||||
// Post a new post that needs approval
|
||||
$this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD');
|
||||
$crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}");
|
||||
$this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text());
|
||||
|
||||
// logout
|
||||
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
|
||||
|
||||
// admin login
|
||||
$this->login();
|
||||
$this->add_lang('ucp');
|
||||
$crawler = self::request('GET', 'ucp.php?i=ucp_notifications');
|
||||
|
||||
// At least one notification should exist
|
||||
$this->assertGreaterThan(0, $crawler->filter('#notification_list_button strong')->text());
|
||||
|
||||
// Get form token
|
||||
$link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri();
|
||||
$crawler = self::request('GET', substr($link, strpos($link, 'ucp.')));
|
||||
$form = $crawler->selectButton($this->lang('YES'))->form();
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text());
|
||||
}
|
||||
}
|
||||
|
41
tests/functions_install/ignore_new_file_on_update_test.php
Normal file
41
tests/functions_install/ignore_new_file_on_update_test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_install.php';
|
||||
|
||||
class phpbb_functions_install_ignore_new_file_on_update_test extends phpbb_test_case
|
||||
{
|
||||
static public function ignore_new_file_on_update_data()
|
||||
{
|
||||
return array(
|
||||
array('willneverexist.php', false),
|
||||
array('includes/dirwillneverexist/newfile.php', false),
|
||||
|
||||
array('language/en/email/short/bookmark.txt', false),
|
||||
array('language/languagewillneverexist/email/short/bookmark.txt', true),
|
||||
|
||||
array('styles/prosilver/template/bbcode.html', false),
|
||||
array('styles/stylewillneverexist/template/bbcode.html', true),
|
||||
|
||||
array('styles/prosilver/theme/en/icon_user_online.gif', false),
|
||||
array('styles/prosilver/theme/languagewillneverexist/icon_user_online.gif', true),
|
||||
|
||||
array('styles/prosilver/theme/imageset.css', false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ignore_new_file_on_update_data
|
||||
*/
|
||||
public function test_ignore_new_file_on_update($file, $expected)
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
$this->assertEquals($expected, phpbb_ignore_new_file_on_update($phpbb_root_path, $file));
|
||||
}
|
||||
}
|
@@ -70,6 +70,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
array(),
|
||||
$this->container,
|
||||
$this->user_loader,
|
||||
$this->config,
|
||||
$this->db,
|
||||
$this->cache,
|
||||
$this->user,
|
||||
|
@@ -118,7 +118,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
|
||||
|
||||
// Notification Manager
|
||||
$phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(),
|
||||
$phpbb_container, $user_loader, $db, $cache, $user,
|
||||
$phpbb_container, $user_loader, $config, $db, $cache, $user,
|
||||
$phpbb_root_path, $phpEx,
|
||||
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
|
||||
$phpbb_container->set('notification_manager', $phpbb_notifications);
|
||||
|
@@ -158,7 +158,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
|
||||
array(),
|
||||
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
|
||||
array(),
|
||||
"xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|",
|
||||
"xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|false",
|
||||
),
|
||||
array(
|
||||
'define_advanced.html',
|
||||
@@ -561,4 +561,12 @@ EOT
|
||||
$expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]';
|
||||
$this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Syntax
|
||||
*/
|
||||
public function test_define_error()
|
||||
{
|
||||
$this->run_template('define_error.html', array(), array(), array(), '');
|
||||
}
|
||||
}
|
||||
|
@@ -29,3 +29,9 @@ $VALUE == 'abc'
|
||||
<!-- DEFINE $VALUE = '' -->
|
||||
[{$VALUE}]
|
||||
<!-- DEFINE $TEST -->foobar<!-- ENDDEFINE -->|{$TEST}|
|
||||
<!-- DEFINE $VAR = false -->
|
||||
<!-- IF $VAR -->
|
||||
true
|
||||
<!-- ELSE -->
|
||||
false
|
||||
<!-- ENDIF -->
|
||||
|
2
tests/template/templates/define_error.html
Normal file
2
tests/template/templates/define_error.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<!-- DEFINE $VAR = foo -->
|
||||
{$VAR}
|
@@ -868,9 +868,10 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
* @param array $additional_form_data Any additional form data to be sent in the request
|
||||
* @return array post_id, topic_id
|
||||
* @param string $expected Lang var of expected message after posting
|
||||
* @return array|null post_id, topic_id if message is 'POST_STORED'
|
||||
*/
|
||||
public function create_topic($forum_id, $subject, $message, $additional_form_data = array())
|
||||
public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED')
|
||||
{
|
||||
$posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}";
|
||||
|
||||
@@ -880,7 +881,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return self::submit_post($posting_url, 'POST_TOPIC', $form_data);
|
||||
return self::submit_post($posting_url, 'POST_TOPIC', $form_data, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -893,9 +894,10 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
* @param array $additional_form_data Any additional form data to be sent in the request
|
||||
* @return array post_id, topic_id
|
||||
* @param string $expected Lang var of expected message after posting
|
||||
* @return array|null post_id, topic_id if message is 'POST_STORED'
|
||||
*/
|
||||
public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array())
|
||||
public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED')
|
||||
{
|
||||
$posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}";
|
||||
|
||||
@@ -905,7 +907,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
'post' => true,
|
||||
), $additional_form_data);
|
||||
|
||||
return self::submit_post($posting_url, 'POST_REPLY', $form_data);
|
||||
return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -914,9 +916,10 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
* @param string $posting_url
|
||||
* @param string $posting_contains
|
||||
* @param array $form_data
|
||||
* @return array post_id, topic_id
|
||||
* @param string $expected Lang var of expected message after posting
|
||||
* @return array|null post_id, topic_id if message is 'POST_STORED'
|
||||
*/
|
||||
protected function submit_post($posting_url, $posting_contains, $form_data)
|
||||
protected function submit_post($posting_url, $posting_contains, $form_data, $expected = 'POST_STORED')
|
||||
{
|
||||
$this->add_lang('posting');
|
||||
|
||||
@@ -945,7 +948,12 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
// contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
|
||||
// Instead, I send it as a request with the submit button "post" set to true.
|
||||
$crawler = self::request('POST', $posting_url, $form_data);
|
||||
$this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text());
|
||||
$this->assertContainsLang($expected, $crawler->filter('html')->text());
|
||||
|
||||
if ($expected !== 'POST_STORED')
|
||||
{
|
||||
return;
|
||||
}
|
||||
$url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri();
|
||||
|
||||
return array(
|
||||
|
Reference in New Issue
Block a user