<commit_before><?php
namespace ZBateson\MailMimeParser\Header\Part;

use PHPUnit_Framework_TestCase;
use DateTime;

/**
 * Description of DateTest
 *
 * @group HeaderParts
 * @group DatePart
 * @covers ZBateson\MailMimeParser\Header\Part\DatePart
 * @author <NAME>
 */
class DatePartTest extends PHPUnit_Framework_TestCase
{
    public function testDateString()
    {
        $value = 'Wed, 17 May 2000 19:08:29 -0400';
        $part = new DatePart($value);
        $this->assertEquals($value, $part->getValue());
        $date = $part->getDateTime();
        $this->assertNotEmpty($date);
        $this->assertEquals($value, $date->format(DateTime::RFC2822));
    }
}<commit_msg>Add DatePart invalid date unit test<commit_after><?php
namespace ZBateson\MailMimeParser\Header\Part;

use PHPUnit_Framework_TestCase;
use DateTime;

/**
 * Description of DateTest
 *
 * @group HeaderParts
 * @group DatePart
 * @covers ZBateson\MailMimeParser\Header\Part\DatePart
 * @author <NAME>
 */
class DatePartTest extends PHPUnit_Framework_TestCase
{
    public function testDateString()
    {
        $value = 'Wed, 17 May 2000 19:08:29 -0400';
        $part = new DatePart($value);
        $this->assertEquals($value, $part->getValue());
        $date = $part->getDateTime();
        $this->assertNotEmpty($date);
        $this->assertEquals($value, $date->format(DateTime::RFC2822));
    }
    
    public function testInvalidDate()
    {
        $value = 'Invalid Date';
        $part = new DatePart($value);
        $this->assertEquals($value, $part->getValue());
        $date = $part->getDateTime();
        $this->assertNull($date);
    }
}
{'fraction_non_alphanumeric': 0.14364303178484109, 'fraction_numerical': 0.02444987775061125, 'mean_word_length': 3.448369565217391, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3864647', 'n_tokens_mistral': 528, 'n_tokens_neox': 498, 'n_words': 103}