<commit_before><?php

/**
 * PHPMailer - PHP email transport unit tests.
 * PHP version 5.5.
 *
 * @author    <NAME> <<EMAIL>>
 * @author    <NAME>
 * @copyright 2012 - 2020 <NAME>
 * @copyright 2004 - 2009 <NAME>
 * @license   http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
 */

namespace PHPMailer\Test\PHPMailer;

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\Test\TestCase;

/**
 * Test word wrapping functionality.
 */
final class WrapTextTest extends TestCase
{

    public function testVeryLongWordInMessage_wrapText_returnsWrappedText()
    {
        $message = 'Lorem ipsumdolorsitametconsetetursadipscingelitrseddiamnonumy';
        $expected = 'Lorem' . PHPMailer::getLE() .
            'ipsumdolorsitametconsetetursadipscingelitrseddiamnonumy' . PHPMailer::getLE();
        $expectedqp = 'Lorem ipsumdolorsitametconsetetursadipscingelitrs=' .
            PHPMailer::getLE() . 'eddiamnonumy' . PHPMailer::getLE();
        $this->assertSame($expectedqp, $this->Mail->wrapText($message, 50, true));
        $this->assertSame($expected, $this->Mail->wrapText($message, 50, false));
    }
}<commit_msg>WrapTextTest: reorganize to use data providers<commit_after><?php

/**
 * PHPMailer - PHP email transport unit tests.
 * PHP version 5.5.
 *
 * @author    <NAME> <<EMAIL>>
 * @author    <NAME>
 * @copyright 2012 - 2020 <NAME>
 * @copyright 2004 - 2009 <NAME>
 * @license   http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
 */

namespace PHPMailer\Test\PHPMailer;

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\Test\TestCase;

/**
 * Test word wrapping functionality.
 */
final class WrapTextTest extends TestCase
{

    /**
     * Test wrapping text.
     *
     * @dataProvider dataWrapText
     *
     * @param string $message  Input text string.
     * @param string $expected Expected funtion output.
     * @param bool   $qp_mode  Optional. Whether to run in Quoted-Printable mode. Defaults to `false`.
     * @param int    $length   Optional. Length to wrap at. Defaults to `50`.
     */
    public function testWrapText($message, $expected, $qp_mode = false, $length = 50)
    {
        $this->assertSame($expected, $this->Mail->wrapText($message, $length, $qp_mode));
    }

    /**
     * Data provider.
     *
     * @return array
     */
    public function dataWrapText()
    {
        return [
            'very long word in message, qp: false' => [
                'message'  => 'Lorem ipsumdolorsitametconsetetursadipscingelitrseddiamnonumy',
                'expected' => 'Lorem' . PHPMailer::getLE()
                    . 'ipsumdolorsitametconsetetursadipscingelitrseddiamnonumy' . PHPMailer::getLE(),
                'qp_mode'  => false,
            ],
            'very long word in message, qp: true' => [
                'message'  => 'Lorem ipsumdolorsitametconsetetursadipscingelitrseddiamnonumy',
                'expected' => 'Lorem ipsumdolorsitametconsetetursadipscingelitrs=' . PHPMailer::getLE()
                    . 'eddiamnonumy' . PHPMailer::getLE(),
                'qp_mode'  => true,
            ],
        ];
    }
}
{'fraction_non_alphanumeric': 0.12371794871794872, 'fraction_numerical': 0.014102564102564103, 'mean_word_length': 2.7602409638554217, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800674', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1036, 'n_words': 216}