From fd3d9d61cd52f9dd2214cf267ff45f2f19e12326 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 25 Jul 2020 06:52:56 +0700 Subject: [PATCH 1/3] remove null transport Signed-off-by: Abdul Malik Ikhsan --- src/Transport/Factory.php | 1 - src/Transport/Null.php | 34 ---------------------------------- test/Transport/FactoryTest.php | 9 +-------- test/Transport/NullTest.php | 31 ------------------------------- 4 files changed, 1 insertion(+), 74 deletions(-) delete mode 100644 src/Transport/Null.php delete mode 100644 test/Transport/NullTest.php diff --git a/src/Transport/Factory.php b/src/Transport/Factory.php index 88301aa4..e5b1e6e4 100644 --- a/src/Transport/Factory.php +++ b/src/Transport/Factory.php @@ -20,7 +20,6 @@ abstract class Factory 'file' => File::class, 'inmemory' => InMemory::class, 'memory' => InMemory::class, - 'null' => InMemory::class, 'sendmail' => Sendmail::class, 'smtp' => Smtp::class, ]; diff --git a/src/Transport/Null.php b/src/Transport/Null.php deleted file mode 100644 index 4f4ff3c5..00000000 --- a/src/Transport/Null.php +++ /dev/null @@ -1,34 +0,0 @@ - 'null' + 'type' => 'inMemory' ]); $transport = Factory::create($spec); diff --git a/test/Transport/NullTest.php b/test/Transport/NullTest.php deleted file mode 100644 index bbf7fc1e..00000000 --- a/test/Transport/NullTest.php +++ /dev/null @@ -1,31 +0,0 @@ -=')) { - $this->markTestSkipped('Cannot test Null transport under PHP 7; reserved keyword'); - } - } - - public function testRaisesNoticeOnInstantiation() - { - $this->expectException('PHPUnit_Framework_Error_Deprecated'); - new NullTransport(); - } -} From 08b32fa025cf4499809df6189d01f3e446b4a6e8 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 30 Jul 2020 09:25:11 -0500 Subject: [PATCH 2/3] qa: restore "null" transport name, mapping to InMemory transport Prevents BC breaks. Signed-off-by: Matthew Weier O'Phinney --- src/Transport/Factory.php | 1 + test/Transport/FactoryTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Transport/Factory.php b/src/Transport/Factory.php index e5b1e6e4..88301aa4 100644 --- a/src/Transport/Factory.php +++ b/src/Transport/Factory.php @@ -20,6 +20,7 @@ abstract class Factory 'file' => File::class, 'inmemory' => InMemory::class, 'memory' => InMemory::class, + 'null' => InMemory::class, 'sendmail' => Sendmail::class, 'smtp' => Smtp::class, ]; diff --git a/test/Transport/FactoryTest.php b/test/Transport/FactoryTest.php index 3f529fff..83d788df 100644 --- a/test/Transport/FactoryTest.php +++ b/test/Transport/FactoryTest.php @@ -10,7 +10,6 @@ use Laminas\Mail\Transport\Factory; use Laminas\Mail\Transport\InMemory; -use Laminas\Mail\Transport\Null as NullTransport; use Laminas\Mail\Transport\Sendmail; use Laminas\Stdlib\ArrayObject; use PHPUnit\Framework\TestCase; @@ -104,6 +103,9 @@ public function typeAliasProvider() ['sendmail', Sendmail::class], ['smtp', Smtp::class], ['File', File::class], + ['null', InMemory::class], + ['Null', InMemory::class], + ['NULL', InMemory::class], ['Sendmail', Sendmail::class], ['SendMail', Sendmail::class], ['Smtp', Smtp::class], @@ -117,7 +119,7 @@ public function typeAliasProvider() public function testCanUseTraversableAsSpec() { $spec = new ArrayObject([ - 'type' => 'inMemory' + 'type' => 'inMemory', ]); $transport = Factory::create($spec); From 9b19a4840aac2efc9d74963ef367687f87dabdd0 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 30 Jul 2020 09:26:53 -0500 Subject: [PATCH 3/3] docs: adds CHANGELOG entry for #98 Signed-off-by: Matthew Weier O'Phinney --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b77c7e7..b3b1b526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ All notable changes to this project will be documented in this file, in reverse ### Removed -- Nothing. +- [#98](https://github.com/laminas/laminas-mail/pull/98) removes `Laminas\Mail\Transport\Null`, as it is unusable with the new minimum supported PHP version (7.1). Users should use `Laminas\Mail\Transport\InMemory` instead. As this has been the default when requesting a "null" transport from `Laminas\Mail\Transport\Factory` for the past several minor releases, end-users should be unaffected. However, **users are encouraged to specify "inmemory" instead of "null" when requiring a no-op transport.** ### Fixed