Skip to content

Commit f98c078

Browse files
author
dereuromark
committed
Fix tests.
1 parent 599e23a commit f98c078

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

src/Mailer/Email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function profile($config = null) {
195195

196196
/**
197197
* Overwrite to allow mimetype detection
198-
+
198+
*
199199
* @param string|array $attachments String with the filename or array with filenames
200200
* @return $this
201201
* @throws \InvalidArgumentException
@@ -564,7 +564,7 @@ public function send($message = null) {
564564
'transport' => get_class($this->_transport),
565565
];
566566

567-
/** @deprecated Since CakePHP 3.4.0-RC4 in core **/
567+
/* @deprecated Since CakePHP 3.4.0-RC4 in core */
568568
if ($this->_priority) {
569569
$this->_headers['X-Priority'] = $this->_priority;
570570
}

tests/TestApp/Mailer/TestEmail.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
namespace TestApp\Mailer;
3+
4+
use Tools\Mailer\Email;
5+
6+
/**
7+
* Help to test Email
8+
*/
9+
class TestEmail extends Email {
10+
11+
/**
12+
* Wrap to protected method
13+
*
14+
* @param string $text
15+
* @param int $length
16+
* @return array
17+
*/
18+
public function wrap($text, $length = Email::LINE_LENGTH_MUST) {
19+
return parent::_wrap($text, $length);
20+
}
21+
22+
/**
23+
* @param string $attribute
24+
* @return mixed
25+
*/
26+
public function getProtected($attribute) {
27+
$attribute = '_' . $attribute;
28+
return $this->$attribute;
29+
}
30+
31+
}

tests/TestCase/Mailer/EmailTest.php

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cake\Core\Configure;
66
use Cake\Core\Plugin;
77
use Cake\Log\Log;
8+
use TestApp\Mailer\TestEmail;
89
use Tools\Mailer\Email;
910
use Tools\TestSuite\TestCase;
1011

@@ -14,7 +15,7 @@
1415
class EmailTest extends TestCase {
1516

1617
/**
17-
* @var TestEmail
18+
* @var \TestApp\Mailer\TestEmail
1819
*/
1920
protected $Email;
2021

@@ -82,7 +83,7 @@ public function testFrom() {
8283
$this->assertSame($expected, $this->Email->from());
8384
$this->assertSame($this->Email, $result);
8485

85-
$this->expectException('InvalidArgumentException');
86+
$this->setExpectedException('InvalidArgumentException');
8687
$this->Email->from(['[email protected]' => 'CakePHP', '[email protected]' => 'From can only be one address']);
8788
}
8889

@@ -432,30 +433,3 @@ public function testWrapCustomized() {
432433
}
433434

434435
}
435-
436-
/**
437-
* Help to test Email
438-
*/
439-
class TestEmail extends Email {
440-
441-
/**
442-
* Wrap to protected method
443-
*
444-
* @param string $text
445-
* @param int $length
446-
* @return array
447-
*/
448-
public function wrap($text, $length = Email::LINE_LENGTH_MUST) {
449-
return parent::_wrap($text, $length);
450-
}
451-
452-
/**
453-
* @param string $attribute
454-
* @return mixed
455-
*/
456-
public function getProtected($attribute) {
457-
$attribute = '_' . $attribute;
458-
return $this->$attribute;
459-
}
460-
461-
}

0 commit comments

Comments
 (0)