From 619a4cbb82141990cca025154b72d4ac70cd8138 Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Thu, 5 Jan 2023 18:15:58 +0200 Subject: [PATCH 01/10] install Pest --- composer.json | 6 +++++- tests/Pest.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/Pest.php diff --git a/composer.json b/composer.json index b3b3329..389c372 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,16 @@ "symfony/process": "^4.4|^5.3|^6.0" }, "require-dev": { + "pestphp/pest": "^1.22", "phpunit/phpunit": "^9.5", "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^5.3|6.0" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true + } }, "autoload": { "psr-4": { diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 0000000..5949c61 --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1,45 @@ +in('Feature'); + +/* +|-------------------------------------------------------------------------- +| Expectations +|-------------------------------------------------------------------------- +| +| When you're writing tests, you often need to check that values meet certain conditions. The +| "expect()" function gives you access to a set of "expectations" methods that you can use +| to assert different things. Of course, you may extend the Expectation API at any time. +| +*/ + +expect()->extend('toBeOne', function () { + return $this->toBe(1); +}); + +/* +|-------------------------------------------------------------------------- +| Functions +|-------------------------------------------------------------------------- +| +| While Pest is very powerful out-of-the-box, you may have some testing code specific to your +| project that you don't want to repeat in every file. Here you can also expose helpers as +| global functions to help you to reduce the number of lines of code in your test files. +| +*/ + +function something() +{ + // .. +} From 70549fefd6b2b0b47e19f90e442d57c9a433bd8f Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Thu, 5 Jan 2023 18:23:52 +0200 Subject: [PATCH 02/10] refactor: SshTest --- composer.json | 1 + tests/Pest.php | 45 ---- tests/SshTest.php | 248 ++++++++---------- ...can_enable_password_authentication__1.txt} | 0 4 files changed, 106 insertions(+), 188 deletions(-) delete mode 100644 tests/Pest.php rename tests/__snapshots__/{SshTest__it_can_enable_password_authentication__1.txt => SshTest__it_it_can_enable_password_authentication__1.txt} (100%) diff --git a/composer.json b/composer.json index 389c372..b837d50 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "require-dev": { "pestphp/pest": "^1.22", "phpunit/phpunit": "^9.5", + "spatie/pest-plugin-snapshots": "^1.1", "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^5.3|6.0" }, diff --git a/tests/Pest.php b/tests/Pest.php deleted file mode 100644 index 5949c61..0000000 --- a/tests/Pest.php +++ /dev/null @@ -1,45 +0,0 @@ -in('Feature'); - -/* -|-------------------------------------------------------------------------- -| Expectations -|-------------------------------------------------------------------------- -| -| When you're writing tests, you often need to check that values meet certain conditions. The -| "expect()" function gives you access to a set of "expectations" methods that you can use -| to assert different things. Of course, you may extend the Expectation API at any time. -| -*/ - -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); - -/* -|-------------------------------------------------------------------------- -| Functions -|-------------------------------------------------------------------------- -| -| While Pest is very powerful out-of-the-box, you may have some testing code specific to your -| project that you don't want to repeat in every file. Here you can also expose helpers as -| global functions to help you to reduce the number of lines of code in your test files. -| -*/ - -function something() -{ - // .. -} diff --git a/tests/SshTest.php b/tests/SshTest.php index 974c355..37035ee 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -1,161 +1,123 @@ ssh = (new Ssh('user', 'example.com')); +}); + +it('can run a single command', function () { + $command = $this->ssh->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can run multiple commands', function () { + $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); + + assertMatchesSnapshot($command); +}); + +it('can use a specific private key', function () { + $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can set the port via the constructor', function () { + $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can set the port via the dedicated function', function () { + $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can set the multiplex path via the dedicated function', function () { + $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can instantiate via the create method') + ->expect(Ssh::create('user', 'example.com')) + ->toBeInstanceOf(Ssh::class); + +it('can enable strict host checking', function () { + $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can enable quiet mode', function () { + $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('can disable password authentication', function () { + $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +it('it can enable password authentication', function () { + $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); + + assertMatchesSnapshot($command); +}); + +test('zero is a valid port number', function () { + $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); - private Ssh $ssh; + assertMatchesSnapshot($command); +}); - public function setUp(): void - { - parent::setUp(); +it('throws an exception if a port is negative') + ->tap(fn () => (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami')) + ->throws(Exception::class, 'Port must be a positive integer.'); - $this->ssh = (new Ssh('user', 'example.com')); - } +it('can download a file', function () { + $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); - /** @test */ - public function it_can_run_a_single_command() - { - $command = $this->ssh->getExecuteCommand('whoami'); + assertMatchesSnapshot($command); +}); - $this->assertMatchesSnapshot($command); - } +it('can upload a file', function () { + $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); - /** @test */ - public function it_can_run_multiple_commands() - { - $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); + assertMatchesSnapshot($command); +}); - $this->assertMatchesSnapshot($command); - } +it('can configure the used process', function () { + $command = $this->ssh->configureProcess(function (Process $process) { + $process->setTimeout(0); + })->getExecuteCommand('whoami'); - /** @test */ - public function it_can_use_a_specific_private_key() - { - $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); + assertMatchesSnapshot($command); +}); - $this->assertMatchesSnapshot($command); - } +it('can run a command locally', function () { + $local = new Ssh('user', '127.0.0.1'); + $command = $local->execute('whoami'); - /** @test */ - public function it_can_set_the_port_via_the_constructor() - { - $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); + expect(get_current_user())->toEqual(trim($command->getOutput())); - $this->assertMatchesSnapshot($command); - } + assertMatchesSnapshot($command); +}); - /** @test */ - public function it_can_set_the_port_via_the_dedicated_function() - { - $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); +it('can configure the used process', function () { + $command = $this->ssh->configureProcess(function (Process $process) { + $process->setTimeout(0); + })->getExecuteCommand('whoami'); - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_set_the_multiplex_path_via_the_dedicated_function() - { - $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_instantiate_via_the_create_method() - { - $this->assertInstanceOf(Ssh::class, Ssh::create('user', 'example.com')); - } - - /** @test */ - public function it_can_enable_strict_host_checking() - { - $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_enable_quiet_mode() - { - $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_disable_password_authentication() - { - $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_enable_password_authentication() - { - $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function zero_is_a_valid_port_number() - { - $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_throws_an_exception_if_a_port_is_negative() - { - $this->expectException(Exception::class); - $this->expectExceptionMessage('Port must be a positive integer.'); - - $command = (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami'); - } - - /** @test */ - public function it_can_download_a_file() - { - $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_upload_a_file() - { - $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_configure_the_used_process() - { - $command = $this->ssh->configureProcess(function (Process $process) { - $process->setTimeout(0); - })->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_run_a_command_locally() - { - $local = new Ssh('user', '127.0.0.1'); - $command = $local->execute('whoami'); - - $this->assertEquals(trim($command->getOutput()), get_current_user()); - } -} + assertMatchesSnapshot($command); +}); diff --git a/tests/__snapshots__/SshTest__it_can_enable_password_authentication__1.txt b/tests/__snapshots__/SshTest__it_it_can_enable_password_authentication__1.txt similarity index 100% rename from tests/__snapshots__/SshTest__it_can_enable_password_authentication__1.txt rename to tests/__snapshots__/SshTest__it_it_can_enable_password_authentication__1.txt From 9ea36f1fd317413312df019dbdd4a07ff60e2856 Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Thu, 5 Jan 2023 18:24:29 +0200 Subject: [PATCH 03/10] feat: replace test suite in Github action and `composer.json` --- .github/workflows/run-tests.yml | 2 +- composer.json | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e86bfe2..114027e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -29,4 +29,4 @@ jobs: run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest - name: Execute tests - run: vendor/bin/phpunit + run: vendor/bin/pest diff --git a/composer.json b/composer.json index b837d50..be7dc49 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ }, "require-dev": { "pestphp/pest": "^1.22", - "phpunit/phpunit": "^9.5", "spatie/pest-plugin-snapshots": "^1.1", "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^5.3|6.0" @@ -43,7 +42,7 @@ } }, "scripts": { - "test": "vendor/bin/phpunit", - "test-coverage": "vendor/bin/phpunit --coverage-html coverage" + "test": "vendor/bin/pest", + "test-coverage": "vendor/bin/pest --coverage-html coverage" } -} +} \ No newline at end of file From 9cf4b7f3914a8b35ce9d23f44ca8fa578c1e2a41 Mon Sep 17 00:00:00 2001 From: alexmanase Date: Thu, 5 Jan 2023 16:25:06 +0000 Subject: [PATCH 04/10] Fix styling --- tests/SshTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/SshTest.php b/tests/SshTest.php index 37035ee..309e769 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -1,9 +1,9 @@ Date: Mon, 9 Jan 2023 12:06:51 +0200 Subject: [PATCH 05/10] wip --- tests/SshTest.php | 8 -------- .../SshTest__it_can_run_a_command_locally__1.yml | 2 ++ 2 files changed, 2 insertions(+), 8 deletions(-) create mode 100644 tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml diff --git a/tests/SshTest.php b/tests/SshTest.php index 309e769..3f5e6d4 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -97,14 +97,6 @@ assertMatchesSnapshot($command); }); -it('can configure the used process', function () { - $command = $this->ssh->configureProcess(function (Process $process) { - $process->setTimeout(0); - })->getExecuteCommand('whoami'); - - assertMatchesSnapshot($command); -}); - it('can run a command locally', function () { $local = new Ssh('user', '127.0.0.1'); $command = $local->execute('whoami'); diff --git a/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml b/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml new file mode 100644 index 0000000..9cc21d3 --- /dev/null +++ b/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml @@ -0,0 +1,2 @@ +out: | + alexandrumanase From 9859d8a7c739e09b65fea10df7dde966261dff47 Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Thu, 5 Jan 2023 18:15:58 +0200 Subject: [PATCH 06/10] feat: install Pest --- composer.json | 7 +++++++ tests/Pest.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/Pest.php diff --git a/composer.json b/composer.json index be7dc49..b0df055 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,15 @@ "symfony/process": "^4.4|^5.3|^6.0" }, "require-dev": { +<<<<<<< HEAD "pestphp/pest": "^1.22", "spatie/pest-plugin-snapshots": "^1.1", +||||||| parent of 970df70 (install Pest) + "phpunit/phpunit": "^9.5", +======= + "pestphp/pest": "^1.22", + "phpunit/phpunit": "^9.5", +>>>>>>> 970df70 (install Pest) "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^5.3|6.0" }, diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 0000000..5949c61 --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1,45 @@ +in('Feature'); + +/* +|-------------------------------------------------------------------------- +| Expectations +|-------------------------------------------------------------------------- +| +| When you're writing tests, you often need to check that values meet certain conditions. The +| "expect()" function gives you access to a set of "expectations" methods that you can use +| to assert different things. Of course, you may extend the Expectation API at any time. +| +*/ + +expect()->extend('toBeOne', function () { + return $this->toBe(1); +}); + +/* +|-------------------------------------------------------------------------- +| Functions +|-------------------------------------------------------------------------- +| +| While Pest is very powerful out-of-the-box, you may have some testing code specific to your +| project that you don't want to repeat in every file. Here you can also expose helpers as +| global functions to help you to reduce the number of lines of code in your test files. +| +*/ + +function something() +{ + // .. +} From f0eea2eb080895e1bef04c6d888d26e6bb2c825f Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Thu, 5 Jan 2023 18:23:52 +0200 Subject: [PATCH 07/10] refactor: SshTest --- composer.json | 8 -- tests/Pest.php | 45 ------- tests/SshTest.php | 320 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 320 insertions(+), 53 deletions(-) delete mode 100644 tests/Pest.php diff --git a/composer.json b/composer.json index b0df055..9091f04 100644 --- a/composer.json +++ b/composer.json @@ -20,16 +20,8 @@ "symfony/process": "^4.4|^5.3|^6.0" }, "require-dev": { -<<<<<<< HEAD "pestphp/pest": "^1.22", "spatie/pest-plugin-snapshots": "^1.1", -||||||| parent of 970df70 (install Pest) - "phpunit/phpunit": "^9.5", -======= - "pestphp/pest": "^1.22", - "phpunit/phpunit": "^9.5", ->>>>>>> 970df70 (install Pest) - "spatie/phpunit-snapshot-assertions": "^4.2", "symfony/var-dumper": "^5.3|6.0" }, "config": { diff --git a/tests/Pest.php b/tests/Pest.php deleted file mode 100644 index 5949c61..0000000 --- a/tests/Pest.php +++ /dev/null @@ -1,45 +0,0 @@ -in('Feature'); - -/* -|-------------------------------------------------------------------------- -| Expectations -|-------------------------------------------------------------------------- -| -| When you're writing tests, you often need to check that values meet certain conditions. The -| "expect()" function gives you access to a set of "expectations" methods that you can use -| to assert different things. Of course, you may extend the Expectation API at any time. -| -*/ - -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); - -/* -|-------------------------------------------------------------------------- -| Functions -|-------------------------------------------------------------------------- -| -| While Pest is very powerful out-of-the-box, you may have some testing code specific to your -| project that you don't want to repeat in every file. Here you can also expose helpers as -| global functions to help you to reduce the number of lines of code in your test files. -| -*/ - -function something() -{ - // .. -} diff --git a/tests/SshTest.php b/tests/SshTest.php index 3f5e6d4..9aeef51 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -1,108 +1,410 @@ >>>>>> e7a6919 (refactor: SshTest) use Spatie\Ssh\Ssh; use Symfony\Component\Process\Process; +<<<<<<< HEAD uses(PHPUnit\Framework\TestCase::class); +||||||| parent of e7a6919 (refactor: SshTest) +class SshTest extends TestCase +{ + use MatchesSnapshots; +======= +use function Spatie\Snapshots\assertMatchesSnapshot; +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD beforeEach(function () { $this->ssh = (new Ssh('user', 'example.com')); }); +||||||| parent of e7a6919 (refactor: SshTest) + private Ssh $ssh; +======= +uses(PHPUnit\Framework\TestCase::class); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can run a single command', function () { $command = $this->ssh->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + public function setUp(): void + { + parent::setUp(); +======= +beforeEach(function () { + $this->ssh = (new Ssh('user', 'example.com')); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->ssh = (new Ssh('user', 'example.com')); + } +======= +it('can run a single command', function () { + $command = $this->ssh->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can run multiple commands', function () { $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_run_a_single_command() + { + $command = $this->ssh->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can run multiple commands', function () { + $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can use a specific private key', function () { $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_run_multiple_commands() + { + $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can use a specific private key', function () { + $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can set the port via the constructor', function () { $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_use_a_specific_private_key() + { + $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can set the port via the constructor', function () { + $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can set the port via the dedicated function', function () { $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_set_the_port_via_the_constructor() + { + $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can set the port via the dedicated function', function () { + $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can set the multiplex path via the dedicated function', function () { $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_set_the_port_via_the_dedicated_function() + { + $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can set the multiplex path via the dedicated function', function () { + $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can instantiate via the create method') ->expect(Ssh::create('user', 'example.com')) ->toBeInstanceOf(Ssh::class); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_set_the_multiplex_path_via_the_dedicated_function() + { + $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can enable strict host checking', function () { $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can instantiate via the create method') + ->expect(Ssh::create('user', 'example.com')) + ->toBeInstanceOf(Ssh::class); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_instantiate_via_the_create_method() + { + $this->assertInstanceOf(Ssh::class, Ssh::create('user', 'example.com')); + } +======= +it('can enable strict host checking', function () { + $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can enable quiet mode', function () { $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_enable_strict_host_checking() + { + $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can enable quiet mode', function () { + $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can disable password authentication', function () { $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_enable_quiet_mode() + { + $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('can disable password authentication', function () { + $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('it can enable password authentication', function () { $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_disable_password_authentication() + { + $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('it can enable password authentication', function () { + $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD test('zero is a valid port number', function () { $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_enable_password_authentication() + { + $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +test('zero is a valid port number', function () { + $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('throws an exception if a port is negative') ->tap(fn () => (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami')) ->throws(Exception::class, 'Port must be a positive integer.'); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function zero_is_a_valid_port_number() + { + $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can download a file', function () { $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= +it('throws an exception if a port is negative') + ->tap(fn () => (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami')) + ->throws(Exception::class, 'Port must be a positive integer.'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_throws_an_exception_if_a_port_is_negative() + { + $this->expectException(Exception::class); + $this->expectExceptionMessage('Port must be a positive integer.'); +======= +it('can download a file', function () { + $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can upload a file', function () { $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); +||||||| parent of e7a6919 (refactor: SshTest) + $command = (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami'); + } +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_download_a_file() + { + $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); +======= +it('can upload a file', function () { + $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD it('can run a command locally', function () { $local = new Ssh('user', '127.0.0.1'); $command = $local->execute('whoami'); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD expect(get_current_user())->toEqual(trim($command->getOutput())); +||||||| parent of e7a6919 (refactor: SshTest) + /** @test */ + public function it_can_upload_a_file() + { + $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); +======= +it('can configure the used process', function () { + $command = $this->ssh->configureProcess(function (Process $process) { + $process->setTimeout(0); + })->getExecuteCommand('whoami'); +>>>>>>> e7a6919 (refactor: SshTest) +<<<<<<< HEAD assertMatchesSnapshot($command); }); @@ -113,3 +415,21 @@ assertMatchesSnapshot($command); }); +||||||| parent of e7a6919 (refactor: SshTest) + $this->assertMatchesSnapshot($command); + } + + /** @test */ + public function it_can_configure_the_used_process() + { + $command = $this->ssh->configureProcess(function (Process $process) { + $process->setTimeout(0); + })->getExecuteCommand('whoami'); + + $this->assertMatchesSnapshot($command); + } +} +======= + assertMatchesSnapshot($command); +}); +>>>>>>> e7a6919 (refactor: SshTest) From dd07c217975abc64e2ac74fa8f23360470e28003 Mon Sep 17 00:00:00 2001 From: alexmanase Date: Thu, 5 Jan 2023 16:25:06 +0000 Subject: [PATCH 08/10] Fix styling --- tests/SshTest.php | 320 ---------------------------------------------- 1 file changed, 320 deletions(-) diff --git a/tests/SshTest.php b/tests/SshTest.php index 9aeef51..3f5e6d4 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -1,410 +1,108 @@ >>>>>> e7a6919 (refactor: SshTest) use Spatie\Ssh\Ssh; use Symfony\Component\Process\Process; -<<<<<<< HEAD uses(PHPUnit\Framework\TestCase::class); -||||||| parent of e7a6919 (refactor: SshTest) -class SshTest extends TestCase -{ - use MatchesSnapshots; -======= -use function Spatie\Snapshots\assertMatchesSnapshot; ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD beforeEach(function () { $this->ssh = (new Ssh('user', 'example.com')); }); -||||||| parent of e7a6919 (refactor: SshTest) - private Ssh $ssh; -======= -uses(PHPUnit\Framework\TestCase::class); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can run a single command', function () { $command = $this->ssh->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - public function setUp(): void - { - parent::setUp(); -======= -beforeEach(function () { - $this->ssh = (new Ssh('user', 'example.com')); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->ssh = (new Ssh('user', 'example.com')); - } -======= -it('can run a single command', function () { - $command = $this->ssh->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can run multiple commands', function () { $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_run_a_single_command() - { - $command = $this->ssh->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can run multiple commands', function () { - $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can use a specific private key', function () { $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_run_multiple_commands() - { - $command = $this->ssh->getExecuteCommand(['whoami', 'cd /var/log']); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can use a specific private key', function () { - $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can set the port via the constructor', function () { $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_use_a_specific_private_key() - { - $command = $this->ssh->usePrivateKey('/home/user/.ssh/id_rsa')->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can set the port via the constructor', function () { - $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can set the port via the dedicated function', function () { $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_set_the_port_via_the_constructor() - { - $command = (new Ssh('user', 'example.com', 123))->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can set the port via the dedicated function', function () { - $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can set the multiplex path via the dedicated function', function () { $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_set_the_port_via_the_dedicated_function() - { - $command = (new Ssh('user', 'example.com'))->usePort(123)->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can set the multiplex path via the dedicated function', function () { - $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can instantiate via the create method') ->expect(Ssh::create('user', 'example.com')) ->toBeInstanceOf(Ssh::class); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_set_the_multiplex_path_via_the_dedicated_function() - { - $command = (new Ssh('user', 'example.com'))->useMultiplexing('/home/test/control_masters/%C', '15m')->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can enable strict host checking', function () { $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can instantiate via the create method') - ->expect(Ssh::create('user', 'example.com')) - ->toBeInstanceOf(Ssh::class); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_instantiate_via_the_create_method() - { - $this->assertInstanceOf(Ssh::class, Ssh::create('user', 'example.com')); - } -======= -it('can enable strict host checking', function () { - $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can enable quiet mode', function () { $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_enable_strict_host_checking() - { - $command = (new Ssh('user', 'example.com'))->enableStrictHostKeyChecking()->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can enable quiet mode', function () { - $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can disable password authentication', function () { $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_enable_quiet_mode() - { - $command = (new Ssh('user', 'example.com'))->enableQuietMode()->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('can disable password authentication', function () { - $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('it can enable password authentication', function () { $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_disable_password_authentication() - { - $command = (new Ssh('user', 'example.com'))->disablePasswordAuthentication()->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('it can enable password authentication', function () { - $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD test('zero is a valid port number', function () { $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_enable_password_authentication() - { - $command = (new Ssh('user', 'example.com'))->enablePasswordAuthentication()->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -test('zero is a valid port number', function () { - $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('throws an exception if a port is negative') ->tap(fn () => (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami')) ->throws(Exception::class, 'Port must be a positive integer.'); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function zero_is_a_valid_port_number() - { - $command = (new Ssh('user', 'example.com'))->usePort(0)->getExecuteCommand('whoami'); -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can download a file', function () { $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= -it('throws an exception if a port is negative') - ->tap(fn () => (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami')) - ->throws(Exception::class, 'Port must be a positive integer.'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_throws_an_exception_if_a_port_is_negative() - { - $this->expectException(Exception::class); - $this->expectExceptionMessage('Port must be a positive integer.'); -======= -it('can download a file', function () { - $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can upload a file', function () { $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); -||||||| parent of e7a6919 (refactor: SshTest) - $command = (new Ssh('user', 'example.com'))->usePort(-45)->getExecuteCommand('whoami'); - } -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_download_a_file() - { - $command = $this->ssh->getDownloadCommand('spatie.be/current/.env', '.env'); -======= -it('can upload a file', function () { - $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD it('can run a command locally', function () { $local = new Ssh('user', '127.0.0.1'); $command = $local->execute('whoami'); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD expect(get_current_user())->toEqual(trim($command->getOutput())); -||||||| parent of e7a6919 (refactor: SshTest) - /** @test */ - public function it_can_upload_a_file() - { - $command = $this->ssh->getUploadCommand('.env', 'spatie.be/current/.env'); -======= -it('can configure the used process', function () { - $command = $this->ssh->configureProcess(function (Process $process) { - $process->setTimeout(0); - })->getExecuteCommand('whoami'); ->>>>>>> e7a6919 (refactor: SshTest) -<<<<<<< HEAD assertMatchesSnapshot($command); }); @@ -415,21 +113,3 @@ public function it_can_upload_a_file() assertMatchesSnapshot($command); }); -||||||| parent of e7a6919 (refactor: SshTest) - $this->assertMatchesSnapshot($command); - } - - /** @test */ - public function it_can_configure_the_used_process() - { - $command = $this->ssh->configureProcess(function (Process $process) { - $process->setTimeout(0); - })->getExecuteCommand('whoami'); - - $this->assertMatchesSnapshot($command); - } -} -======= - assertMatchesSnapshot($command); -}); ->>>>>>> e7a6919 (refactor: SshTest) From 82156bf219afd46200b6ab5d71b5b8a1fd1c1a9b Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Mon, 9 Jan 2023 13:24:21 +0200 Subject: [PATCH 09/10] fix(ssh locally): failing test --- tests/SshTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/SshTest.php b/tests/SshTest.php index 3f5e6d4..bf1a8d4 100644 --- a/tests/SshTest.php +++ b/tests/SshTest.php @@ -102,8 +102,6 @@ $command = $local->execute('whoami'); expect(get_current_user())->toEqual(trim($command->getOutput())); - - assertMatchesSnapshot($command); }); it('can configure the used process', function () { From 35dfc1df6cab6e530cb62ac3fb92b2977aa66368 Mon Sep 17 00:00:00 2001 From: Alex Manase Date: Mon, 9 Jan 2023 14:31:24 +0200 Subject: [PATCH 10/10] chore: cleanup --- .../__snapshots__/SshTest__it_can_run_a_command_locally__1.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml diff --git a/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml b/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml deleted file mode 100644 index 9cc21d3..0000000 --- a/tests/__snapshots__/SshTest__it_can_run_a_command_locally__1.yml +++ /dev/null @@ -1,2 +0,0 @@ -out: | - alexandrumanase