Completed
Push — develop ( 4002e6...6c7b5f )
by Novikov
01:33
created

SFTPTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 38
rs 10
c 2
b 0
f 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConnect() 0 4 1
A testGetRemoteFilesList() 0 4 1
A setUp() 0 8 1
1
<?php
2
3
namespace SF2Helpers\SFTPBundle\Tests\SFTP;
4
5
use SF2Helpers\SFTPBundle\SFTP\SFTP;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
8
class SFTPTest extends WebTestCase
9
{
10
    // test credentials took from here - http://www.sftp.net/public-online-sftp-servers
11
    private $hostname = 'demo.wftpserver.com:2222';
12
    private $login    = 'demo-user';
13
    private $password = 'demo-user';
14
15
    /** @var SFTP $sftpService */
16
    private $sftpService;
17
18
    /**
19
     * Test connect()
20
     */
21
    public function testConnect()
22
    {
23
        $this->sftpService->connect($this->hostname, $this->login, $this->password);
24
    }
25
26
    /**
27
     * Test connect()
28
     */
29
    public function testGetRemoteFilesList()
30
    {
31
        $this->sftpService->connect($this->hostname, $this->login, $this->password);
32
    }
33
34
    /**
35
     * Set up fixtures for testing
36
     */
37
    public function setUp()
38
    {
39
        require_once __DIR__.'/../AppKernel.php';
40
        $kernel = new \AppKernel('test', true);
41
        $kernel->boot();
42
        $container         = $kernel->getContainer();
43
        $this->sftpService = $container->get('sf2h.sftp');
44
    }
45
}
46