Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

DevelopThis is a new PR since the base branch has changed. Please see #5017 #5261

Merged
merged 4 commits into from

2 participants

@manchuck

Please see #5017 for comments

@Maks3w Maks3w merged commit 05350dc into zendframework:develop
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-mail
@Maks3w Maks3w Merge pull request zendframework/zf2#5261 from manchuck/develop
DevelopThis is a new PR since the base branch has changed.  Please see zendframework/zf2#5017
8090a95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 24, 2013
  1. @manchuck
Commits on Oct 4, 2013
  1. Corrected getLastMessage() to return proper property

    Chuck "MANCHUCK" Reeves authored
Commits on Oct 12, 2013
  1. removed @package and @subpackage from doc blocks

    manchuck authored
    Correct class comment for null transport
This page is out of date. Refresh to see the latest.
View
46 library/Zend/Mail/Transport/Null.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+namespace Zend\Mail\Transport;
+
+use Zend\Mail\Message;
+
+/**
+ * File transport
+ *
+ * The null transport will just store the message in memory. It is helpful
+ * when unit testing.
+ */
+class Null implements TransportInterface
+{
+ /**
+ * @var Message
+ */
+ protected $lastMessage;
+
+ /**
+ * Takes the last message and Saves it for testing
+ *
+ * @param Message $message
+ */
+ public function send(Message $message)
+ {
+ $this->lastMessage = $message;
+ }
+
+ /**
+ * Get the last message sent
+ *
+ * @return Message
+ */
+ public function getLastMessage()
+ {
+ return $this->lastMessage;
+ }
+}
View
48 tests/ZendTest/Mail/Transport/NullTest.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+namespace ZendTest\Mail\Transport;
+
+use Zend\Mail\Message;
+use Zend\Mail\Transport\Null;
+
+/**
+ * @group Zend_Mail
+ */
+class NullTest extends \PHPUnit_Framework_TestCase
+{
+ public function getMessage()
+ {
+ $message = new Message();
+ $message->addTo('zf-devteam@zend.com', 'ZF DevTeam')
+ ->addCc('matthew@zend.com')
+ ->addBcc('zf-crteam@lists.zend.com', 'CR-Team, ZF Project')
+ ->addFrom(array(
+ 'zf-devteam@zend.com',
+ 'Matthew' => 'matthew@zend.com',
+ ))
+ ->setSender('ralph.schindler@zend.com', 'Ralph Schindler')
+ ->setSubject('Testing Zend\Mail\Transport\Sendmail')
+ ->setBody('This is only a test.');
+ $message->getHeaders()->addHeaders(array(
+ 'X-Foo-Bar' => 'Matthew',
+ ));
+ return $message;
+ }
+
+ public function testReceivesMailArtifacts()
+ {
+ $message = $this->getMessage();
+ $transport = new Null();
+
+ $transport->send($message);
+
+ $this->assertSame($message, $transport->getLastMessage());
+ }
+}
Something went wrong with that request. Please try again.