Skip to content

Commit 35a81f3

Browse files
authored
Merge pull request #25 from mikehaertl/fix-travis
Migrate tests to phpunit > 6 and remove PHP 5.3 and HHVM tests
2 parents 3601486 + e0324fa commit 35a81f3

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: php
2+
dist: trusty
23
php:
34
- "7.1"
45
- "7.0"
56
- "5.6"
67
- "5.5"
78
- "5.4"
8-
- "5.3"
9-
- "hhvm"
109
install:
10+
- composer self-update
1111
- composer install

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ php-shellcommand
55
[![Latest Stable Version](https://poser.pugx.org/mikehaertl/php-shellcommand/v/stable.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
66
[![Total Downloads](https://poser.pugx.org/mikehaertl/php-shellcommand/downloads)](https://packagist.org/packages/mikehaertl/php-shellcommand)
77
[![Latest Unstable Version](https://poser.pugx.org/mikehaertl/php-shellcommand/v/unstable.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
8-
[![HHVM Status](http://hhvm.h4cc.de/badge/mikehaertl/php-shellcommand.png)](http://hhvm.h4cc.de/package/mikehaertl/php-shellcommand)
98
[![License](https://poser.pugx.org/mikehaertl/php-shellcommand/license.svg)](https://packagist.org/packages/mikehaertl/php-shellcommand)
109

1110
php-shellcommand provides a simple object oriented interface to execute shell commands.

phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
processIsolation="false"
1010
stopOnFailure="false"
1111
syntaxCheck="false"
12-
bootstrap="vendor/autoload.php"
12+
bootstrap="./tests/bootstrap.php"
1313
>
1414
<testsuites>
1515
<testsuite name="PHP Shell Command Test Suite">

tests/CommandTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
use mikehaertl\shellcommand\Command;
33

4-
class CommandTest extends \PHPUnit_Framework_TestCase
4+
class CommandTest extends \PHPUnit\Framework\TestCase
55
{
66
public function setUp()
77
{
@@ -119,13 +119,13 @@ public function testCanRunCommandWithArguments()
119119
public function testCanRunValidCommand()
120120
{
121121
$dir = __DIR__;
122-
$command = new Command("/bin/ls $dir");
122+
$command = new Command("/bin/ls $dir/Command*");
123123

124124
$this->assertFalse($command->getExecuted());
125125
$this->assertTrue($command->execute());
126126
$this->assertTrue($command->getExecuted());
127-
$this->assertEquals("CommandTest.php", $command->getOutput());
128-
$this->assertEquals("CommandTest.php\n", $command->getOutput(false));
127+
$this->assertEquals("$dir/CommandTest.php", $command->getOutput());
128+
$this->assertEquals("$dir/CommandTest.php\n", $command->getOutput(false));
129129
$this->assertEmpty($command->getError());
130130
$this->assertEmpty($command->getStdErr());
131131
$this->assertEquals(0, $command->getExitCode());
@@ -170,13 +170,13 @@ public function testCanCastToString()
170170
public function testCanRunValidCommandWithExec()
171171
{
172172
$dir = __DIR__;
173-
$command = new Command("/bin/ls $dir");
173+
$command = new Command("/bin/ls $dir/Command*");
174174
$command->useExec = true;
175175

176176
$this->assertFalse($command->getExecuted());
177177
$this->assertTrue($command->execute());
178178
$this->assertTrue($command->getExecuted());
179-
$this->assertEquals("CommandTest.php", $command->getOutput());
179+
$this->assertEquals("$dir/CommandTest.php", $command->getOutput());
180180
$this->assertEmpty($command->getError());
181181
$this->assertEmpty($command->getStdErr());
182182
$this->assertEquals(0, $command->getExitCode());

tests/bootstrap.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
// Some travis environments use phpunit > 6
3+
$newClass = '\PHPUnit\Framework\TestCase';
4+
$oldClass = '\PHPUnit_Framework_TestCase';
5+
if (!class_exists($newClass) && class_exists($oldClass)) {
6+
class_alias($oldClass, $newClass);
7+
}
8+
9+
require __DIR__ . '/../vendor/autoload.php';
10+

0 commit comments

Comments
 (0)