1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-29 17:19:56 +02:00

Forum and User-extended shortcode improvements and test tweaks.

This commit is contained in:
Cameron
2021-01-11 08:45:08 -08:00
parent d4df39bc75
commit 3d217bc49b
6 changed files with 111 additions and 46 deletions

View File

@@ -14,6 +14,7 @@
private $structTypes;
private $structLabels;
private $userValues;
/** @var e107_user_extended */
protected $ue;
@@ -272,6 +273,11 @@
foreach($this->userValues as $field => $value)
{
if(empty($value))
{
continue;
}
$parm = $field.'.icon.1';
$result = $tp->parseTemplate('{USER_EXTENDED='.$parm.'}', true); // retrieve value for $field of user_id: 1.
$this->assertStringContainsString($legacyExpectedIcons[$field], $result);
@@ -351,9 +357,15 @@
*/
public function testGetFieldType()
{
$result = $this->ue->getFieldType('user_radio');
$this->assertEquals(EUF_RADIO,$result);
foreach($this->structTypes as $field=>$type)
{
$fieldname = 'user_'.$field;
$result = $this->ue->getFieldType($fieldname);
$this->assertEquals($type, $result);
}
}
public function testGetFieldValues()
@@ -551,12 +563,36 @@
{
}
*/
public function testRenderValue()
{
$expectedRenderedValues = array (
'text' => 'Some Text',
'homepage' => 'https://e107.org',
'radio' => 'Male',
'dropdown' => 'drop3',
'dbfield' => 'News',
'textarea' => 'Text area value',
'integer' => '21',
'date' => '2001-01-11',
'language' => 'English',
'list' => 'America/Aruba (-04:00)',
'checkbox' => 'value2, value3',
'predefined' => 'predefined',
'country' => 'United States',
'richtextarea' => '<b>Rich text</b>',
);
foreach($this->userValues as $field => $v)
{
$name = 'user_'.$field;
$result = $this->ue->renderValue($v, $name);
$this->assertEquals($expectedRenderedValues[$field], $result);
}
}
*/
public function testGetFieldNames()
{
$expected = array (

View File

@@ -1032,20 +1032,27 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'post_forum' => '4',
'post_status' => '0',
'post_datestamp' => '1367307189',
'post_user' => '2',
'post_user' => 1,
'post_edit_datestamp' => NULL,
'post_edit_user' => NULL,
'post_ip' => NULL,
'post_user_anon' => NULL,
'post_attachments' => NULL,
'post_options' => NULL
'post_options' => NULL,
'user_join' => time(),
'user_id' => 1,
'user_name' => USERNAME,
'user_hideemail' => 1,
'user_plugin_forum_posts' => 3,
'user_visits' => 6,
'user_admin' => 1,
'user_join' => time() - 8000,
);
$sc->__construct();
$sc->setVars($vars);
$sc->setScVar('postInfo', $vars);
$this->processShortcodeMethods($sc);