1
0
Fork 0

Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase

pull/6783/head
Gabriel Caruso 2017-11-04 12:52:13 -02:00
parent f569833f5a
commit afc9a7643e
42 changed files with 84 additions and 43 deletions

View File

@ -37,7 +37,7 @@
"psr/log": "^1.0" "psr/log": "^1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.5 || ^5.0.5", "phpunit/phpunit": "^4.8.35 || ^5.7",
"phpunit/phpunit-mock-objects": "^2.3 || ^3.0" "phpunit/phpunit-mock-objects": "^2.3 || ^3.0"
}, },
"config": { "config": {

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "88357fd4222a8102552a0d3345696e2e", "content-hash": "d3c8dbadf8d41e2c7933e274b2fe1327",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Autoload; namespace Composer\Test\Autoload;
use Composer\Autoload\ClassLoader; use Composer\Autoload\ClassLoader;
use PHPUnit\Framework\TestCase;
/** /**
* Tests the Composer\Autoload\ClassLoader class. * Tests the Composer\Autoload\ClassLoader class.
*/ */
class ClassLoaderTest extends \PHPUnit_Framework_TestCase class ClassLoaderTest extends TestCase
{ {
/** /**
* Tests regular PSR-0 and PSR-4 class loading. * Tests regular PSR-0 and PSR-4 class loading.

View File

@ -13,8 +13,9 @@
namespace Composer\Test; namespace Composer\Test;
use Composer\Config; use Composer\Config;
use PHPUnit\Framework\TestCase;
class ConfigTest extends \PHPUnit_Framework_TestCase class ConfigTest extends TestCase
{ {
/** /**
* @dataProvider dataAddPackagistRepository * @dataProvider dataAddPackagistRepository

View File

@ -10,12 +10,13 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer; namespace Composer\Test\Console;
use Composer\Console\HtmlOutputFormatter; use Composer\Console\HtmlOutputFormatter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class HtmlOutputFormatterTest extends \PHPUnit_Framework_TestCase class HtmlOutputFormatterTest extends TestCase
{ {
public function testFormatting() public function testFormatting()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test; namespace Composer\Test;
use Composer\Config; use Composer\Config;
use PHPUnit\Framework\TestCase;
class DefaultConfigTest extends \PHPUnit_Framework_TestCase class DefaultConfigTest extends TestCase
{ {
/** /**
* @group TLS * @group TLS

View File

@ -17,8 +17,9 @@ use Composer\DependencyResolver\Rule;
use Composer\DependencyResolver\RuleSet; use Composer\DependencyResolver\RuleSet;
use Composer\DependencyResolver\RuleSetIterator; use Composer\DependencyResolver\RuleSetIterator;
use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Pool;
use PHPUnit\Framework\TestCase;
class RuleSetIteratorTest extends \PHPUnit_Framework_TestCase class RuleSetIteratorTest extends TestCase
{ {
protected $rules; protected $rules;

View File

@ -12,7 +12,9 @@
namespace Composer\Test\Downloader; namespace Composer\Test\Downloader;
class ArchiveDownloaderTest extends \PHPUnit_Framework_TestCase use PHPUnit\Framework\TestCase;
class ArchiveDownloaderTest extends TestCase
{ {
public function testGetFileName() public function testGetFileName()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Downloader; namespace Composer\Test\Downloader;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use PHPUnit\Framework\TestCase;
class DownloadManagerTest extends \PHPUnit_Framework_TestCase class DownloadManagerTest extends TestCase
{ {
protected $filesystem; protected $filesystem;
protected $io; protected $io;

View File

@ -16,8 +16,9 @@ use Composer\Installer\InstallationManager;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;
use PHPUnit\Framework\TestCase;
class InstallationManagerTest extends \PHPUnit_Framework_TestCase class InstallationManagerTest extends TestCase
{ {
public function setUp() public function setUp()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Installer; namespace Composer\Test\Installer;
use Composer\Installer\InstallerEvent; use Composer\Installer\InstallerEvent;
use PHPUnit\Framework\TestCase;
class InstallerEventTest extends \PHPUnit_Framework_TestCase class InstallerEventTest extends TestCase
{ {
public function testGetter() public function testGetter()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Installer; namespace Composer\Test\Installer;
use Composer\Installer\MetapackageInstaller; use Composer\Installer\MetapackageInstaller;
use PHPUnit\Framework\TestCase;
class MetapackageInstallerTest extends \PHPUnit_Framework_TestCase class MetapackageInstallerTest extends TestCase
{ {
private $repository; private $repository;
private $installer; private $installer;

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Installer; namespace Composer\Test\Installer;
use Composer\Installer\SuggestedPackagesReporter; use Composer\Installer\SuggestedPackagesReporter;
use PHPUnit\Framework\TestCase;
/** /**
* @coversDefaultClass Composer\Installer\SuggestedPackagesReporter * @coversDefaultClass Composer\Installer\SuggestedPackagesReporter
*/ */
class SuggestedPackagesReporterTest extends \PHPUnit_Framework_TestCase class SuggestedPackagesReporterTest extends TestCase
{ {
private $io; private $io;
private $suggestedPackagesReporter; private $suggestedPackagesReporter;

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Json; namespace Composer\Test\Json;
use JsonSchema\Validator; use JsonSchema\Validator;
use PHPUnit\Framework\TestCase;
/** /**
* @author Rob Bast <rob.bast@gmail.com> * @author Rob Bast <rob.bast@gmail.com>
*/ */
class ComposerSchemaTest extends \PHPUnit_Framework_TestCase class ComposerSchemaTest extends TestCase
{ {
public function testRequiredProperties() public function testRequiredProperties()
{ {

View File

@ -14,8 +14,9 @@ namespace Composer\Test\Json;
use Seld\JsonLint\ParsingException; use Seld\JsonLint\ParsingException;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use PHPUnit\Framework\TestCase;
class JsonFileTest extends \PHPUnit_Framework_TestCase class JsonFileTest extends TestCase
{ {
public function testParseErrorDetectExtraComma() public function testParseErrorDetectExtraComma()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Json; namespace Composer\Test\Json;
use Composer\Json\JsonFormatter; use Composer\Json\JsonFormatter;
use PHPUnit\Framework\TestCase;
class JsonFormatterTest extends \PHPUnit_Framework_TestCase class JsonFormatterTest extends TestCase
{ {
/** /**
* Test if \u0119 (196+153) will get correctly formatted * Test if \u0119 (196+153) will get correctly formatted

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Json; namespace Composer\Test\Json;
use Composer\Json\JsonManipulator; use Composer\Json\JsonManipulator;
use PHPUnit\Framework\TestCase;
class JsonManipulatorTest extends \PHPUnit_Framework_TestCase class JsonManipulatorTest extends TestCase
{ {
/** /**
* @dataProvider linkProvider * @dataProvider linkProvider

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Json; namespace Composer\Test\Json;
use Composer\Json\JsonValidationException; use Composer\Json\JsonValidationException;
use PHPUnit\Framework\TestCase;
class JsonValidationExceptionTest extends \PHPUnit_Framework_TestCase class JsonValidationExceptionTest extends TestCase
{ {
/** /**
* @dataProvider errorProvider * @dataProvider errorProvider

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Package\Archiver; namespace Composer\Test\Package\Archiver;
use Composer\Package\Archiver\GitExcludeFilter; use Composer\Package\Archiver\GitExcludeFilter;
use PHPUnit\Framework\TestCase;
class GitExcludeFilterTest extends \PHPUnit_Framework_TestCase class GitExcludeFilterTest extends TestCase
{ {
/** /**
* @dataProvider patterns * @dataProvider patterns

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Package\Archiver; namespace Composer\Test\Package\Archiver;
use Composer\Package\Archiver\HgExcludeFilter; use Composer\Package\Archiver\HgExcludeFilter;
use PHPUnit\Framework\TestCase;
class HgExcludeFilterTest extends \PHPUnit_Framework_TestCase class HgExcludeFilterTest extends TestCase
{ {
/** /**
* @dataProvider patterns * @dataProvider patterns

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Package; namespace Composer\Test\Package;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use PHPUnit\Framework\TestCase;
class BasePackageTest extends \PHPUnit_Framework_TestCase class BasePackageTest extends TestCase
{ {
public function testSetSameRepository() public function testSetSameRepository()
{ {

View File

@ -15,8 +15,9 @@ namespace Composer\Test\Package\Dumper;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use PHPUnit\Framework\TestCase;
class ArrayDumperTest extends \PHPUnit_Framework_TestCase class ArrayDumperTest extends TestCase
{ {
/** /**
* @var ArrayDumper * @var ArrayDumper

View File

@ -14,8 +14,9 @@ namespace Composer\Test\Package\Loader;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use PHPUnit\Framework\TestCase;
class ArrayLoaderTest extends \PHPUnit_Framework_TestCase class ArrayLoaderTest extends TestCase
{ {
/** /**
* @var ArrayLoader * @var ArrayLoader

View File

@ -17,9 +17,10 @@ use Composer\Package\Loader\RootPackageLoader;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionGuesser;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument; use Prophecy\Argument;
class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase class RootPackageLoaderTest extends TestCase
{ {
protected function loadPackage($data) protected function loadPackage($data)
{ {

View File

@ -14,8 +14,9 @@ namespace Composer\Test\Package\Loader;
use Composer\Package\Loader\ValidatingArrayLoader; use Composer\Package\Loader\ValidatingArrayLoader;
use Composer\Package\Loader\InvalidPackageException; use Composer\Package\Loader\InvalidPackageException;
use PHPUnit\Framework\TestCase;
class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase class ValidatingArrayLoaderTest extends TestCase
{ {
/** /**
* @dataProvider successProvider * @dataProvider successProvider

View File

@ -14,8 +14,9 @@ namespace Composer\Test\Package;
use Composer\Package\Locker; use Composer\Package\Locker;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use PHPUnit\Framework\TestCase;
class LockerTest extends \PHPUnit_Framework_TestCase class LockerTest extends TestCase
{ {
public function testIsLocked() public function testIsLocked()
{ {

View File

@ -15,8 +15,9 @@ namespace Composer\Test\Package\Version;
use Composer\Config; use Composer\Config;
use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionGuesser;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use PHPUnit\Framework\TestCase;
class VersionGuesserTest extends \PHPUnit_Framework_TestCase class VersionGuesserTest extends TestCase
{ {
public function setUp() public function setUp()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Package\Version; namespace Composer\Test\Package\Version;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use PHPUnit\Framework\TestCase;
class VersionParserTest extends \PHPUnit_Framework_TestCase class VersionParserTest extends TestCase
{ {
/** /**
* @dataProvider getParseNameVersionPairsData * @dataProvider getParseNameVersionPairsData

View File

@ -16,8 +16,9 @@ use Composer\Package\Version\VersionSelector;
use Composer\Package\Package; use Composer\Package\Package;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use PHPUnit\Framework\TestCase;
class VersionSelectorTest extends \PHPUnit_Framework_TestCase class VersionSelectorTest extends TestCase
{ {
// A) multiple versions, get the latest one // A) multiple versions, get the latest one
// B) targetPackageVersion will pass to pool // B) targetPackageVersion will pass to pool

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\Bitbucket; use Composer\Util\Bitbucket;
use PHPUnit\Framework\TestCase;
/** /**
* @author Paul Wenke <wenke.paul@gmail.com> * @author Paul Wenke <wenke.paul@gmail.com>
*/ */
class BitbucketTest extends \PHPUnit_Framework_TestCase class BitbucketTest extends TestCase
{ {
private $username = 'username'; private $username = 'username';
private $password = 'password'; private $password = 'password';

View File

@ -14,13 +14,14 @@ namespace Composer\Test\Util;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;
use Composer\Util\GitHub; use Composer\Util\GitHub;
use PHPUnit\Framework\TestCase;
use RecursiveArrayIterator; use RecursiveArrayIterator;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
/** /**
* @author Rob Bast <rob.bast@gmail.com> * @author Rob Bast <rob.bast@gmail.com>
*/ */
class GitHubTest extends \PHPUnit_Framework_TestCase class GitHubTest extends TestCase
{ {
private $username = 'username'; private $username = 'username';
private $password = 'password'; private $password = 'password';

View File

@ -14,11 +14,12 @@ namespace Composer\Test\Util;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;
use Composer\Util\GitLab; use Composer\Util\GitLab;
use PHPUnit\Framework\TestCase;
/** /**
* @author Jérôme Tamarelle <jerome@tamarelle.net> * @author Jérôme Tamarelle <jerome@tamarelle.net>
*/ */
class GitLabTest extends \PHPUnit_Framework_TestCase class GitLabTest extends TestCase
{ {
private $username = 'username'; private $username = 'username';
private $password = 'password'; private $password = 'password';

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\IniHelper; use Composer\Util\IniHelper;
use PHPUnit\Framework\TestCase;
/** /**
* @author John Stevenson <john-stevenson@blueyonder.co.uk> * @author John Stevenson <john-stevenson@blueyonder.co.uk>
*/ */
class IniHelperTest extends \PHPUnit_Framework_TestCase class IniHelperTest extends TestCase
{ {
public static $envOriginal; public static $envOriginal;

View File

@ -13,11 +13,12 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\Perforce; use Composer\Util\Perforce;
use PHPUnit\Framework\TestCase;
/** /**
* @author Matt Whittom <Matt.Whittom@veteransunited.com> * @author Matt Whittom <Matt.Whittom@veteransunited.com>
*/ */
class PerforceTest extends \PHPUnit_Framework_TestCase class PerforceTest extends TestCase
{ {
protected $perforce; protected $perforce;
protected $processExecutor; protected $processExecutor;

View File

@ -13,13 +13,14 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\Platform; use Composer\Util\Platform;
use PHPUnit\Framework\TestCase;
/** /**
* PlatformTest * PlatformTest
* *
* @author Niels Keurentjes <niels.keurentjes@omines.com> * @author Niels Keurentjes <niels.keurentjes@omines.com>
*/ */
class PlatformTest extends \PHPUnit_Framework_TestCase class PlatformTest extends TestCase
{ {
public function testExpandPath() public function testExpandPath()
{ {

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\RemoteFilesystem; use Composer\Util\RemoteFilesystem;
use PHPUnit\Framework\TestCase;
class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase class RemoteFilesystemTest extends TestCase
{ {
public function testGetOptionsForUrl() public function testGetOptionsForUrl()
{ {

View File

@ -13,13 +13,14 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\Silencer; use Composer\Util\Silencer;
use PHPUnit\Framework\TestCase;
/** /**
* SilencerTest * SilencerTest
* *
* @author Niels Keurentjes <niels.keurentjes@omines.com> * @author Niels Keurentjes <niels.keurentjes@omines.com>
*/ */
class SilencerTest extends \PHPUnit_Framework_TestCase class SilencerTest extends TestCase
{ {
/** /**
* Test succeeds when no warnings are emitted externally, and original level is restored. * Test succeeds when no warnings are emitted externally, and original level is restored.

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\StreamContextFactory; use Composer\Util\StreamContextFactory;
use PHPUnit\Framework\TestCase;
class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase class StreamContextFactoryTest extends TestCase
{ {
protected function setUp() protected function setUp()
{ {

View File

@ -16,8 +16,9 @@ use Composer\Config;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Util\Svn; use Composer\Util\Svn;
use PHPUnit\Framework\TestCase;
class SvnTest extends \PHPUnit_Framework_TestCase class SvnTest extends TestCase
{ {
/** /**
* Test the credential string. * Test the credential string.

View File

@ -13,8 +13,9 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\TlsHelper; use Composer\Util\TlsHelper;
use PHPUnit\Framework\TestCase;
class TlsHelperTest extends \PHPUnit_Framework_TestCase class TlsHelperTest extends TestCase
{ {
/** @dataProvider dataCheckCertificateHost */ /** @dataProvider dataCheckCertificateHost */
public function testCheckCertificateHost($expectedResult, $hostname, $certNames) public function testCheckCertificateHost($expectedResult, $hostname, $certNames)

View File

@ -14,6 +14,7 @@ namespace Composer\Test;
use Composer\Test\Mock\XdebugHandlerMock; use Composer\Test\Mock\XdebugHandlerMock;
use Composer\Util\IniHelper; use Composer\Util\IniHelper;
use PHPUnit\Framework\TestCase;
/** /**
* @author John Stevenson <john-stevenson@blueyonder.co.uk> * @author John Stevenson <john-stevenson@blueyonder.co.uk>
@ -21,7 +22,7 @@ use Composer\Util\IniHelper;
* We use PHP_BINARY which only became available in PHP 5.4 * * We use PHP_BINARY which only became available in PHP 5.4 *
* @requires PHP 5.4 * @requires PHP 5.4
*/ */
class XdebugHandlerTest extends \PHPUnit_Framework_TestCase class XdebugHandlerTest extends TestCase
{ {
public static $env = array(); public static $env = array();

View File

@ -17,9 +17,10 @@ use Composer\Package\AliasPackage;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\Silencer; use Composer\Util\Silencer;
use PHPUnit\Framework\TestCase as BaseTestCase;
use Symfony\Component\Process\ExecutableFinder; use Symfony\Component\Process\ExecutableFinder;
abstract class TestCase extends \PHPUnit_Framework_TestCase abstract class TestCase extends BaseTestCase
{ {
private static $parser; private static $parser;
private static $executableCache = array(); private static $executableCache = array();