Skip to content

Commit

Permalink
Updated tests and header classes to use Date header
Browse files Browse the repository at this point in the history
- s/OrigDate/Date/g
- s/orig-date/date/g
  • Loading branch information
weierophinney committed Jan 3, 2012
1 parent 4757aff commit d6ec8f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class OrigDate implements Header
class Date implements Header
{
/**
* @var string
Expand All @@ -49,16 +49,16 @@ class OrigDate implements Header
* Factory: create header object from string
*
* @param string $headerLine
* @return OrigDate
* @return Date
* @throws Exception\InvalidArgumentException
*/
public static function fromString($headerLine)
{
list($name, $value) = preg_split('#: #', $headerLine, 2);

// check to ensure proper header type for this factory
if (strtolower($name) !== 'orig-date') {
throw new Exception\InvalidArgumentException('Invalid header line for Orig-Date string');
if (strtolower($name) !== 'date') {
throw new Exception\InvalidArgumentException('Invalid header line for Date string');
}

$header = new static();
Expand All @@ -74,7 +74,7 @@ public static function fromString($headerLine)
*/
public function getFieldName()
{
return 'Orig-Date';
return 'Date';
}

/**
Expand Down Expand Up @@ -116,6 +116,6 @@ public function getEncoding()
*/
public function toString()
{
return 'Orig-Date: ' . $this->getFieldValue();
return 'Date: ' . $this->getFieldValue();
}
}
4 changes: 1 addition & 3 deletions library/Zend/Mail/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,11 @@ public function getPluginClassLoader()
'contenttype' => 'Zend\Mail\Header\ContentType',
'content_type' => 'Zend\Mail\Header\ContentType',
'content-type' => 'Zend\Mail\Header\ContentType',
'date' => 'Zend\Mail\Header\Date',
'from' => 'Zend\Mail\Header\From',
'mimeversion' => 'Zend\Mail\Header\MimeVersion',
'mime_version' => 'Zend\Mail\Header\MimeVersion',
'mime-version' => 'Zend\Mail\Header\MimeVersion',
'origdate' => 'Zend\Mail\Header\OrigDate',
'orig_date' => 'Zend\Mail\Header\OrigDate',
'orig-date' => 'Zend\Mail\Header\OrigDate',
'received' => 'Zend\Mail\Header\Received',
'replyto' => 'Zend\Mail\Header\ReplyTo',
'reply_to' => 'Zend\Mail\Header\ReplyTo',
Expand Down
4 changes: 2 additions & 2 deletions tests/Zend/Mail/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function testSetsOrigDateHeaderByDefault()
{
$headers = $this->message->headers();
$this->assertInstanceOf('Zend\Mail\Headers', $headers);
$this->assertTrue($headers->has('orig-date'));
$header = $headers->get('orig-date');
$this->assertTrue($headers->has('date'));
$header = $headers->get('date');
$date = date('r');
$date = substr($date, 0, 16);
$test = $header->getFieldValue();
Expand Down

0 comments on commit d6ec8f6

Please sign in to comment.