Browse Source

Fix tests.

dereuromark 8 years ago
parent
commit
f98c0786a1
3 changed files with 36 additions and 31 deletions
  1. 2 2
      src/Mailer/Email.php
  2. 31 0
      tests/TestApp/Mailer/TestEmail.php
  3. 3 29
      tests/TestCase/Mailer/EmailTest.php

+ 2 - 2
src/Mailer/Email.php

@@ -195,7 +195,7 @@ class Email extends CakeEmail {
 
 	/**
 	 * Overwrite to allow mimetype detection
-	 +
+	 *
 	 * @param string|array $attachments String with the filename or array with filenames
 	 * @return $this
 	 * @throws \InvalidArgumentException
@@ -564,7 +564,7 @@ class Email extends CakeEmail {
 			'transport' => get_class($this->_transport),
 		];
 
-		/** @deprecated Since CakePHP 3.4.0-RC4 in core **/
+		/* @deprecated Since CakePHP 3.4.0-RC4 in core */
 		if ($this->_priority) {
 			$this->_headers['X-Priority'] = $this->_priority;
 		}

+ 31 - 0
tests/TestApp/Mailer/TestEmail.php

@@ -0,0 +1,31 @@
+<?php
+namespace TestApp\Mailer;
+
+use Tools\Mailer\Email;
+
+/**
+ * Help to test Email
+ */
+class TestEmail extends Email {
+
+	/**
+	 * Wrap to protected method
+	 *
+	 * @param string $text
+	 * @param int $length
+	 * @return array
+	 */
+	public function wrap($text, $length = Email::LINE_LENGTH_MUST) {
+		return parent::_wrap($text, $length);
+	}
+
+	/**
+	 * @param string $attribute
+	 * @return mixed
+	 */
+	public function getProtected($attribute) {
+		$attribute = '_' . $attribute;
+		return $this->$attribute;
+	}
+
+}

+ 3 - 29
tests/TestCase/Mailer/EmailTest.php

@@ -5,6 +5,7 @@ namespace Tools\Test\TestCase\Mailer;
 use Cake\Core\Configure;
 use Cake\Core\Plugin;
 use Cake\Log\Log;
+use TestApp\Mailer\TestEmail;
 use Tools\Mailer\Email;
 use Tools\TestSuite\TestCase;
 
@@ -14,7 +15,7 @@ use Tools\TestSuite\TestCase;
 class EmailTest extends TestCase {
 
 	/**
-	 * @var TestEmail
+	 * @var \TestApp\Mailer\TestEmail
 	 */
 	protected $Email;
 
@@ -82,7 +83,7 @@ class EmailTest extends TestCase {
 		$this->assertSame($expected, $this->Email->from());
 		$this->assertSame($this->Email, $result);
 
-		$this->expectException('InvalidArgumentException');
+		$this->setExpectedException('InvalidArgumentException');
 		$this->Email->from(['cake@cakephp.org' => 'CakePHP', 'fail@cakephp.org' => 'From can only be one address']);
 	}
 
@@ -432,30 +433,3 @@ HTML;
 	}
 
 }
-
-/**
- * Help to test Email
- */
-class TestEmail extends Email {
-
-	/**
-	 * Wrap to protected method
-	 *
-	 * @param string $text
-	 * @param int $length
-	 * @return array
-	 */
-	public function wrap($text, $length = Email::LINE_LENGTH_MUST) {
-		return parent::_wrap($text, $length);
-	}
-
-	/**
-	 * @param string $attribute
-	 * @return mixed
-	 */
-	public function getProtected($attribute) {
-		$attribute = '_' . $attribute;
-		return $this->$attribute;
-	}
-
-}