Skip to content

Commit a006681

Browse files
committed
Added PHP 8 support.
Dropped PHP 7.1 support.
1 parent 370029a commit a006681

31 files changed

+77
-48
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ sudo: false
66
language: php
77

88
php:
9-
- 7.1
109
- 7.2
1110
- 7.3
1211
- 7.4
12+
- 8.0
1313

1414
env:
1515
matrix:
@@ -29,7 +29,7 @@ install:
2929
- composer update --no-progress --no-suggest $DEPENDENCIES
3030

3131
script:
32-
- composer test -- --coverage-clover=build/logs/clover.xml
32+
- XDEBUG_MODE=coverage composer test -- --coverage-clover=build/logs/clover.xml
3333

3434
after_success:
3535
- composer require php-coveralls/php-coveralls:^2

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
],
1010
"license": "LGPL-3.0",
1111
"require": {
12-
"php": "^7.1",
12+
"php": "^7.2|^8",
1313
"scriptfusion/array-walker": "^1",
1414
"eloquent/enumeration": "^5|^6"
1515
},
1616
"require-dev": {
1717
"scriptfusion/static-class": "^1",
18-
"phpunit/phpunit": "^4.8",
19-
"mockery/mockery": "^1.3"
18+
"phpunit/phpunit": "^8.5|^9",
19+
"mockery/mockery": "^1.3.3"
2020
},
2121
"autoload": {
2222
"psr-4": {

test/Functional/DocumentationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace ScriptFUSIONTest\Functional;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\DataType;
56
use ScriptFUSION\Mapper\Expression;
67
use ScriptFUSION\Mapper\Mapper;
@@ -27,7 +28,7 @@
2728
use ScriptFUSIONTest\Fixture\FooBookAddressToAddresesMapping;
2829
use ScriptFUSIONTest\Fixture\FooToBarMapping;
2930

30-
final class DocumentationTest extends \PHPUnit_Framework_TestCase
31+
final class DocumentationTest extends TestCase
3132
{
3233
public function testFooToBarMapping()
3334
{

test/Functional/KeyPropagationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace ScriptFUSIONTest\Functional;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\AnonymousMapping;
56
use ScriptFUSION\Mapper\CollectionMapper;
67
use ScriptFUSION\Mapper\Mapper;
@@ -13,7 +14,7 @@
1314
/**
1415
* Tests that the key context is correctly propagated through different expression types.
1516
*/
16-
final class KeyPropagationTest extends \PHPUnit_Framework_TestCase
17+
final class KeyPropagationTest extends TestCase
1718
{
1819
public function testFragmentPropagation()
1920
{

test/Functional/StrategyBasedMappingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
22
namespace ScriptFUSIONTest\Functional;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\AnonymousMapping;
56
use ScriptFUSION\Mapper\Mapper;
67
use ScriptFUSION\Mapper\Strategy\Merge;
78

8-
final class StrategyBasedMappingTest extends \PHPUnit_Framework_TestCase
9+
final class StrategyBasedMappingTest extends TestCase
910
{
1011
public function test()
1112
{

test/Integration/Mapper/CollectionMapperTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\AnonymousMapping;
56
use ScriptFUSION\Mapper\CollectionMapper;
67
use ScriptFUSION\Mapper\InvalidRecordException;
78

8-
final class CollectionMapperTest extends \PHPUnit_Framework_TestCase
9+
final class CollectionMapperTest extends TestCase
910
{
1011
/** @var CollectionMapper */
1112
private $mapper;
1213

13-
protected function setUp()
14+
protected function setUp(): void
1415
{
1516
$this->mapper = new CollectionMapper;
1617
}
@@ -20,7 +21,7 @@ protected function setUp()
2021
*/
2122
public function testMapInvalidCollection()
2223
{
23-
$this->setExpectedException(InvalidRecordException::class);
24+
$this->expectException(InvalidRecordException::class);
2425

2526
$this->mapper->mapCollection(new \ArrayIterator(['foo']))->valid();
2627
}

test/Integration/Mapper/MapperTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
namespace ScriptFUSIONTest\Integration\Mapper;
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
5+
use PHPUnit\Framework\TestCase;
56
use ScriptFUSION\Mapper\AnonymousMapping;
67
use ScriptFUSION\Mapper\InvalidExpressionException;
78
use ScriptFUSION\Mapper\Mapper;
89
use ScriptFUSION\Mapper\MapperAware;
910
use ScriptFUSION\Mapper\Strategy\Copy;
1011
use ScriptFUSION\Mapper\Strategy\Strategy;
1112

12-
final class MapperTest extends \PHPUnit_Framework_TestCase
13+
final class MapperTest extends TestCase
1314
{
1415
use MockeryPHPUnitIntegration;
1516

1617
/** @var Mapper */
1718
private $mapper;
1819

19-
protected function setUp()
20+
protected function setUp(): void
2021
{
2122
$this->mapper = new Mapper;
2223
}
@@ -75,7 +76,7 @@ public function testMapNull()
7576

7677
public function testMapInvalidObject()
7778
{
78-
$this->setExpectedException(InvalidExpressionException::class);
79+
$this->expectException(InvalidExpressionException::class);
7980

8081
$this->mapper->map([], (object)[]);
8182
}

test/Integration/Mapper/MappingTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\AnonymousMapping;
56
use ScriptFUSION\Mapper\InvalidMappingException;
67
use ScriptFUSION\Mapper\Mapping;
78
use ScriptFUSION\Mapper\Strategy\Strategy;
89

9-
final class MappingTest extends \PHPUnit_Framework_TestCase
10+
final class MappingTest extends TestCase
1011
{
1112
public function testArrayBasedMapping()
1213
{
@@ -26,7 +27,7 @@ public function testStrategyBasedMapping()
2627

2728
public function testInvalidMapping()
2829
{
29-
$this->setExpectedException(InvalidMappingException::class);
30+
$this->expectException(InvalidMappingException::class);
3031

3132
new AnonymousMapping(\Mockery::mock(Mapping::class));
3233
}

test/Integration/Mapper/Strategy/CollectionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Mapper;
56
use ScriptFUSION\Mapper\Strategy\Collection;
67
use ScriptFUSION\Mapper\Strategy\CopyContext;
78
use ScriptFUSIONTest\MockFactory;
89

9-
final class CollectionTest extends \PHPUnit_Framework_TestCase
10+
final class CollectionTest extends TestCase
1011
{
1112
public function testNull()
1213
{

test/Integration/Mapper/Strategy/ContextTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
5+
use PHPUnit\Framework\TestCase;
56
use ScriptFUSION\Mapper\Mapper;
67
use ScriptFUSION\Mapper\Strategy\Context;
78
use ScriptFUSION\Mapper\Strategy\Strategy;
89

9-
final class ContextTest extends \PHPUnit_Framework_TestCase
10+
final class ContextTest extends TestCase
1011
{
1112
use MockeryPHPUnitIntegration;
1213

test/Integration/Mapper/Strategy/CopyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Mapper;
56
use ScriptFUSION\Mapper\Strategy\Copy;
67

7-
final class CopyTest extends \PHPUnit_Framework_TestCase
8+
final class CopyTest extends TestCase
89
{
910
public function testFixedPath()
1011
{

test/Integration/Mapper/Strategy/DebugTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy {
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Mapper;
56
use ScriptFUSION\Mapper\Strategy\Copy;
67
use ScriptFUSION\Mapper\Strategy\Debug;
78

8-
final class DebugTest extends \PHPUnit_Framework_TestCase
9+
final class DebugTest extends TestCase
910
{
1011
public static $debugged;
1112

12-
protected function setUp()
13+
protected function setUp(): void
1314
{
1415
self::$debugged = false;
1516
}
@@ -19,7 +20,7 @@ protected function setUp()
1920
*/
2021
public function testNoArguments()
2122
{
22-
new Debug;
23+
self::assertInstanceOf(Debug::class, new Debug);
2324
}
2425

2526
/**

test/Integration/Mapper/Strategy/EitherTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
55
use Mockery\MockInterface;
6+
use PHPUnit\Framework\TestCase;
67
use ScriptFUSION\Mapper\Mapper;
78
use ScriptFUSION\Mapper\Strategy\Either;
89
use ScriptFUSION\Mapper\Strategy\Strategy;
910

10-
final class EitherTest extends \PHPUnit_Framework_TestCase
11+
final class EitherTest extends TestCase
1112
{
1213
use MockeryPHPUnitIntegration;
1314

@@ -17,7 +18,7 @@ final class EitherTest extends \PHPUnit_Framework_TestCase
1718
/** @var MockInterface */
1819
private $strategy;
1920

20-
protected function setUp()
21+
protected function setUp(): void
2122
{
2223
$this->either = (new Either($this->strategy = \Mockery::spy(Strategy::class), 'bar'))->setMapper(new Mapper);
2324
}

test/Integration/Mapper/Strategy/IfElseTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\InvalidConditionException;
56
use ScriptFUSION\Mapper\Mapper;
67
use ScriptFUSION\Mapper\Strategy\IfElse;
78

8-
final class IfElseTest extends \PHPUnit_Framework_TestCase
9+
final class IfElseTest extends TestCase
910
{
1011
private $condition;
1112

12-
public function setUp()
13+
public function setUp(): void
1314
{
1415
$this->condition = function ($data) {
1516
return array_key_exists('baz', $data) && $data['baz'] === 'qux';
@@ -36,7 +37,7 @@ public function testOnlyIf()
3637

3738
public function testStrictness()
3839
{
39-
$this->setExpectedException(InvalidConditionException::class);
40+
$this->expectException(InvalidConditionException::class);
4041

4142
$ifElse = (new IfElse(
4243
function () {

test/Integration/Mapper/Strategy/IfExistsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
5+
use PHPUnit\Framework\TestCase;
56
use ScriptFUSION\Mapper\Mapper;
67
use ScriptFUSION\Mapper\Strategy\IfExists;
78
use ScriptFUSION\Mapper\Strategy\Strategy;
89

9-
final class IfExistsTest extends \PHPUnit_Framework_TestCase
10+
final class IfExistsTest extends TestCase
1011
{
1112
use MockeryPHPUnitIntegration;
1213

test/Integration/Mapper/Strategy/JoinTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
namespace ScriptFUSIONTest\Integration\Mapper\Strategy;
33

44
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
5+
use PHPUnit\Framework\TestCase;
56
use ScriptFUSION\Mapper\Mapper;
67
use ScriptFUSION\Mapper\Strategy\Join;
78
use ScriptFUSION\Mapper\Strategy\Strategy;
89

9-
final class JoinTest extends \PHPUnit_Framework_TestCase
10+
final class JoinTest extends TestCase
1011
{
1112
use MockeryPHPUnitIntegration;
1213

test/Integration/Mapper/Strategy/TryCatchTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Mapper\Strategy;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Mapper;
56
use ScriptFUSION\Mapper\Strategy\Callback;
67
use ScriptFUSION\Mapper\Strategy\TryCatch;
78

8-
final class TryCatchTest extends \PHPUnit_Framework_TestCase
9+
final class TryCatchTest extends TestCase
910
{
1011
private $callback;
1112

12-
protected function setUp()
13+
protected function setUp(): void
1314
{
1415
$this->callback = new Callback(function (array $data) {
1516
if ($data[0] instanceof \Exception) {
@@ -40,7 +41,7 @@ function (\Exception $exception, array $data) {
4041
self::assertSame($data = ['foo'], $tryCatch($data));
4142
self::assertSame($fallback, $tryCatch([new \DomainException]));
4243

43-
$this->setExpectedException(\RuntimeException::class);
44+
$this->expectException(\RuntimeException::class);
4445
$tryCatch([new \RuntimeException]);
4546
}
4647

@@ -71,7 +72,7 @@ function (\Exception $exception) {
7172
self::assertSame($innerFallback, $tryCatch([new \DomainException]));
7273
self::assertSame($outerFallback, $tryCatch([new \LogicException]));
7374

74-
$this->setExpectedException(\RuntimeException::class);
75+
$this->expectException(\RuntimeException::class);
7576
$tryCatch([new \RuntimeException]);
7677
}
7778
}

test/Unit/Mapper/DecoratorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Mapper;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Strategy\Strategy;
56
use ScriptFUSIONTest\DecoratorStub;
67

7-
final class DecoratorTest extends \PHPUnit_Framework_TestCase
8+
final class DecoratorTest extends TestCase
89
{
910
public function testGetStrategy()
1011
{

test/Unit/Mapper/MapperAwareTraitTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Mapper;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Mapper;
56
use ScriptFUSIONTest\MapperAwareStub;
67

7-
final class MapperAwareTraitTest extends \PHPUnit_Framework_TestCase
8+
final class MapperAwareTraitTest extends TestCase
89
{
910
public function testGetMapper()
1011
{

test/Unit/Mapper/Strategy/CallbackTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace ScriptFUSIONTest\Unit\Mapper\Strategy;
33

4+
use PHPUnit\Framework\TestCase;
45
use ScriptFUSION\Mapper\Strategy\Callback;
56

6-
final class CallbackTest extends \PHPUnit_Framework_TestCase
7+
final class CallbackTest extends TestCase
78
{
89
public function test()
910
{

0 commit comments

Comments
 (0)