Skip to content

Commit

Permalink
Merge pull request #21 from alchemy-fr/composer-php8
Browse files Browse the repository at this point in the history
add support to php 8.2 [BC Break]
  • Loading branch information
4rthem authored Apr 19, 2023
2 parents 4a34309 + bfaaad0 commit f2f985d
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 77 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ composer.lock
/nbproject/
/tests/lib/PHPExiftool/Test/tmp
/vendor
/.phpunit.result.cache
/tests/lib/PHPExiftool/tmp
/tests/files/ExifToolCopied.jpg_original
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.4
- 8.2

matrix:
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The recommended way to install PHP-Exiftool is [through composer](http://getcomp
```JSON
{
"require": {
"alchemy/phpexiftool": "^0.5.0"
"alchemy/phpexiftool": "^4.0"
}
}
```
Expand Down
19 changes: 11 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@
}
],
"require": {
"php": "^7.4",
"php": "^7.4 || ^8.2",
"doctrine/cache": "^1.0",
"doctrine/collections": "^1.0",
"monolog/monolog": "^2.6",
"exiftool/exiftool": "*",
"symfony/console": "^5",
"symfony/css-selector": "^5",
"symfony/dom-crawler": "^5",
"symfony/process": "^5",
"symfony/console": "^5 || ^6.2",
"symfony/css-selector": "^5 || ^6.2",
"symfony/dom-crawler": "^5 || ^6.2",
"symfony/process": "^5 || ^6",
"ext-dom": "*",
"cache/array-adapter": "^1.2",
"ext-json": "*",
"symfony/monolog-bridge": "^5.4"
"symfony/monolog-bridge": "^5.4 || ^6.2"
},
"suggest": {
"jms/serializer": "To serialize tags",
"symfony/yaml": "To serialize tags in Yaml format"
},
"require-dev": {
"jms/serializer": "~3",
"phpunit/phpunit": "^5",
"phpunit/phpunit": "^9.6.7",
"symfony/finder": "^5",
"symfony/yaml": "^3"
"symfony/yaml": "^5 || ^6"
},
"autoload": {
"psr-4": {
Expand All @@ -63,5 +63,8 @@
"autoload-dev": {
"psr-4": {
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
}
4 changes: 1 addition & 3 deletions lib/PHPExiftool/Exiftool.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ public function __construct(LoggerInterface $logger, ?string $binaryPath = null)
/**
* {@inheritdoc}
*/
public function setLogger(LoggerInterface $logger)
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;

return $this;
}


Expand Down
9 changes: 0 additions & 9 deletions 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="tests/bootstrap.php"
>
Expand All @@ -20,13 +19,5 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory>vendor</directory>
<directory>tests</directory>
<directory>lib/PHPExiftool/Driver/Tag/*</directory>
</blacklist>
</filter>

</phpunit>

9 changes: 2 additions & 7 deletions tests/lib/PHPExiftool/PHPExiftoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@
namespace lib\PHPExiftool;

use PHPExiftool\Exception\DirectoryNotFoundException;
use PHPExiftool\Exception\EmptyCollectionException;
use PHPExiftool\Exception\LogicException;
use PHPExiftool\Exception\RuntimeException;
use PHPExiftool\PHPExiftool;
use PHPExiftool\Reader;
use PHPUnit_Framework_TestCase;
use Symfony\Component\Process\Process;
use PHPUnit\Framework\TestCase;



class PHPExiftoolTest extends \PHPUnit_Framework_TestCase {
class PHPExiftoolTest extends TestCase {

private ?PHPExiftool $PHPExiftool = null;
protected static string $tmpDir = "";
Expand Down
9 changes: 5 additions & 4 deletions tests/lib/PHPExiftool/RDFParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
use PHPExiftool\Exception\LogicException;
use PHPExiftool\Exception\ParseErrorException;
use PHPExiftool\Exception\RuntimeException;
use PHPUnit\Framework\TestCase;


class RDFParserTest extends \PHPUnit_Framework_TestCase
class RDFParserTest extends TestCase
{
protected RDFParser $object;
protected Logger $logger;

protected function setUp()
protected function setUp(): void
{
$this->logger = new Logger('Tests');
$this->logger->pushHandler(new NullHandler());
Expand Down Expand Up @@ -69,10 +70,10 @@ public function testParseEntities()
* @covers RDFParser::getDom
* @covers RDFParser::getDomXpath
* @covers \PHPExiftool\Exception\LogicException
* @expectedException LogicException
*/
public function testParseEntitiesWithoutDom()
{
$this->expectException(\LogicException::class);
$this->object->parseEntities();
}

Expand All @@ -82,10 +83,10 @@ public function testParseEntitiesWithoutDom()
* @covers RDFParser::getDomXpath
* @covers \PHPExiftool\Exception\ParseErrorException
* @covers \PHPExiftool\Exception\RuntimeException
* @expectedException RuntimeException
*/
public function testParseEntitiesWrongDom()
{
$this->expectException(\RuntimeException::class);
$this->object->open('wrong xml')->parseEntities();
}

Expand Down
10 changes: 5 additions & 5 deletions tests/lib/PHPExiftool/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
use PHPExiftool\Exception\RuntimeException;
use PHPExiftool\PHPExiftool;
use PHPExiftool\Reader;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;



class ReaderTest extends \PHPUnit_Framework_TestCase {
class ReaderTest extends TestCase {

private ?PHPExiftool $PHPExiftool = null;
protected static string $tmpDir = "";
protected static bool $disableSymLinkTest = false;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

Expand Down Expand Up @@ -105,7 +105,7 @@ public static function setUpBeforeClass()

}

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->PHPExiftool = new PHPExiftool("/tmp");
Expand All @@ -119,7 +119,7 @@ private function createReader(): Reader
/**
* @covers Reader::__destruct
*/
protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();
}
Expand Down
12 changes: 5 additions & 7 deletions tests/lib/PHPExiftool/Test/AbstractPreviewExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
namespace lib\PHPExiftool\Test;

use lib\PHPExiftool\PreviewExtractor;
use PHPExiftool\Exception\LogicException;
use PHPUnit\Framework\TestCase;

abstract class AbstractPreviewExtractorTest extends \PHPUnit_Framework_TestCase
abstract class AbstractPreviewExtractorTest extends TestCase
{

/**
Expand Down Expand Up @@ -49,27 +51,23 @@ public function testExtract()
$this->assertEquals(1, $n);
}

/**
* @expectedException \lib\PHPExiftool\Exception\LogicException
*/
public function testExtractWrongFile()
{
$extractor = new PreviewExtractor($this->getExiftool());

$tmpDir = sys_get_temp_dir() . '/tests' . mt_rand(10000, 99999);

$this->expectException(LogicException::class);
$extractor->extract(__DIR__ . '/ExifTool.jpg', $tmpDir);
}

/**
* @expectedException \lib\PHPExiftool\Exception\LogicException
*/
public function testExtractWrongDir()
{
$extractor = new PreviewExtractor($this->getExiftool());

$tmpDir = sys_get_temp_dir() . '/tests' . mt_rand(10000, 99999);

$this->expectException(LogicException::class);
$extractor->extract(__DIR__ . '/../../../files/ExifTool.jpg', $tmpDir);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
namespace lib\PHPExiftool\Test\Driver\Metadata;

use PHPExiftool\Driver\Metadata\MetadataBag;
use PHPUnit\Framework\TestCase;

class MetadataBagTest extends \PHPUnit_Framework_TestCase
class MetadataBagTest extends TestCase
{
/**
* @var MetadataBag
*/
protected $object;

protected function setUp()
protected function setUp(): void
{
$this->object = new MetadataBag();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/PHPExiftool/Test/Driver/Metadata/MetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use PHPExiftool\Driver\AbstractTagGroup;
use PHPExiftool\Driver\Value\Mono;
use PHPExiftool\Driver\Metadata\Metadata;
use PHPUnit\Framework\TestCase;

class MetadataTest extends \PHPUnit_Framework_TestCase
class MetadataTest extends TestCase
{
/**
* @var Metadata
Expand All @@ -26,7 +27,7 @@ class MetadataTest extends \PHPUnit_Framework_TestCase
/**
* @covers Metadata::__construct
*/
protected function setUp()
protected function setUp(): void
{
$this->tag = new TagTest();
$this->value = new Mono('valeur');
Expand Down
7 changes: 3 additions & 4 deletions tests/lib/PHPExiftool/Test/Driver/TagGroupFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
use PHPExiftool\Driver\TagGroupInterface;
use PHPExiftool\Exception\TagUnknown;
use PHPExiftool\PHPExiftool;
use PHPUnit_Framework_TestCase;
// use PHPExiftool\Driver\TagGroup\IPTC\SupplementalCategories;
use PHPUnit\Framework\TestCase;

class TagGroupFactoryTest extends PHPUnit_Framework_TestCase
class TagGroupFactoryTest extends TestCase
{
protected TagGroupFactory $object;
private PHPExiftool $PHPExiftool;

protected function setUp()
protected function setUp(): void
{
$this->PHPExiftool = new PHPExiftool("/tmp");
}
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/PHPExiftool/Test/Driver/TagGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
use PHPExiftool\Driver\HelperInterface;
use PHPExiftool\Driver\TagGroupFactory;
use PHPExiftool\PHPExiftool;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\Finder;
use PHPExiftool\Driver\TagGroupInterface;


class TagGroupTest extends \PHPUnit_Framework_TestCase {
class TagGroupTest extends TestCase {

/**
* @var TagGroupInterface
Expand Down
11 changes: 6 additions & 5 deletions tests/lib/PHPExiftool/Test/Driver/Value/BinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use PHPExiftool\Driver\Value\Binary;
use PHPExiftool\Driver\Value\ValueInterface;
use PHPExiftool\Exception\InvalidArgumentException;
use PHPUnit\Framework\TestCase;

class BinaryTest extends \PHPUnit_Framework_TestCase
class BinaryTest extends TestCase
{
/**
* @var Binary
Expand All @@ -24,7 +25,7 @@ class BinaryTest extends \PHPUnit_Framework_TestCase
/**
* @covers Binary::__construct
*/
protected function setUp()
protected function setUp(): void
{
$this->object = new Binary('Binary');
}
Expand Down Expand Up @@ -74,10 +75,10 @@ public function testSetBase64Value()
/**
* @covers Binary::setBase64Value
* @covers InvalidArgumentException
* @expectedException InvalidArgumentException
*/
public function testSetWrongBase64Value()
{
$this->expectException(InvalidArgumentException::class);
$this->object->setBase64Value('Riri Fifi et Loulou !');
}

Expand All @@ -94,10 +95,10 @@ public function testLoadFromBase64()
/**
* @covers Binary::loadFromBase64
* @covers InvalidArgumentException
* @expectedException InvalidArgumentException
*/
public function testLoadFromWrongBase64()
{
$object = Binary::loadFromBase64('Uncle Scrooge !!!');
$this->expectException(InvalidArgumentException::class);
Binary::loadFromBase64('Uncle Scrooge !!!');
}
}
5 changes: 3 additions & 2 deletions tests/lib/PHPExiftool/Test/Driver/Value/MonoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

use PHPExiftool\Driver\Value\Mono;
use PHPExiftool\Driver\Value\ValueInterface;
use PHPUnit\Framework\TestCase;

class MonoTest extends \PHPUnit_Framework_TestCase
class MonoTest extends TestCase
{
/**
* @var Mono
Expand All @@ -23,7 +24,7 @@ class MonoTest extends \PHPUnit_Framework_TestCase
/**
* @covers Mono::__construct
*/
protected function setUp()
protected function setUp(): void
{
$this->object = new Mono('Hello !');
}
Expand Down
Loading

0 comments on commit f2f985d

Please sign in to comment.