This repository was archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathFileOptionsTest.php
59 lines (51 loc) · 1.63 KB
/
FileOptionsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ZendTest\Mail\Transport;
use PHPUnit\Framework\TestCase;
use Zend\Mail\Transport\FileOptions;
/**
* @group Zend_Mail
* @covers Zend\Mail\Transport\FileOptions<extended>
*/
class FileOptionsTest extends TestCase
{
public function setUp()
{
$this->options = new FileOptions();
}
public function testPathIsSysTempDirByDefault()
{
$this->assertEquals(sys_get_temp_dir(), $this->options->getPath());
}
public function testDefaultCallbackIsSetByDefault()
{
$callback = $this->options->getCallback();
$this->assertInternalType('callable', $callback);
$test = $callback('');
$this->assertRegExp('#^ZendMail_\d+_\d+\.eml$#', $test);
}
public function testPathIsMutable()
{
$original = $this->options->getPath();
$this->options->setPath(__DIR__);
$test = $this->options->getPath();
$this->assertNotEquals($original, $test);
$this->assertEquals(__DIR__, $test);
}
public function testCallbackIsMutable()
{
$original = $this->options->getCallback();
$new = function ($transport) {
};
$this->options->setCallback($new);
$test = $this->options->getCallback();
$this->assertNotSame($original, $test);
$this->assertSame($new, $test);
}
}