gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

SubsystemTest.php (1366B)


      1 <?php
      2 
      3 namespace Ssh;
      4 
      5 /**
      6  * @covers \Ssh\Subsystem
      7  */
      8 class SubsystemTest extends \PHPUnit_Framework_TestCase
      9 {
     10     public function testSessionResourceIsNotUsedOnCreation()
     11     {
     12         $session = $this->getMock(
     13             'Ssh\Session', array(), array(), '', false
     14         );
     15 
     16         $session->expects($this->never())->method('getResource');
     17 
     18         $subsystem = $this->getMockForAbstractClass(
     19             'Ssh\Subsystem', array($session)
     20         );
     21     }
     22 
     23     /**
     24      * @expectedException \InvalidArgumentException
     25      * @expectedExceptionMessage The session must be either a Session instance or a SSH session resource.
     26      */
     27     public function testInvalidContructorArgumentException()
     28     {
     29         new Exec(false);
     30     }
     31 
     32     public function testGetSessionResourceWillReturnResource()
     33     {
     34         $resource = tmpfile();
     35         $exec = new Exec($resource);
     36 
     37         $this->assertEquals($resource, $exec->getSessionResource());
     38     }
     39 
     40     public function testGetSessionResourceWillCallSessionGetResource()
     41     {
     42         $session = $this->getMock(
     43             'Ssh\Session', array('getResource'), array(), '', false
     44         );
     45         $session->expects($this->once())->method('getResource')->will($this->returnValue('aResource'));
     46 
     47         $exec = new Exec($session);
     48 
     49         $this->assertEquals('aResource', $exec->getSessionResource());
     50     }
     51 }