/** * @covers DataSift\Storyplayer\CommandLib\SshClient::getSshUsername * @covers DataSift\Storyplayer\CommandLib\SshClient::hasSshUsername * @covers DataSift\Storyplayer\CommandLib\SshClient::setSshUsername */ public function testCanGetAndSetSshUsername() { // ---------------------------------------------------------------- // 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 username will we use? $expectedResult = 'freddybloggs'; // make sure that (if there is ever a default username), it isn't // the string we're testing with $this->assertNotEquals($expectedResult, $obj->getSshUsername()); // and, make sure we start with no username $this->assertFalse($obj->hasSshUsername()); // ---------------------------------------------------------------- // perform the change $obj->setSshUsername($expectedResult); $actualResult = $obj->getSshUsername(); // ---------------------------------------------------------------- // test the results $this->assertTrue(is_string($actualResult)); $this->assertEquals($expectedResult, $actualResult); $this->assertTrue($obj->hasSshUsername()); }