Skip to content

Commit

Permalink
Merge pull request #156 from func0der/allow-newest-symfony-libraries
Browse files Browse the repository at this point in the history
Fix tests and allow Symfony 5
  • Loading branch information
nmaillat authored Apr 13, 2021
2 parents c79815c + a981727 commit 915d604
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 34 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ language: php
sudo: required

php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
PREFER_LOWEST=""

matrix:
fast_finish: true
include:
- php: 5.5
- php: 7.1
env: PREFER_LOWEST="--prefer-lowest"

before_script:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion phpunit-functional.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="false"
bootstrap="vendor/autoload.php"
>
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="false"
bootstrap="vendor/autoload.php"
>
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Add2ArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/CreateArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static function tearDownAfterClass()
}
}

/**
* @doesNotPerformAssertions
*/
public function testCreate()
{
$adapter = $this->getAdapter();
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/ExtractArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

class ExtractArchiveTest extends FunctionalTestCase
{
/**
* @doesNotPerformAssertions
*/
public function testOpen()
{
$adapter = $this->getAdapter();
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/ExtractMembersArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

class ExtractMembersArchiveTest extends FunctionalTestCase
{
/**
* @doesNotPerformAssertions
*/
public function testOpen()
{
$adapter = $this->getAdapter();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/ListArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

class ListArchiveTest extends FunctionalTestCase
{
/**
* @doesNotPerformAssertions
*/
public function testOpen()
{
$adapter = $this->getAdapter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
15 changes: 8 additions & 7 deletions tests/Tests/Adapter/ZipExtensionAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Alchemy\Zippy\Adapter\ZipExtensionAdapter;
use Alchemy\Zippy\Adapter\Resource\ZipArchiveResource;
use Alchemy\Zippy\Exception\RuntimeException;

class ZipExtensionAdapterTest extends AdapterTestCase
{
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -193,7 +194,7 @@ public function testRemoveWithLocateFailing()
}

/**
* @expectedException \Alchemy\Zippy\Exception\RuntimeException
* @expectedException RuntimeException
*/
public function testRemoveWithDeleteFailing()
{
Expand Down Expand Up @@ -251,7 +252,7 @@ public function testAdd()
}

/**
* @expectedException \Alchemy\Zippy\Exception\RuntimeException
* @expectedException RuntimeException
*/
public function testAddFailOnFile()
{
Expand Down Expand Up @@ -280,7 +281,7 @@ public function testAddFailOnFile()
}

/**
* @expectedException \Alchemy\Zippy\Exception\RuntimeException
* @expectedException RuntimeException
*/
public function testAddFailOnDir()
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/Parser/BSDTarOutputParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class BSDTarOutputParserTest extends TestCase
{
/**
* @doesNotPerformAssertions
*/
public function testNewParser()
{
return new BSDTarOutputParser();
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/Parser/GNUTarOutputParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class GNUTarOutputParserTest extends TestCase
{
/**
* @doesNotPerformAssertions
*/
public function testNewParser()
{
return new GNUTarOutputParser();
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/Parser/ZipOutputParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class ZipOutputParserTest extends TestCase
{
/**
* @doesNotPerformAssertions
*/
public function testNewParser()
{
return new ZipOutputParser();
Expand Down
5 changes: 4 additions & 1 deletion tests/Tests/Resource/FilesystemWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
1 change: 1 addition & 0 deletions tests/Tests/Resource/ResourceTeleporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ResourceTeleporterTest extends TestCase
{
/**
* @covers Alchemy\Zippy\Resource\ResourceTeleporter::__construct
* @doesNotPerformAssertions
*/
public function testConstruct()
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/Resource/StreamWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

class StreamWriterTest extends TestCase
{
/**
* @doesNotPerformAssertions
*/
public function testWriteFromReader()
{
$resource = new Resource(fopen(__FILE__, 'r'), fopen(__FILE__, 'r'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
16 changes: 6 additions & 10 deletions tests/Tests/ZippyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down

0 comments on commit 915d604

Please sign in to comment.