diff --git a/.travis.yml b/.travis.yml index d7cbe9d4..dee6920b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ before_script: fi script: - - ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist --bootstrap ./vendor/autoload.php + - ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist - if [ "$CS_CHECK" = 1 ]; then ./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix; fi after_script: diff --git a/composer.json b/composer.json index 6db71be4..53be72f3 100644 --- a/composer.json +++ b/composer.json @@ -45,5 +45,10 @@ "PHPMailer\\PHPMailer\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "PHPMailer\\Test\\": "test/" + } + }, "license": "LGPL-2.1" } diff --git a/test/DebugLogTestListener.php b/test/DebugLogTestListener.php new file mode 100644 index 00000000..f84ed8ad --- /dev/null +++ b/test/DebugLogTestListener.php @@ -0,0 +1,39 @@ + + * @author Andy Prevost + * @copyright 2010 - 2017 Marcus Bointon + * @copyright 2004 - 2009 Andy Prevost + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + */ + +namespace PHPMailer\Test; + +class DebugLogTestListener extends \PHPUnit_Framework_BaseTestListener +{ + private static $debugLog = ''; + + public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + echo self::$debugLog; + } + + public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) + { + echo self::$debugLog; + } + + public function startTest(\PHPUnit_Framework_Test $test) + { + self::$debugLog = ''; + } + + public static function debugLog($str) + { + self::$debugLog .= $str . PHP_EOL; + } +} diff --git a/test/PHPMailerTest.php b/test/PHPMailerTest.php index 50e13432..a3887791 100644 --- a/test/PHPMailerTest.php +++ b/test/PHPMailerTest.php @@ -70,6 +70,7 @@ class PHPMailerTest extends \PHPUnit_Framework_TestCase } $this->Mail = new PHPMailer(); $this->Mail->SMTPDebug = 3; //Full debug output + $this->Mail->Debugoutput = ['PHPMailer\Test\DebugLogTestListener', 'debugLog']; $this->Mail->Priority = 3; $this->Mail->Encoding = '8bit'; $this->Mail->CharSet = 'iso-8859-1'; diff --git a/travis.phpunit.xml.dist b/travis.phpunit.xml.dist index 0f18687d..507cd970 100644 --- a/travis.phpunit.xml.dist +++ b/travis.phpunit.xml.dist @@ -1,5 +1,6 @@ @@ -16,6 +17,9 @@ ./test/ + + + languages