diff --git a/.travis.yml b/.travis.yml index 5c41f01..2c2a091 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ language: php sudo: required php: - - 5.5 - - 5.6 - - 7.0 - 7.1 + - 7.2 + - 7.3 + - 7.4 env: PREFER_LOWEST="" @@ -14,7 +14,7 @@ env: matrix: fast_finish: true include: - - php: 5.5 + - php: 7.1 env: PREFER_LOWEST="--prefer-lowest" before_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c05daf..0fa7047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ ## [Unreleased changes] - No changes +## [0.4.10] - TBD +### Changed +- Allow Symfony 5.0 components +- Drop support for PHP5 (it is long gone) + +## [0.4.9] - 2018-02-27 +### Changed +- Allow Symfony 4.0 in composer.json + ## [0.4.8] - 2017-03-03 ### Fixed - #125: Fix invalid paths with relative locations, courtesy of @paulredmond diff --git a/composer.json b/composer.json index c6ebe58..4e580e1 100644 --- a/composer.json +++ b/composer.json @@ -12,18 +12,18 @@ } ], "require": { - "php": ">=5.5", + "php": ">=7.1", "doctrine/collections": "~1.0", - "symfony/filesystem": "^2.0.5 || ^3.0 || ^4.0", - "symfony/process": "^3.4 || ^4.0", + "symfony/filesystem": "^2.0.5 || ^3.0 || ^4.0 || ^5.0", + "symfony/process": "^3.4 || ^4.0 || ^5.0", "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { "ext-zip": "*", "guzzle/guzzle": "~3.0", "guzzlehttp/guzzle": "^6.0", - "phpunit/phpunit": "^4.0 || ^5.0", - "symfony/finder": "^2.0.5 || ^3.0 || ^4.0" + "phpunit/phpunit": "^7.0", + "symfony/finder": "^2.0.5 || ^3.0 || ^4.0 || ^5.0" }, "suggest": { "ext-zip": "To use the ZipExtensionAdapter", diff --git a/phpunit-functional.xml.dist b/phpunit-functional.xml.dist index ccf2483..74fa2b6 100644 --- a/phpunit-functional.xml.dist +++ b/phpunit-functional.xml.dist @@ -7,7 +7,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="true" verbose="false" bootstrap="vendor/autoload.php" > diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ef0d155..c50bbf1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="true" verbose="false" bootstrap="vendor/autoload.php" > diff --git a/tests/Functional/Add2ArchiveTest.php b/tests/Functional/Add2ArchiveTest.php index 37e8f18..20a8a1c 100644 --- a/tests/Functional/Add2ArchiveTest.php +++ b/tests/Functional/Add2ArchiveTest.php @@ -55,7 +55,7 @@ public function testAdd() 'Alchemy\Zippy\Adapter\BSDTar\TarGzBSDTarAdapter', 'Alchemy\Zippy\Adapter\BSDTar\TarBz2BSDTarAdapter', ))) { - $this->setExpectedException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); + $this->expectException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); } $archive->addMembers(array('somemorefiles/nicephoto.jpg' => __DIR__ . '/samples/morefiles/morephoto.jpg')); diff --git a/tests/Functional/CreateArchiveTest.php b/tests/Functional/CreateArchiveTest.php index b96104c..2fe9ab8 100644 --- a/tests/Functional/CreateArchiveTest.php +++ b/tests/Functional/CreateArchiveTest.php @@ -18,6 +18,9 @@ public static function tearDownAfterClass() } } + /** + * @doesNotPerformAssertions + */ public function testCreate() { $adapter = $this->getAdapter(); diff --git a/tests/Functional/ExtractArchiveTest.php b/tests/Functional/ExtractArchiveTest.php index afdceab..3638409 100644 --- a/tests/Functional/ExtractArchiveTest.php +++ b/tests/Functional/ExtractArchiveTest.php @@ -6,6 +6,9 @@ class ExtractArchiveTest extends FunctionalTestCase { + /** + * @doesNotPerformAssertions + */ public function testOpen() { $adapter = $this->getAdapter(); diff --git a/tests/Functional/ExtractMembersArchiveTest.php b/tests/Functional/ExtractMembersArchiveTest.php index 43ee3d2..729a88a 100644 --- a/tests/Functional/ExtractMembersArchiveTest.php +++ b/tests/Functional/ExtractMembersArchiveTest.php @@ -6,6 +6,9 @@ class ExtractMembersArchiveTest extends FunctionalTestCase { + /** + * @doesNotPerformAssertions + */ public function testOpen() { $adapter = $this->getAdapter(); diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php index 2c05a00..fd76a17 100644 --- a/tests/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -6,7 +6,7 @@ use Alchemy\Zippy\Adapter\AdapterContainer; use Symfony\Component\Filesystem\Filesystem; -abstract class FunctionalTestCase extends \PHPUnit_Framework_TestCase +abstract class FunctionalTestCase extends \PHPUnit\Framework\TestCase { public function tearDown() { diff --git a/tests/Functional/ListArchiveTest.php b/tests/Functional/ListArchiveTest.php index 471ffc8..c04a6c7 100644 --- a/tests/Functional/ListArchiveTest.php +++ b/tests/Functional/ListArchiveTest.php @@ -4,6 +4,9 @@ class ListArchiveTest extends FunctionalTestCase { + /** + * @doesNotPerformAssertions + */ public function testOpen() { $adapter = $this->getAdapter(); diff --git a/tests/Tests/Adapter/BSDTar/BSDTarAdapterWithOptionsTest.php b/tests/Tests/Adapter/BSDTar/BSDTarAdapterWithOptionsTest.php index 5d24279..41c3dff 100644 --- a/tests/Tests/Adapter/BSDTar/BSDTarAdapterWithOptionsTest.php +++ b/tests/Tests/Adapter/BSDTar/BSDTarAdapterWithOptionsTest.php @@ -250,7 +250,7 @@ public function testListMembers() public function testAddFile() { $resource = $this->getResource(self::$tarFile); - $this->setExpectedException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); + $this->expectException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); $this->adapter->add($resource, array(__DIR__ . '/../TestCase.php')); } diff --git a/tests/Tests/Adapter/GNUTar/GNUTarAdapterWithOptionsTest.php b/tests/Tests/Adapter/GNUTar/GNUTarAdapterWithOptionsTest.php index f540ebf..c6a6900 100644 --- a/tests/Tests/Adapter/GNUTar/GNUTarAdapterWithOptionsTest.php +++ b/tests/Tests/Adapter/GNUTar/GNUTarAdapterWithOptionsTest.php @@ -232,7 +232,7 @@ public function testListMembers() public function testAddFile() { $resource = $this->getResource(self::$tarFile); - $this->setExpectedException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); + $this->expectException('Alchemy\Zippy\Exception\NotSupportedException', 'Updating a compressed tar archive is not supported.'); $this->adapter->add($resource, array(__DIR__ . '/../TestCase.php')); } diff --git a/tests/Tests/Adapter/ZipExtensionAdapterTest.php b/tests/Tests/Adapter/ZipExtensionAdapterTest.php index 5e5988d..e94169e 100644 --- a/tests/Tests/Adapter/ZipExtensionAdapterTest.php +++ b/tests/Tests/Adapter/ZipExtensionAdapterTest.php @@ -4,6 +4,7 @@ use Alchemy\Zippy\Adapter\ZipExtensionAdapter; use Alchemy\Zippy\Adapter\Resource\ZipArchiveResource; +use Alchemy\Zippy\Exception\RuntimeException; class ZipExtensionAdapterTest extends AdapterTestCase { @@ -60,12 +61,12 @@ public function testCreate() unlink($file); } - /** - * @expectedException \Alchemy\Zippy\Exception\RuntimeException - */ public function testOpenWithWrongFileName() { - $file = __DIR__ . '/zip-file.zip'; + $file = __DIR__ . '/zip-file-non-existing.zip'; + + self::expectException(RuntimeException::class); + $this->adapter->open($file); } @@ -193,7 +194,7 @@ public function testRemoveWithLocateFailing() } /** - * @expectedException \Alchemy\Zippy\Exception\RuntimeException + * @expectedException RuntimeException */ public function testRemoveWithDeleteFailing() { @@ -251,7 +252,7 @@ public function testAdd() } /** - * @expectedException \Alchemy\Zippy\Exception\RuntimeException + * @expectedException RuntimeException */ public function testAddFailOnFile() { @@ -280,7 +281,7 @@ public function testAddFailOnFile() } /** - * @expectedException \Alchemy\Zippy\Exception\RuntimeException + * @expectedException RuntimeException */ public function testAddFailOnDir() { diff --git a/tests/Tests/Parser/BSDTarOutputParserTest.php b/tests/Tests/Parser/BSDTarOutputParserTest.php index 6c1f9e6..020da6f 100644 --- a/tests/Tests/Parser/BSDTarOutputParserTest.php +++ b/tests/Tests/Parser/BSDTarOutputParserTest.php @@ -7,6 +7,9 @@ class BSDTarOutputParserTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testNewParser() { return new BSDTarOutputParser(); diff --git a/tests/Tests/Parser/GNUTarOutputParserTest.php b/tests/Tests/Parser/GNUTarOutputParserTest.php index da8468c..36c1dcb 100644 --- a/tests/Tests/Parser/GNUTarOutputParserTest.php +++ b/tests/Tests/Parser/GNUTarOutputParserTest.php @@ -7,6 +7,9 @@ class GNUTarOutputParserTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testNewParser() { return new GNUTarOutputParser(); diff --git a/tests/Tests/Parser/ZipOutputParserTest.php b/tests/Tests/Parser/ZipOutputParserTest.php index 8a4045f..1e71045 100644 --- a/tests/Tests/Parser/ZipOutputParserTest.php +++ b/tests/Tests/Parser/ZipOutputParserTest.php @@ -7,6 +7,9 @@ class ZipOutputParserTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testNewParser() { return new ZipOutputParser(); diff --git a/tests/Tests/Resource/FilesystemWriterTest.php b/tests/Tests/Resource/FilesystemWriterTest.php index 4af69ab..f88a3c4 100644 --- a/tests/Tests/Resource/FilesystemWriterTest.php +++ b/tests/Tests/Resource/FilesystemWriterTest.php @@ -9,13 +9,16 @@ class FilesystemWriterTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testWriteFromReader() { $resource = new Resource(fopen(__FILE__, 'r'), fopen(__FILE__, 'r')); $reader = new StreamReader($resource); $streamWriter = new FilesystemWriter(); - + $streamWriter->writeFromReader($reader, sys_get_temp_dir().'/stream/writer/test.php'); $streamWriter->writeFromReader($reader, sys_get_temp_dir().'/test.php'); } diff --git a/tests/Tests/Resource/ResourceTeleporterTest.php b/tests/Tests/Resource/ResourceTeleporterTest.php index 1ddd795..7f6eb5e 100644 --- a/tests/Tests/Resource/ResourceTeleporterTest.php +++ b/tests/Tests/Resource/ResourceTeleporterTest.php @@ -9,6 +9,7 @@ class ResourceTeleporterTest extends TestCase { /** * @covers Alchemy\Zippy\Resource\ResourceTeleporter::__construct + * @doesNotPerformAssertions */ public function testConstruct() { diff --git a/tests/Tests/Resource/StreamWriterTest.php b/tests/Tests/Resource/StreamWriterTest.php index 0204422..ba49e43 100644 --- a/tests/Tests/Resource/StreamWriterTest.php +++ b/tests/Tests/Resource/StreamWriterTest.php @@ -9,6 +9,9 @@ class StreamWriterTest extends TestCase { + /** + * @doesNotPerformAssertions + */ public function testWriteFromReader() { $resource = new Resource(fopen(__FILE__, 'r'), fopen(__FILE__, 'r')); diff --git a/tests/Tests/TestCase.php b/tests/Tests/TestCase.php index 91b339f..baa678a 100644 --- a/tests/Tests/TestCase.php +++ b/tests/Tests/TestCase.php @@ -8,7 +8,7 @@ use Alchemy\Zippy\Resource\Resource; use Alchemy\Zippy\Adapter\VersionProbe\VersionProbeInterface; -abstract class TestCase extends \PHPUnit_Framework_TestCase +abstract class TestCase extends \PHPUnit\Framework\TestCase { public static function getResourcesPath() { diff --git a/tests/Tests/ZippyTest.php b/tests/Tests/ZippyTest.php index aff2b3f..8599e5c 100644 --- a/tests/Tests/ZippyTest.php +++ b/tests/Tests/ZippyTest.php @@ -177,12 +177,10 @@ public function itShouldThrowAnExceptionIfNoAdapterSupported() $zippy = new Zippy($this->getContainer()); $zippy->addStrategy($strategy); - try { - $zippy->getAdapterFor('zippo'); - $this->fail('Should have raised an exception'); - } catch (NoAdapterOnPlatformException $e) { + self::expectException(NoAdapterOnPlatformException::class); + $zippy->getAdapterFor('zippo'); - } + $this->fail('Should have raised an exception'); } /** @test */ @@ -194,12 +192,10 @@ public function itShouldThrowAnExceptionIfFormatNotSupported() $zippy = new Zippy($this->getContainer()); $zippy->addStrategy($strategy); - try { - $zippy->getAdapterFor('zippo'); - $this->fail('Should have raised an exception'); - } catch (FormatNotSupportedException $e) { + self::expectException(FormatNotSupportedException::class); + $zippy->getAdapterFor('zippo'); - } + $this->fail('Should have raised an exception'); } /** @test */