Skip to content

Commit

Permalink
Add test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Jul 31, 2019
1 parent 10de9b3 commit c44713e
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage_clover: tests/Logs/clover.xml
json_path: tests/Logs/coveralls-upload.json
service_name: travis-ci
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
vendor/
composer.lock
composer.lock
*.cache
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"require": {
"ext-ssh2": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.0||^8.0",
"fzaninotto/faker": "^1.6",
"php-coveralls/php-coveralls": "^2.0",
"cache/array-adapter": "^1.0"
},
"autoload": {
"psr-4": {
"DivineOmega\\SSHConnection\\": "src/"
Expand Down
28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
<exclude>
<directory suffix=".php">src/Examples</directory>
</exclude>
</whitelist>
</filter>
<php>

</php>
</phpunit>
17 changes: 0 additions & 17 deletions src/test.php

This file was deleted.

25 changes: 25 additions & 0 deletions tests/Integration/SSHConnectionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use DivineOmega\SSHConnection\SSHConnection;
use PHPUnit\Framework\TestCase;

final class SSHConnectionTest extends TestCase
{
public function testSSHConnection()
{
$connection = (new SSHConnection())
->to('test.rebex.net')
->onPort(22)
->as('demo')
->withPassword('password')
->connect();

$command = $connection->run('echo "Hello world!"');

$this->assertEquals('Hello world!', $command->getOutput());
$this->assertEquals('Hello world!'."\n", $command->getRawOutput());

$this->assertEquals('', $command->getError());
$this->assertEquals('', $command->getRawError());
}
}

0 comments on commit c44713e

Please sign in to comment.