Skip to content

Commit

Permalink
Merge pull request #23 from aynsix/SILEX2
Browse files Browse the repository at this point in the history
FIX test phpunit
  • Loading branch information
jygaulier authored Apr 19, 2018
2 parents c8767a4 + d06bb36 commit f85de17
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 27 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ before_script:
- composer install --prefer-source

php:
- 5.5
- 5.6
- 7.0
- hhvm
- 7.1
- 7.2
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
}
],
"require": {
"php" : ">=5.5",
"php" : "~7.0",
"evenement/evenement" : "^2.0|^1.0",
"monolog/monolog" : "^1.3",
"psr/log" : "^1.0",
"symfony/process" : "^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit" : "^4.0"
"phpunit/phpunit" : "~6.0"
},
"autoload": {
"psr-0": {
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');
}
}
28 changes: 14 additions & 14 deletions tests/Alchemy/Tests/BinaryDriver/AbstractBinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,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 +91,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 +100,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 +109,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 +132,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 +148,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 +168,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 +197,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 +263,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 @@ -282,7 +282,7 @@ public function testUnlistenUnregistersAListener()
*/
private function getMockListener()
{
$listener = $this->getMock(ListenerInterface::class);
$listener = $this->createMock(ListenerInterface::class);
$listener->expects($this->any())
->method('forwardedEvents')
->willReturn(array());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Symfony\Component\Process\ExecutableFinder;
use Alchemy\BinaryDriver\ProcessBuilderFactory;
use PHPUnit\Framework\TestCase;

abstract class AbstractProcessBuilderFactoryTest extends \PHPUnit_Framework_TestCase
abstract class AbstractProcessBuilderFactoryTest extends TestCase
{
public static $phpBinary;

Expand Down
3 changes: 2 additions & 1 deletion tests/Alchemy/Tests/BinaryDriver/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Alchemy\Tests\BinaryDriver;

use Alchemy\BinaryDriver\Configuration;
use PHPUnit\Framework\TestCase;

class ConfigurationTest extends \PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
public function testArrayAccessImplementation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Alchemy\BinaryDriver\Listeners\DebugListener;
use Symfony\Component\Process\Process;
use PHPUnit\Framework\TestCase;

class DebugListenerTest extends \PHPUnit_Framework_TestCase
class DebugListenerTest extends TestCase
{
public function testHandle()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Alchemy/Tests/BinaryDriver/Listeners/ListenersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Alchemy\BinaryDriver\Listeners\Listeners;
use Evenement\EventEmitter;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use PHPUnit\Framework\TestCase;

class ListenersTest extends \PHPUnit_Framework_TestCase
class ListenersTest extends TestCase
{
public function testRegister()
{
Expand Down

0 comments on commit f85de17

Please sign in to comment.