AwsInspector\Tests\Ssh\CommandTest::runLocalCommandasUser PHP Method

runLocalCommandasUser() public method

    public function runLocalCommandasUser()
    {
        try {
            $testfile = tempnam(sys_get_temp_dir(), __FUNCTION__);
            $command = new Command(new LocalConnection(), 'whoami > ' . $testfile, 'root');
            $command->exec();
            $this->assertEquals('root', trim(file_get_contents($testfile)));
            unlink($testfile);
        } catch (\Exception $e) {
            $this->markTestSkipped('It is ok if this test fails');
        }
    }