Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.* export-ignore
/tests export-ignore
/phpunit.xml.dist export-ignore
/CHANGELOG.md
70 changes: 70 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test

on:
push:
pull_request:
types: [opened, synchronize, edited, reopened]

jobs:
test:
name: "PHP ${{ matrix.php-version }}${{ matrix.symfony-process-version != '' && format(' + symfony/process {0}', matrix.symfony-process-version) || '' }}"
runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
php-version:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
symfony-process-version: ['']
include:
- php-version: '7.0'
symfony-process-version: '2.0'
- php-version: '7.0'
symfony-process-version: '3.0'
- php-version: '7.2'
symfony-process-version: '5.0'
- php-version: '7.3'
symfony-process-version: '5.0'
- php-version: '7.4'
symfony-process-version: '5.0'
- php-version: '8.0'
symfony-process-version: '5.0'
- php-version: '8.0'
symfony-process-version: '6.0'
- php-version: '8.1'
symfony-process-version: '5.0'
- php-version: '8.1'
symfony-process-version: '6.0'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
ini-values: "memory_limit=-1"
php-version: ${{ matrix.php-version }}
tools: composer:v2

- name: Configure Symfony Process
if: ${{ matrix.symfony-process-version != '' }}
run: composer require --no-update "symfony/process:^${{ matrix.symfony-process-version }}"

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Install Simple PHPUnit
run: vendor/bin/simple-phpunit install

- name: Run PHPUnit
run: vendor/bin/simple-phpunit -v
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor/
composer.lock
/composer.lock
/.phpunit.result.cache
/.idea
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Binary-Driver is a set of PHP tools to build binary drivers.

[![Build Status](https://travis-ci.org/alchemy-fr/BinaryDriver.png?branch=master)](https://travis-ci.org/alchemy-fr/BinaryDriver)
[![Build Status](https://github.com/alchemy-fr/BinaryDriver/actions/workflows/test.yaml/badge.svg)](https://github.com/alchemy-fr/BinaryDriver/actions/workflows/test.yaml)

## Why ?

Expand Down
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@
}
],
"require": {
"php" : ">=5.5",
"evenement/evenement" : "^3.0|^2.0|^1.0",
"psr/log" : "^1.0",
"symfony/process" : "^2.3|^3.0|^4.0|^5.0"
"php": ">=5.5",
"evenement/evenement": "^1.0|^2.0|^3.0",
"psr/log": "^1.0|^2.0",
"symfony/process": "^2.3|^3.0|^4.0|^5.0|^6.0"
},
"require-dev": {
"phpunit/phpunit" : "^4.0|^5.0"
"symfony/phpunit-bridge": "^5.0"
},
"autoload": {
"psr-0": {
"Alchemy": "src"
}
},
"autoload-dev": {
"psr-4": {
"Alchemy\\Tests\\": "tests/Alchemy"
}
}
}
12 changes: 6 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="false"
bootstrap="tests/bootstrap.php"
>
<php>
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="true"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
<ini name="display_errors" value="on"/>
</php>

<testsuites>
<testsuite>
<testsuite name="unit">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory>vendor</directory>
<directory>tests</directory>
</blacklist>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

</phpunit>
Expand Down
9 changes: 5 additions & 4 deletions src/Alchemy/BinaryDriver/BinaryDriverTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

namespace Alchemy\BinaryDriver;

use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Process\Process;

/**
* Convenient PHPUnit methods for testing BinaryDriverInterface implementations.
*/
class BinaryDriverTestCase extends \PHPUnit_Framework_TestCase
class BinaryDriverTestCase extends TestCase
{
/**
* @return ProcessBuilderFactoryInterface
*/
public function createProcessBuilderFactoryMock()
{
return $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
return $this->createMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
}

/**
Expand Down Expand Up @@ -63,14 +64,14 @@ public function createProcessMock($runs = 1, $success = true, $commandLine = nul
*/
public function createLoggerMock()
{
return $this->getMock('Psr\Log\LoggerInterface');
return $this->createMock('Psr\Log\LoggerInterface');
}

/**
* @return ConfigurationInterface
*/
public function createConfigurationMock()
{
return $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
return $this->createMock('Alchemy\BinaryDriver\ConfigurationInterface');
}
}
5 changes: 5 additions & 0 deletions src/Alchemy/BinaryDriver/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function __construct(array $data = array())
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
Expand Down Expand Up @@ -76,6 +77,7 @@ public function all()
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return $this->has($offset);
Expand All @@ -84,6 +86,7 @@ public function offsetExists($offset)
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->get($offset);
Expand All @@ -92,6 +95,7 @@ public function offsetGet($offset)
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->set($offset, $value);
Expand All @@ -100,6 +104,7 @@ public function offsetSet($offset, $value)
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$this->remove($offset);
Expand Down
31 changes: 16 additions & 15 deletions tests/Alchemy/Tests/BinaryDriver/AbstractBinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Alchemy\BinaryDriver\Configuration;
use Alchemy\BinaryDriver\Exception\ExecutableNotFoundException;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Process\ExecutableFinder;

class AbstractBinaryTest extends BinaryDriverTestCase
Expand Down Expand Up @@ -61,21 +62,21 @@ public function testMultipleLoadWithBinaryName()

public function testLoadWithMultiplePathExpectingAFailure()
{
$this->setExpectedException(ExecutableNotFoundException::class);
$this->expectException(ExecutableNotFoundException::class);

Implementation::load(array('bachibouzouk', 'moribon'));
}

public function testLoadWithUniquePathExpectingAFailure()
{
$this->setExpectedException(ExecutableNotFoundException::class);
$this->expectException(ExecutableNotFoundException::class);

Implementation::load('bachibouzouk');
}

public function testLoadWithCustomLogger()
{
$logger = $this->getMock('Psr\Log\LoggerInterface');
$logger = $this->createMock('Psr\Log\LoggerInterface');
$imp = Implementation::load('php', $logger);

$this->assertEquals($logger, $imp->getProcessRunner()->getLogger());
Expand All @@ -91,7 +92,7 @@ public function testLoadWithCustomConfigurationAsArray()

public function testLoadWithCustomConfigurationAsObject()
{
$conf = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
$conf = $this->createMock('Alchemy\BinaryDriver\ConfigurationInterface');
$imp = Implementation::load('php', null, $conf);

$this->assertEquals($conf, $imp->getConfiguration());
Expand All @@ -100,7 +101,7 @@ public function testLoadWithCustomConfigurationAsObject()
public function testProcessBuilderFactoryGetterAndSetters()
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$factory = $this->createMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');

$imp->setProcessBuilderFactory($factory);
$this->assertEquals($factory, $imp->getProcessBuilderFactory());
Expand All @@ -109,7 +110,7 @@ public function testProcessBuilderFactoryGetterAndSetters()
public function testConfigurationGetterAndSetters()
{
$imp = Implementation::load('php');
$conf = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
$conf = $this->createMock('Alchemy\BinaryDriver\ConfigurationInterface');

$imp->setConfiguration($conf);
$this->assertEquals($conf, $imp->getConfiguration());
Expand All @@ -132,7 +133,7 @@ public function testTimeoutIsSetOnProcessBuilderSetting()
{
$imp = Implementation::load('php', null, array('timeout' => 42));

$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$factory = $this->createMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$factory->expects($this->once())
->method('setTimeout')
->with(42);
Expand All @@ -148,7 +149,7 @@ public function testListenRegistersAListener()
->disableOriginalConstructor()
->getMock();

$listener = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listener = $this->createMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');

$listeners->expects($this->once())
->method('register')
Expand All @@ -168,8 +169,8 @@ public function testListenRegistersAListener()
public function testCommandRunsAProcess($parameters, $bypassErrors, $expectedParameters, $output)
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->getMock('Alchemy\BinaryDriver\ProcessRunnerInterface');
$factory = $this->createMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->createMock('Alchemy\BinaryDriver\ProcessRunnerInterface');

$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
Expand Down Expand Up @@ -197,8 +198,8 @@ public function testCommandRunsAProcess($parameters, $bypassErrors, $expectedPar
public function testCommandWithTemporaryListeners($parameters, $bypassErrors, $expectedParameters, $output, $count, $listeners)
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->getMock('Alchemy\BinaryDriver\ProcessRunnerInterface');
$factory = $this->createMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->createMock('Alchemy\BinaryDriver\ProcessRunnerInterface');

$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
Expand Down Expand Up @@ -263,7 +264,7 @@ public function testUnlistenUnregistersAListener()
->disableOriginalConstructor()
->getMock();

$listener = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listener = $this->createMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');

$listeners->expects($this->once())
->method('unregister')
Expand All @@ -278,11 +279,11 @@ public function testUnlistenUnregistersAListener()
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject
* @return MockObject
*/
private function getMockListener()
{
$listener = $this->getMock(ListenerInterface::class);
$listener = $this->createMock(ListenerInterface::class);
$listener->expects($this->any())
->method('forwardedEvents')
->willReturn(array());
Expand Down
Loading