diff --git a/.travis.yml b/.travis.yml index 478f3b6..28e21a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,10 @@ sudo: false language: php php: - - 7.1 - 7.2 + - 7.3 + - 7.4 + - 8.0 cache: directories: diff --git a/composer.json b/composer.json index 779f820..a300cae 100644 --- a/composer.json +++ b/composer.json @@ -6,15 +6,15 @@ "bin": ["bin/dbsampler"], "require": { "doctrine/dbal": "^2.5", - "fzaninotto/faker": "^1.6", + "fakerphp/faker": "^1.13", "monolog/monolog": "^1.22", "pimple/pimple": "^3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "2.16.0", - "phpunit/phpunit": "^5.7", + "friendsofphp/php-cs-fixer": "^2.16", + "phpunit/phpunit": "^8.5", "roave/security-advisories": "dev-master", - "squizlabs/php_codesniffer": "^2.7" + "squizlabs/php_codesniffer": "^3.5" }, "authors": [ { @@ -38,9 +38,9 @@ "scripts": { "phpcs": "./vendor/bin/phpcs src/ --standard=PSR2 --warning-severity=8", "phpcbf": "./vendor/bin/phpcbf src/ --standard=PSR2 --warning-severity=8", - "php-cs-fixer-lint": "./vendor/bin/php-cs-fixer --verbose --dry-run fix --rules=@PSR2,no_unused_imports src/", - "php-cs-fixer-fix": "./vendor/bin/php-cs-fixer --verbose fix --rules=@PSR2,no_unused_imports src/", - "phpunit": "./vendor/bin/phpunit --coverage-clover=phpcov.xml --coverage-text", + "php-cs-fixer-lint": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer --verbose --dry-run fix --rules=@PSR2,no_unused_imports src/", + "php-cs-fixer-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer --verbose fix --rules=@PSR2,no_unused_imports src/", + "phpunit": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover=phpcov.xml --coverage-text", "lint": [ "@phpcs", "@php-cs-fixer-lint" diff --git a/phpunit.xml b/phpunit.xml index ec92eda..a940c08 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,7 +3,6 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" - strict="true" verbose="false"> diff --git a/tests/AppSetupTest.php b/tests/AppSetupTest.php index e5728f7..0de13f0 100644 --- a/tests/AppSetupTest.php +++ b/tests/AppSetupTest.php @@ -46,13 +46,13 @@ public function testSampleMigration() * Check that sqlite credential files handle missing directory field correctly * * @return void - * @expectedException \RuntimeException */ public function testSqliteCredentialMissingDirectoryHandling() { $app = new App(); $app->loadCredentialsFile($this->fixturesDir . '/sqlite-credentials-no-dir.json'); $app->loadDatabaseConfigFile($this->fixturesDir . '/small_sqlite_migration.json'); + $this->expectException(\RuntimeException::class); $app->createDestConnectionByDbName('small-sqlite-source'); // directory tested at connection time now } diff --git a/tests/FieldCleanerProviderTest.php b/tests/FieldCleanerProviderTest.php index 35f10c2..29f5b9e 100644 --- a/tests/FieldCleanerProviderTest.php +++ b/tests/FieldCleanerProviderTest.php @@ -3,15 +3,16 @@ namespace Quidco\DbSampler\Tests; use Quidco\DbSampler\FieldCleanerProvider; +use PHPUnit\Framework\TestCase; -class FieldCleanerProviderTest extends \PHPUnit_Framework_TestCase +class FieldCleanerProviderTest extends TestCase { /** * @var FieldCleanerProvider */ private $fieldCleaner; - public function setUp() + public function setUp(): void { $this->fieldCleaner = new FieldCleanerProvider(); } diff --git a/tests/ReferenceStoreTest.php b/tests/ReferenceStoreTest.php index b9d063e..88d2d85 100644 --- a/tests/ReferenceStoreTest.php +++ b/tests/ReferenceStoreTest.php @@ -3,8 +3,9 @@ namespace Quidco\DbSampler\Tests; use Quidco\DbSampler\ReferenceStore; +use PHPUnit\Framework\TestCase; -class ReferenceStoreTest extends \PHPUnit_Framework_TestCase +class ReferenceStoreTest extends TestCase { public function testBasicFunctions() { diff --git a/tests/SamplerTest.php b/tests/SamplerTest.php index 212273f..e7a5a23 100644 --- a/tests/SamplerTest.php +++ b/tests/SamplerTest.php @@ -67,14 +67,15 @@ public function testMatchedWhereNoConstraints() ]; $sampler->loadConfig((object)$config); $sampler->execute(); + $this->assertInstanceOf(Matched::class, $sampler); } /** - * @expectedException \RuntimeException */ public function testMatchedNoConfigThrows() { $sampler = $this->generateMatched(); + $this->expectException(\RuntimeException::class); $sampler->loadConfig((object)[]); $sampler->execute(); } diff --git a/tests/SqliteBasedTestCase.php b/tests/SqliteBasedTestCase.php index a118a63..ce5c3ec 100644 --- a/tests/SqliteBasedTestCase.php +++ b/tests/SqliteBasedTestCase.php @@ -4,8 +4,9 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\DriverManager; +use PHPUnit\Framework\TestCase; -abstract class SqliteBasedTestCase extends \PHPUnit_Framework_TestCase +abstract class SqliteBasedTestCase extends TestCase { /** * @var string @@ -25,7 +26,7 @@ abstract class SqliteBasedTestCase extends \PHPUnit_Framework_TestCase * * @return void */ - protected function setUp() + protected function setUp(): void { $this->fixturesDir = __DIR__ . '/fixtures'; $sqliteConfig = ['driver' => 'pdo_sqlite', 'directory' => $this->fixturesDir . '/sqlite-dbs']; @@ -44,7 +45,7 @@ protected function setUp() * * @return void */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); unlink($this->fixturesDir . '/sqlite-credentials.json');