[ticket/269] Use trimmessage tool as extension and add test

B3P-269
This commit is contained in:
Marc Alexander
2014-06-27 17:39:16 +02:00
parent 87bf71684d
commit 7d0edf7403
3 changed files with 23 additions and 12 deletions

View File

@@ -412,21 +412,14 @@ function character_limit(&$title, $limit = 0)
*/
function get_sub_taged_string($message, $bbcode_uid, $length)
{
global $portal_root_path, $phpEx;
if(!class_exists('phpbb_trim_message'))
if (class_exists('\nickvergessen\trimmessage\trim_message'))
{
include($portal_root_path . 'includes/trim_message/trim_message.' . $phpEx);
$trim = new \nickvergessen\trimmessage\trim_message($message, $bbcode_uid, $length);
$message = $trim->message();
unset($trim);
}
if(!class_exists('phpbb_trim_message_bbcodes'))
{
include($portal_root_path . 'includes/trim_message/bbcodes.' . $phpEx);
}
$object = new phpbb_trim_message($message, $bbcode_uid, $length);
// Ready to get parsed:
return $object->message();
return $message;
}
function ap_validate($str)

View File

@@ -56,4 +56,19 @@ class phpbb_functional_portal_announcement_test extends \board3\portal\tests\tes
$this->logout();
self::request('GET', 'app.php/portal');
}
public function test_shortened_message()
{
// Create topic as announcement
$data = $this->create_topic(2, 'Portal-announce-global', str_repeat('This is a global announcement for the portal', 6), array(
'topic_type' => POST_GLOBAL,
));
if (isset($data))
{
// no errors should appear on portal
$crawler = self::request('GET', 'app.php/portal');
$this->assertContains('This is a global announc [...]', $crawler->text());
}
}
}

View File

@@ -22,3 +22,6 @@ cd ../../
# Clone phpBB
git clone --depth=1 "git://github.com/phpbb/phpbb.git" "phpBB3" --branch=$BRANCH
# Clone trimmessage tool
git clone --depth=1 "git://github.com/nickvergessen/phpbb-tool-trimmessage.git" "phpBB3/phpBB/ext/nickvergessen/trimmessage"