-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #39 Fixes #40 remove laminas-loader dependency #95
Merged
weierophinney
merged 14 commits into
laminas:develop
from
samsonasik:remove-laminas-loader
Jul 30, 2020
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
06cab9d
Fixes #39 Fixes #40 remove laminas-loader dependency
samsonasik 456d1ac
remove test get plugin class loader
samsonasik 6c14e97
fix test testCanParseMultipartReport
samsonasik c1a60d8
Fixes attribute typo
samsonasik 1cb61e3
test fix testCanParseMultipartReport
samsonasik 751f035
cs fix in test HeaderLoader
samsonasik b6fdc6e
keep setPluginClassLoader() and getPluginClassLoader() with E_USER_DE…
samsonasik ba55363
refactor: ensure we can modify header loader, and mark all deprecations
weierophinney c80ca31
docs: adds CHANGELOG entry for #95
weierophinney a044a40
refactor: restore old HeaderLoader, introduce HeaderLocator
weierophinney a99f2d5
refactor: extract interface HeaderLocatorInterface
weierophinney ea80330
refactor: restore laminas-loader dependency
weierophinney 56df540
refactor: differentiate between plugin locator and header locator usage
weierophinney 8e286c0
docs: updates CHANGELOG entries for #95
weierophinney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
/** | ||
* @see https://github.com/laminas/laminas-mail for the canonical source repository | ||
* @copyright https://github.com/laminas/laminas-mail/blob/master/COPYRIGHT.md | ||
* @license https://github.com/laminas/laminas-mail/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace LaminasTest\Mail\Header; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Laminas\Mail\Header; | ||
|
||
class HeaderLoaderTest extends TestCase | ||
{ | ||
/** | ||
* @var Header\HeaderLoader | ||
*/ | ||
private $headerLoader; | ||
|
||
public function setUp() | ||
{ | ||
$this->headerLoader = new Header\HeaderLoader(); | ||
} | ||
|
||
public function provideHeaderNames() | ||
{ | ||
return [ | ||
'with existing name' => ['to', Header\To::class], | ||
'with non-existent name' => ['foo', null], | ||
'with default value' => ['foo', Header\GenericHeader::class, Header\GenericHeader::class], | ||
]; | ||
} | ||
|
||
/** | ||
* @param $name | ||
* @param $expected | ||
* @param $default | ||
* @dataProvider provideHeaderNames | ||
*/ | ||
public function testHeaderIsProperlyLoaded($name, $expected, $default = null) | ||
{ | ||
$this->assertEquals($expected, $this->headerLoader->get($name, $default)); | ||
} | ||
|
||
public function testHeaderExistenceIsProperlyChecked() | ||
{ | ||
$this->assertTrue($this->headerLoader->has('to')); | ||
$this->assertTrue($this->headerLoader->has('To')); | ||
$this->assertTrue($this->headerLoader->has('Reply_to')); | ||
$this->assertTrue($this->headerLoader->has('SUBJECT')); | ||
$this->assertFalse($this->headerLoader->has('foo')); | ||
$this->assertFalse($this->headerLoader->has('bar')); | ||
} | ||
|
||
public function testHeaderCanBeAdded() | ||
{ | ||
$this->assertFalse($this->headerLoader->has('foo')); | ||
$this->headerLoader->add('foo', Header\GenericHeader::class); | ||
$this->assertTrue($this->headerLoader->has('foo')); | ||
} | ||
|
||
public function testHeaderCanBeRemoved() | ||
{ | ||
$this->assertTrue($this->headerLoader->has('to')); | ||
$this->headerLoader->remove('to'); | ||
$this->assertFalse($this->headerLoader->has('to')); | ||
} | ||
|
||
public static function expectedHeaders() | ||
{ | ||
return [ | ||
'bcc' => ['bcc', Header\Bcc::class], | ||
'cc' => ['cc', Header\Cc::class], | ||
'contenttype' => ['contenttype', Header\ContentType::class], | ||
'content_type' => ['content_type', Header\ContentType::class], | ||
'content-type' => ['content-type', Header\ContentType::class], | ||
'date' => ['date', Header\Date::class], | ||
'from' => ['from', Header\From::class], | ||
'mimeversion' => ['mimeversion', Header\MimeVersion::class], | ||
'mime_version' => ['mime_version', Header\MimeVersion::class], | ||
'mime-version' => ['mime-version', Header\MimeVersion::class], | ||
'received' => ['received', Header\Received::class], | ||
'replyto' => ['replyto', Header\ReplyTo::class], | ||
'reply_to' => ['reply_to', Header\ReplyTo::class], | ||
'reply-to' => ['reply-to', Header\ReplyTo::class], | ||
'sender' => ['sender', Header\Sender::class], | ||
'subject' => ['subject', Header\Subject::class], | ||
'to' => ['to', Header\To::class], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider expectedHeaders | ||
* @param string $name | ||
* @param Header\HeaderInterface $class | ||
*/ | ||
public function testDefaultHeadersMapResolvesProperHeader($name, $class) | ||
{ | ||
$this->assertEquals($class, $this->headerLoader->get($name)); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Laminas\Loader\PluginClassLocator
can be changed withPluginClassLocator
as the class re-added to use statement.