Skip to content

Commit

Permalink
[Travis] Fix tests, move to newer version of phpunit (#30)
Browse files Browse the repository at this point in the history
Also:
* Add testing on PHP 7.2 and 7.3
* Fix usage of old TestCase class name
* Bump php-cs-fixer to 2.14 to be able to install on PHP 7.3
  • Loading branch information
andrerom authored Mar 1, 2019
1 parent ffbf989 commit 7294f07
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 42 deletions.
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
dist: xenial
sudo: required

language: php

cache:
directories:
- $HOME/.composer/cache/files

matrix:
fast_finish: true
include:
- php: 5.6
- php: 7.0
- php: 7.1
env: CHECK_CS=true
- php: 7.2
- php: 7.3

# test only master (+ Pull requests)
# test only on matching branches (+ Pull requests)
branches:
only:
- master
- /^\d.\d+$/

before_script:
# re-enable when / if coverage is disabled for faster test runs
#- phpenv config-rm xdebug.ini
- travis_retry composer selfupdate
# Avoid memory issues on composer install
- phpenv config-rm xdebug.ini
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Install packages
- travis_retry composer install --prefer-dist --no-interaction

script:
- php bin/phpunit --coverage-text
- if [ "$CHECK_CS" == "true" ]; then phpenv config-rm xdebug.ini && bin/php-cs-fixer fix -v --dry-run --diff --show-progress=estimating; fi
- php vendor/bin/phpunit
- if [ "$CHECK_CS" = "true" ]; then vendor/bin/php-cs-fixer fix -v --dry-run --diff --show-progress=estimating; fi

notifications:
email: false
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\SymfonyKernelSystemInfo;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\Kernel;

class ConfigurationSymfonyKernelSystemInfoCollectorTest extends PHPUnit_Framework_TestCase
class ConfigurationSymfonyKernelSystemInfoCollectorTest extends TestCase
{
/**
* @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\ConfigurationSymfonyKernelSystemInfoCollector::collect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\DatabaseSystemInfo;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class DoctrineDatabaseSystemInfoCollectorTest extends PHPUnit_Framework_TestCase
class DoctrineDatabaseSystemInfoCollectorTest extends TestCase
{
/**
* @var \Doctrine\DBAL\Connection|\PHPUnit_Framework_MockObject_MockObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcHardwareSystemInfoCollector;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\HardwareSystemInfo;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class EzcHardwareSystemInfoCollectorTest extends PHPUnit_Framework_TestCase
class EzcHardwareSystemInfoCollectorTest extends TestCase
{
/**
* @var \EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoWrapper|\PHPUnit_Framework_MockObject_MockObject
Expand Down
4 changes: 2 additions & 2 deletions Tests/SystemInfo/Collector/EzcPhpSystemInfoCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\EzcPhpSystemInfoCollector;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\PhpSystemInfo;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class EzcPhpSystemInfoCollectorTest extends PHPUnit_Framework_TestCase
class EzcPhpSystemInfoCollectorTest extends TestCase
{
/**
* @var \EzSystems\EzSupportToolsBundle\SystemInfo\EzcSystemInfoWrapper|\PHPUnit_Framework_MockObject_MockObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\ComposerPackage;
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\ComposerSystemInfo;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class JsonComposerLockSystemInfoCollectorTest extends PHPUnit_Framework_TestCase
class JsonComposerLockSystemInfoCollectorTest extends TestCase
{
/**
* @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\JsonComposerLockSystemInfoCollector::collect()
Expand Down
9 changes: 5 additions & 4 deletions Tests/SystemInfo/Registry/IdentifierBasedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
namespace EzSystems\EzSupportToolsBundle\Tests\SystemInfo\Registry;

use EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBased;
use PHPUnit\Framework\TestCase;

class IdentifierBasedTest extends \PHPUnit_Framework_TestCase
class IdentifierBasedTest extends TestCase
{
/**
* @var \EzSystems\EzSupportToolsBundle\SystemInfo\Registry\IdentifierBasedEzcPhpSystemInfoCollector
Expand All @@ -25,8 +26,8 @@ class IdentifierBasedTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->testItems = [
'foo' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
'bar' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
'foo' => $this->createMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
'bar' => $this->createMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
];

$this->registry = new IdentifierBased();
Expand Down Expand Up @@ -67,7 +68,7 @@ public function testReplaceItem()
$this->registry = new IdentifierBased($this->testItems);

$replaceItems = [
'foo' => $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
'foo' => $this->createMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector'),
];

$this->registry = new IdentifierBased($replaceItems);
Expand Down
4 changes: 2 additions & 2 deletions Tests/View/Matcher/SystemInfo/IdentitifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use EzSystems\EzSupportToolsBundle\SystemInfo\Value\HardwareSystemInfo;
use EzSystems\EzSupportToolsBundle\View\Matcher\SystemInfo\Identifier;
use EzSystems\EzSupportToolsBundle\View\SystemInfoView;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class IdentitifierTest extends PHPUnit_Framework_TestCase
class IdentitifierTest extends TestCase
{
public function testMatch()
{
Expand Down
12 changes: 7 additions & 5 deletions Tests/View/SystemInfoViewBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/
namespace EzSystems\EzSupportToolsBundle\Tests\View;

use EzSystems\EzSupportToolsBundle\SystemInfo\Value\SystemInfo;
use EzSystems\EzSupportToolsBundle\View\SystemInfoViewBuilder;
use PHPUnit\Framework\TestCase;

class SystemInfoViewBuilderTest extends \PHPUnit_Framework_TestCase
class SystemInfoViewBuilderTest extends TestCase
{
private $configuratorMock;

Expand All @@ -33,7 +35,7 @@ public function testBuildView()
$this->getRegistryMock()
);

$systemInfo = $this->getMock('SystemInfo');
$systemInfo = $this->createMock(SystemInfo::class);

$this->getRegistryMock()
->method('getItem')
Expand All @@ -55,7 +57,7 @@ public function testBuildView()
protected function getConfiguratorMock()
{
if (!isset($this->configuratorMock)) {
$this->configuratorMock = $this->getMock('eZ\Publish\Core\MVC\Symfony\View\Configurator');
$this->configuratorMock = $this->createMock('eZ\Publish\Core\MVC\Symfony\View\Configurator');
}

return $this->configuratorMock;
Expand All @@ -67,7 +69,7 @@ protected function getConfiguratorMock()
protected function getRegistryMock()
{
if (!isset($this->registryMock)) {
$this->registryMock = $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry');
$this->registryMock = $this->createMock('EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry');
}

return $this->registryMock;
Expand All @@ -79,7 +81,7 @@ protected function getRegistryMock()
protected function getCollectorMock()
{
if (!isset($this->collectorMock)) {
$this->collectorMock = $this->getMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector');
$this->collectorMock = $this->createMock('EzSystems\EzSupportToolsBundle\SystemInfo\Collector\SystemInfoCollector');
}

return $this->collectorMock;
Expand Down
2 changes: 1 addition & 1 deletion View/Matcher/SystemInfo/Identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function match(View $view)

private function toIdentifier($object)
{
$className = get_class($object);
$className = \get_class($object);
$className = substr($className, strrpos($className, '\\') + 1);
$className = str_replace('SystemInfo', '', $className);

Expand Down
27 changes: 12 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{
"name": "ezsystems/ez-support-tools",
"description": "Providing information about the system eZ Platform/Studio is running on",
"description": "Providing information about the system eZ Platform/Enterprise/Commerce is running on, and eZ install itself",
"license": "GPL-2.0",
"type": "ezplatform-bundle",
"authors": [
{
"name": "Gunnstein Lye",
"email": "gunnstein.lye@ez.no"
"name": "eZ Systems",
"email": "dev-team@ez.no"
}
],
"require": {
"ezsystems/ezpublish-kernel": "^6.2 || ^7.0",
"ocramius/proxy-manager": "~1.0|~2.0",
"symfony/proxy-manager-bridge": "*",
"zetacomponents/system-information": "^1.1"
"ezsystems/ezpublish-kernel": "~6.7.8 || ~6.13.4 || ^7.0",
"ocramius/proxy-manager": "~1.0 || ~2.0",
"symfony/proxy-manager-bridge": "^2.8.40 || ^3.4.11",
"zetacomponents/system-information": "^1.1.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.14.2",
"phpunit/phpunit": "^5.7.27 || ^6.5.14"
},
"autoload": {
"psr-4": {
Expand All @@ -25,14 +29,7 @@
"dev-master": "0.2.x-dev"
}
},
"config": {
"bin-dir": "bin"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.7.1",
"phpunit/phpunit": "^4.7"
},
"scripts": {
"fix-cs": "@php ./bin/php-cs-fixer fix -v --show-progress=estimating"
"fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating"
}
}

0 comments on commit 7294f07

Please sign in to comment.