Passage en Namespace et tous les tests fonctionnels OK

This commit is contained in:
2021-05-10 11:48:15 +02:00
parent 536dd0d56b
commit eb30d8ef97
56 changed files with 1091 additions and 964 deletions

View File

@@ -7,12 +7,14 @@
namespace Domframework\Tests;
/** Test the mail.php file */
class mailTest extends \PHPUnit_Framework_TestCase
use Domframework\Mail;
/** Test the Mail.php file */
class MailTest extends \PHPUnit_Framework_TestCase
{
public function test_setBodyText1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->setBodyText ("TEST");
$res = $mail->getMail ();
$this->assertRegExp ("#TEST\n$#", $res);
@@ -20,7 +22,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setBodyHTML1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->setBodyHTML ("TEST");
$res = $mail->getMail ();
$this->assertRegExp ("#^\r\nTEST\n$#m", $res);
@@ -28,7 +30,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setGetBodyText1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->setBodyText ("TEST");
$res = $mail->getBodyText ();
$this->assertSame ("TEST\n", $res);
@@ -36,7 +38,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setGetBodyHtml1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->setBodyHtml ("TEST");
$res = $mail->getBodyHtml ();
$this->assertSame ("TEST\n", $res);
@@ -44,7 +46,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setFrom1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->setFrom ("test@example.com", "Test Exa1mple Com");
$res = $mail->getFrom ();
$this->assertSame ("Test Exa1mple Com <test@example.com>\r\n", $res);
@@ -52,7 +54,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_addTo1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->addTo ("test@example.com", "Test Exa1mple Com");
$res = $mail->getTo ();
$this->assertSame ("Test Exa1mple Com <test@example.com>\r\n", $res);
@@ -60,7 +62,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_addTo2 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->addTo ("test@example.com", "Test Exa1mple Com");
$res = $mail->getMail ();
$this->assertRegexp ("#^To: Test Exa1mple Com <test@example.com>\r$#m", $res);
@@ -68,7 +70,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setDateTimestamp1 ()
{
$mail = new mail ();
$mail = new Mail ();
$time = time ();
$mail->setDateTimestamp ($time);
$res = $mail->getDateTimestamp ();
@@ -77,7 +79,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_setDateTimestamp2 ()
{
$mail = new mail ();
$mail = new Mail ();
$time = time ();
$mail->setDateTimestamp ($time);
$res = $mail->getMail ();
@@ -86,7 +88,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray1 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray ("toto toto <toto@toto.com>");
$this->assertSame ($res, array (array ("name"=>"toto toto",
"mail"=>"toto@toto.com")));
@@ -94,7 +96,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray2 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray ("<toto@toto.com>");
$this->assertSame ($res, array (array ("name"=>"",
"mail"=>"toto@toto.com")));
@@ -102,7 +104,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray3 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray ("toto@toto.com,titi@titi.com");
$this->assertSame ($res, array (array ("name" => "",
"mail" => "toto@toto.com"),
@@ -112,7 +114,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray4 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray ("toto@toto.com");
$this->assertSame ($res, array (array ("name"=>"",
"mail"=>"toto@toto.com")));
@@ -120,7 +122,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray5 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray (" <toto@toto.com> , <titi@titi.com>");
$this->assertSame ($res, array (array ("name" => "",
"mail" => "toto@toto.com"),
@@ -130,7 +132,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
public function test_convertPeopleToArray6 ()
{
$mail = new mail ();
$mail = new Mail ();
$res = $mail->convertPeopleToArray ("ToTo <toto@toto.com> , <titi@titi.com>");
$this->assertSame ($res, array (array ("name" => "ToTo",
"mail" => "toto@toto.com"),
@@ -142,7 +144,7 @@ class mailTest extends \PHPUnit_Framework_TestCase
*/
public function testHeadersToJSON1 ()
{
$mail = new mail ();
$mail = new Mail ();
$mail->readMail ( // {{{
"Return-Path: <dominique.fournier@grenoble.cnrs.fr>
Delivered-To: dominique@fournier38.fr