mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
Test fixes. Email arraySet() test added.
This commit is contained in:
@@ -812,8 +812,6 @@ class e107Email extends PHPMailer
|
|||||||
|
|
||||||
$mediaParms = array();
|
$mediaParms = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(strpos($eml['templateHTML']['body'], '{MEDIA') !==false )
|
if(strpos($eml['templateHTML']['body'], '{MEDIA') !==false )
|
||||||
{
|
{
|
||||||
// check for media sizing.
|
// check for media sizing.
|
||||||
@@ -905,7 +903,7 @@ class e107Email extends PHPMailer
|
|||||||
|
|
||||||
if(!empty($eml['template'])) // @see e107_core/templates/email_template.php
|
if(!empty($eml['template'])) // @see e107_core/templates/email_template.php
|
||||||
{
|
{
|
||||||
|
e107::coreLan('users', true);
|
||||||
if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry?
|
if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry?
|
||||||
{
|
{
|
||||||
$eml['templateHTML'] = $tmpl;
|
$eml['templateHTML'] = $tmpl;
|
||||||
|
@@ -486,12 +486,18 @@ class e_plugin
|
|||||||
|
|
||||||
public function isValidAddonMarkup($content='')
|
public function isValidAddonMarkup($content='')
|
||||||
{
|
{
|
||||||
if ((substr($content, 0, 5) != '<'.'?php') || ((substr($content, -2, 2) != '?'.'>') && (strrpos($content, '?'.'>') !== FALSE)))
|
if ((substr($content, 0, 5) != '<'.'?php'))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if ((substr($content, -2, 2) != '?'.'>') && (strrpos(substr($content, -20, 20), '?'.'>') !== false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2428,7 +2434,7 @@ class e107plugin
|
|||||||
function manage_tables($action, $var)
|
function manage_tables($action, $var)
|
||||||
{
|
{
|
||||||
$this->log("Running ".__FUNCTION__);
|
$this->log("Running ".__FUNCTION__);
|
||||||
$sql = e107::getDB();
|
$sql = e107::getDb();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
if (!is_array($var))
|
if (!is_array($var))
|
||||||
|
@@ -340,10 +340,10 @@ class e_tohtml_linkwords
|
|||||||
$lwClass[] = $this->word_class[$first];
|
$lwClass[] = $this->word_class[$first];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count($lwClass))
|
// if (!count($lwClass))
|
||||||
{
|
// {
|
||||||
// return $this->linksproc($sl,$first+1,$limit); // Nothing to do - move on to next word (shouldn't really get here)
|
// return $this->linksproc($sl,$first+1,$limit); // Nothing to do - move on to next word (shouldn't really get here)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (count($linkrel))
|
if (count($linkrel))
|
||||||
{
|
{
|
||||||
|
@@ -11,7 +11,7 @@ class siteinfo_shortcodes // must match the folder name of the plugin.
|
|||||||
function sc_sitebutton($parm=null)
|
function sc_sitebutton($parm=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($_POST['sitebutton'] && $_POST['ajax_used'])
|
if(!empty($_POST['sitebutton']) && !empty($_POST['ajax_used']))
|
||||||
{
|
{
|
||||||
$path = e107::getParser()->replaceConstants($_POST['sitebutton']);
|
$path = e107::getParser()->replaceConstants($_POST['sitebutton']);
|
||||||
}
|
}
|
||||||
|
135
e107_tests/tests/unit/e107EmailTest.php
Normal file
135
e107_tests/tests/unit/e107EmailTest.php
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2020 e107.org
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class e107EmailTest extends \Codeception\Test\Unit
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var e107Email */
|
||||||
|
protected $eml;
|
||||||
|
|
||||||
|
protected function _before()
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->eml = $this->make('e107Email');
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false, "Couldn't load e107Email object");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->eml->__construct();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function testAllSent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testProcessShortcodes()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function testArraySet()
|
||||||
|
{
|
||||||
|
$eml = array(
|
||||||
|
'subject' => "[URGENT EXAMPLE]",
|
||||||
|
'sender_email' => "noreply@test.com",
|
||||||
|
'sender_name' => "Test Person",
|
||||||
|
'replyto' => "",
|
||||||
|
'html' => true,
|
||||||
|
'priority' => 1,
|
||||||
|
'template' => 'default',
|
||||||
|
'body' => "This is the body text",
|
||||||
|
'cc' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->eml->arraySet($eml);
|
||||||
|
|
||||||
|
$this->assertStringContainsString("noreply@test.com", $this->eml->From);
|
||||||
|
$this->assertStringContainsString("Test Person", $this->eml->FromName);
|
||||||
|
$this->assertStringContainsString("e107: [URGENT EXAMPLE] ", $this->eml->Subject);
|
||||||
|
$this->assertStringContainsString("This is the body text", $this->eml->Body);
|
||||||
|
$this->assertStringContainsString("<h4 class='sitename'><a href='", $this->eml->Body);
|
||||||
|
$this->assertStringNotContainsString('{MEDIA1}', $this->eml->Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function testMakePrintableAddress()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPreview()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddInlineImages()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMsgHTML()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSendEmail()
|
||||||
|
{
|
||||||
|
|
||||||
|
$eml = array(
|
||||||
|
'subject' => "[URGENT EXAMPLE] ",
|
||||||
|
'sender_email' => "noreply@test.com",
|
||||||
|
'sender_name' => "Test",
|
||||||
|
'replyto' => "",
|
||||||
|
'html' => true,
|
||||||
|
'priority' => 1,
|
||||||
|
'template' => 'default',
|
||||||
|
'body' => "This is the body text",
|
||||||
|
'cc' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$this->eml->sendEmail('test@nowhere.com',"This is the subject", $eml);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetDebug()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddAddressList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAttach()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMakeBody()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -298,6 +298,13 @@
|
|||||||
|
|
||||||
public function testIsValidAddonMarkup()
|
public function testIsValidAddonMarkup()
|
||||||
{
|
{
|
||||||
|
$content = '<?php
|
||||||
|
|
||||||
|
';
|
||||||
|
$result = $this->ep->isValidAddonMarkup($content);
|
||||||
|
$this->assertTrue($result);
|
||||||
|
|
||||||
|
|
||||||
$content = ' <?php ';
|
$content = ' <?php ';
|
||||||
$result = $this->ep->isValidAddonMarkup($content);
|
$result = $this->ep->isValidAddonMarkup($content);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
|
Reference in New Issue
Block a user