MailTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpMailVfs() 0 5 1
A getMailDir() 0 4 1
A unregisterMailVfs() 0 4 1
1
<?php
2
/**
3
 * Webino (http://webino.sk/)
4
 *
5
 * @link        https://github.com/webino/WebinoDev/ for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2017 Webino, s. r. o. (http://webino.sk/)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDev\Test\Functional;
11
12
use org\bovigo\vfs\vfsStream;
13
use WebinoDev\Test\MailTrait as BaseMailTrait;
14
use WebinoDev\Vfs\StreamWrapper;
15
16
/**
17
 * Trait for mail functional testing
18
 *
19
 * Use this trait when you want mail testing.
20
 */
21
trait MailTrait
22
{
23
    use BaseMailTrait;
24
25
    /**
26
     * Setup virtual filesystem
27
     */
28
    public function setUpMailVfs()
29
    {
30
        StreamWrapper::register();
31
        StreamWrapper::setRoot(vfsStream::setup('root', null, ['tmp' => ['mail' => []]]));
32
    }
33
34
    /**
35
     * Returns URL to the virtual filesystem mail directory
36
     *
37
     * @return string
38
     */
39
    public function getMailDir()
40
    {
41
        return vfsStream::url('root/tmp/mail');
42
    }
43
44
    /**
45
     * Destroy virtual filesystem
46
     */
47
    public function unregisterMailVfs()
48
    {
49
        StreamWrapper::unregister();
50
    }
51
}
52