Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded required PHPUnit to 5.7 (for php 5) and 6 (for php 7) #82

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ language: php
php:
- 5.5
- 5.6
- 7.1
- hhvm

before_script:
- composer install

script: phpunit --coverage-text
script: ./vendor/bin/phpunit --coverage-text

notifications:
email:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},

"require-dev" : {
"phpunit/phpunit" : "~3.7"
"phpunit/phpunit" : "^4.8.35 || ^5.7 || ^6.0"
},

"suggest" : {
Expand Down
33 changes: 27 additions & 6 deletions tests/Cilex/Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@

use Cilex\Application;
use Cilex\Command\GreetCommand;
use PHPUnit\Framework\TestCase;

/**
* Application test cases.
*
* @author Mike van Riel <mike.vanriel@naenius.com>
*/
class ApplicationTest extends \PHPUnit_Framework_TestCase
class ApplicationTest extends TestCase
{
const NAME = 'Test';
const VERSION = '1.0.1';

/** @var Application */
private $app;

/**
* Sets up the test app.
*/
Expand All @@ -46,10 +50,10 @@ public function testConstruct()

public function testCustomInputOutput()
{
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
$input = $this->createMock('Symfony\Component\Console\Input\InputInterface');
$output = $this->createMock('Symfony\Component\Console\Output\OutputInterface');

$this->app['console'] = $this->getMock('Symfony\Component\Console\Application');
$this->app['console'] = $this->createMock('Symfony\Component\Console\Application');
$this->app['console']->expects($this->once())->method('run')->with($input, $output);


Expand All @@ -68,8 +72,8 @@ public function testClosureCommand()
$this->assertTrue($this->app['console']->has('closure-command'));

$command->run(
$this->getMock('Symfony\Component\Console\Input\InputInterface'),
$this->getMock('Symfony\Component\Console\Output\OutputInterface')
$this->createMock('Symfony\Component\Console\Input\InputInterface'),
$this->createMock('Symfony\Component\Console\Output\OutputInterface')
);

$this->assertTrue($invoked);
Expand All @@ -90,4 +94,21 @@ public function testCommand()
$this->assertSame($this->app, $this->app['console']->get('demo:greet')->getContainer());
}

/**
* Returns a test double for the specified class.
*
* This method ensures compatibility with PHPUnit 4 and can be removed as soon as PHPUnit 4 is not used anymore.
*
* @param string $originalClassName
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function createMock($originalClassName)
{
return $this->getMockBuilder($originalClassName)
->disableOriginalConstructor()
->disableOriginalClone()
->disableArgumentCloning()
->getMock();
}
}
9 changes: 5 additions & 4 deletions tests/Cilex/Tests/Command/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@

namespace Cilex\Tests\Command;

use Cilex\Command;
use Cilex\Application;
use Cilex\Provider\Console\Command;
use PHPUnit\Framework\TestCase;

class CommandMock extends \Cilex\Provider\Console\Command {}
class CommandMock extends Command {}

/**
* Command\Command test cases.
*
* @author Mike van Riel <mike.vanriel@naenius.com>
*/
class CommandTest extends \PHPUnit_Framework_TestCase
class CommandTest extends TestCase
{
/** @var \Cilex\Command\Command */
/** @var Command */
protected $fixture = null;

/**
Expand Down