DataSift\Storyplayer\CommandLib\SshClient::getSshKeyForUse PHP Method

getSshKeyForUse() public method

public getSshKeyForUse ( ) : string
return string
    public function getSshKeyForUse()
    {
        if (empty($this->sshKey)) {
            return '';
        }
        return "-i '" . $this->sshKey . "'";
    }

Usage Example

Esempio n. 1
0
 /**
  * @covers DataSift\Storyplayer\CommandLib\SshClient::getSshKeyForUse
  */
 public function testReturnsEmptyStringWhenNoSshKeySet()
 {
     // ----------------------------------------------------------------
     // setup your test
     // our $st object
     $i = new Injectables();
     $i->initOutputSupport();
     $i->initDataFormatterSupport();
     $i->initRuntimeConfigSupport($i);
     $st = new StoryTeller($i);
     // our test subject
     $obj = new SshClient($st);
     // what result do we expect?
     $expectedResult = "";
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = $obj->getSshKeyForUse();
     // ----------------------------------------------------------------
     // test the results
     $this->assertTrue(is_string($actualResult));
     $this->assertEquals($expectedResult, $actualResult);
 }