| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 | 
							- <?php
 
- namespace spec\Gaufrette\Adapter;
 
- //hack - mock php built-in functions
 
- require_once 'functions.php';
 
- use PhpSpec\ObjectBehavior;
 
- class SftpSpec extends ObjectBehavior
 
- {
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function let($sftp)
 
-     {
 
-         $this->beConstructedWith($sftp, '/home/l3l0');
 
-     }
 
-     function it_is_adapter()
 
-     {
 
-         $this->shouldHaveType('Gaufrette\Adapter');
 
-     }
 
-     function it_is_checksum_calculator()
 
-     {
 
-         $this->shouldHaveType('Gaufrette\Adapter\ChecksumCalculator');
 
-     }
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function it_fetches_keys($sftp)
 
-     {
 
-         $sftp
 
-             ->getUrl('/home/l3l0')
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0')
 
-         ;
 
-         $sftp
 
-             ->listDirectory('/home/l3l0', true)
 
-             ->willReturn(array('files' => array('/home/l3l0/filename', '/home/l3l0/filename1', '/home/l3l0/aaa/filename')))
 
-         ;
 
-         $this->keys()->shouldReturn(array('aaa', 'aaa/filename', 'filename', 'filename1'));
 
-     }
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function it_reads_file($sftp)
 
-     {
 
-         $sftp
 
-             ->getUrl('/home/l3l0')
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0')
 
-         ;
 
-         $sftp
 
-             ->read('/home/l3l0/filename')
 
-             ->shouldBeCalled()
 
-             ->willReturn('some content')
 
-         ;
 
-         $this->read('filename')->shouldReturn('some content');
 
-     }
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function it_writes_file($sftp)
 
-     {
 
-         $sftp
 
-             ->getUrl('/home/l3l0')
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0')
 
-         ;
 
-         $sftp
 
-             ->write('/home/l3l0/filename', 'some content')
 
-             ->shouldBeCalled()
 
-             ->willReturn(12)
 
-         ;
 
-         $this->write('filename', 'some content')->shouldReturn(12);
 
-     }
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function it_renames_file($sftp)
 
-     {
 
-         $sftp
 
-             ->getUrl('/home/l3l0')
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0')
 
-         ;
 
-         $sftp
 
-             ->rename('/home/l3l0/filename', '/home/l3l0/filename1')
 
-             ->shouldBeCalled()
 
-             ->willReturn(true)
 
-         ;
 
-         $this->rename('filename', 'filename1')->shouldReturn(true);
 
-     }
 
-     /**
 
-      * @param \Ssh\Sftp $sftp
 
-      */
 
-     function it_checks_if_file_exists($sftp)
 
-     {
 
-         $sftp
 
-             ->getUrl('/home/l3l0')
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0')
 
-         ;
 
-         $sftp
 
-             ->getUrl('/home/l3l0/filename')
 
-             ->shouldBeCalled()
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0/filename')
 
-         ;
 
-         $sftp
 
-             ->getUrl('/home/l3l0/filename1')
 
-             ->shouldBeCalled()
 
-             ->willReturn('ssh+ssl://localhost/home/l3l0/filename1')
 
-         ;
 
-         $this->exists('filename')->shouldReturn(true);
 
-         $this->exists('filename1')->shouldReturn(false);
 
-     }
 
- }
 
 
  |