Skip to content

Commit

Permalink
Upgrade Symfony dependencies (#7)
Browse files Browse the repository at this point in the history
* Upgrade Symfony dependencies
- allow the 5.x series of the Symfony components

* Travis CI configuration and phpunit
- update php versions to a today's usual choice
- upgrade phpunit from 5.7 to 7.5, which was used from travis ci anyways

* Fix setUp declaration
- fix setUp() declaration to be compatible with PHPUnit\Framework\TestCase::setUp()

* Fix setUp declaration
- add :void to setUp()

Co-authored-by: Sebastian Zipp <[email protected]>
  • Loading branch information
zippex and Sebastian Zipp authored Jul 17, 2020
1 parent 82cdd93 commit 3ab953b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
language: php

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

matrix:
allow_failures:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "ptachoire/php-dmtx",
"description": "Datamatrix r/w based on libdmtx <http://www.libdmtx.org/>",
"require": {
"symfony/process": "~3.4||~4.0",
"symfony/options-resolver": "~3.4||~4.0"
"symfony/process": "~3.4||~4.0||~5.0",
"symfony/options-resolver": "~3.4||~4.0||~5.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "^7.5"
},
"autoload": {
"psr-0": { "Dmtx": "src/" }
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="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
Expand Down
15 changes: 9 additions & 6 deletions tests/Dmtx/Tests/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ class ReaderTest extends TestCase
/** @var Reader */
private $reader;

protected function setUp(
$options = []
) {
$this->reader = new Reader($options);
/** @var array */
private $options;

protected function setUp(): void {
$this->reader = new Reader($this->options ?? []);
}

public function imageTestProvider()
Expand Down Expand Up @@ -42,7 +43,8 @@ public function testDecodeShouldReturnValidMessage(
array $expected_messages,
$filename
) {
$this->setUp($options);
$this->options = $options;
$this->setUp();

$this->assertEquals(
implode(" ", $expected_messages),
Expand All @@ -61,7 +63,8 @@ public function testDecodeFileShouldReturnValidMessage(
array $expected_messages,
$filename
) {
$this->setUp($options);
$this->options = $options;
$this->setUp();

$this->assertEquals(
implode(" ", $expected_messages),
Expand Down
2 changes: 1 addition & 1 deletion tests/Dmtx/Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Dmtx\Tests;

class TestCase extends \PHPUnit_Framework_TestCase
class TestCase extends \PHPUnit\Framework\TestCase
{
}
24 changes: 16 additions & 8 deletions tests/Dmtx/Tests/WriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ class WriterTest extends TestCase
{
/** @var Writer */
private $writer;

/** @var Reader */
private $reader;

protected function setUp(
$options = [],
$messages = []
) {
$this->writer = new Writer($options);
$this->writer->encode($messages);
/** @var array */
private $options;

/** @var array */
private $messages;

protected function setUp(): void {
$this->writer = new Writer($this->options ?? []);
$this->writer->encode($this->messages ?? []);

$this->reader = new Reader();
}
Expand Down Expand Up @@ -79,7 +83,9 @@ public function testDumpShouldReturnValidImage(
array $messages,
$expected
) {
$this->setUp($options, $messages);
$this->options = $options;
$this->messages = $messages;
$this->setUp();

$this->assertEquals(
$expected,
Expand All @@ -100,7 +106,9 @@ public function testSaveAsShouldCreateValidFile(
array $messages,
$expected
) {
$this->setUp($options, $messages);
$this->options = $options;
$this->messages = $messages;
$this->setUp();

$tmpfile = tempnam(sys_get_temp_dir(), 'dmtx-test-unit-').'.png';

Expand Down

0 comments on commit 3ab953b

Please sign in to comment.