Skip to content

Commit d0d3232

Browse files
committed
allow symfony 4 or higher, use phpunit 9.5, raise minimum php version to 7.4, remove sensiolabs insight
1 parent 4f9fe8b commit d0d3232

19 files changed

+71
-65
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: php
22

33
php:
4-
- 7.1
4+
- 7.4
5+
- 8.0
56
- nightly
67

78
matrix:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Transcoder Library
22
==================
33

4-
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/101113a8-06da-4547-aae8-cc9c77027c5b/mini.png)](https://insight.sensiolabs.com/projects/101113a8-06da-4547-aae8-cc9c77027c5b)
54
[![Build Status](https://travis-ci.org/brainbits/transcoder.png?branch=master)](https://travis-ci.org/brainbits/transcoder)
65
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/brainbits/transcoder/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/brainbits/transcoder/?branch=master)
76
[![Scrutinizer Code Coverage](https://scrutinizer-ci.com/g/brainbits/transcoder/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/brainbits/transcoder/?branch=master)

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
}
2020
],
2121
"require": {
22-
"php": "^7.1",
22+
"php": ">=7.4",
2323
"psr/log": "^1.0",
24-
"symfony/process": "^2.8|^3.0"
24+
"symfony/process": ">=4.0"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^6.0"
27+
"phpunit/phpunit": "^9.5",
28+
"phpspec/prophecy-phpunit": "^2.0"
2829
},
2930
"autoload": {
3031
"psr-4": { "Brainbits\\Transcoder\\": "src/" }

src/Decoder/SevenzDecoder.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Brainbits\Transcoder\Exception\DecodeFailedException;
1717
use Symfony\Component\Process\Process;
18-
use Symfony\Component\Process\ProcessBuilder;
1918

2019
/**
2120
* 7z decoder.
@@ -57,11 +56,11 @@ public function supports(?string $type): bool
5756

5857
private function getProcess(string $data): Process
5958
{
60-
$processBuilder = new ProcessBuilder(
59+
$process = new Process(
6160
[$this->executable, 'e', '-si', '-so', '-an', '-txz', '-m0=lzma2', '-mx=9', '-mfb=64', '-md=32m']
6261
);
63-
$processBuilder->setInput($data);
62+
$process->setInput($data);
6463

65-
return $processBuilder->getProcess();
64+
return $process;
6665
}
6766
}

src/Encoder/SevenzEncoder.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Brainbits\Transcoder\Exception\EncodeFailedException;
1717
use Symfony\Component\Process\Process;
18-
use Symfony\Component\Process\ProcessBuilder;
1918

2019
/**
2120
* 7z encoder.
@@ -57,11 +56,11 @@ public function supports(?string $type): bool
5756

5857
private function getProcess(string $data): Process
5958
{
60-
$processBuilder = new ProcessBuilder(
59+
$process = new Process(
6160
[$this->executable, 'a', '-si', '-so', '-an', '-txz', '-m0=lzma2', '-mx=9', '-mfb=64', '-md=32m']
6261
);
63-
$processBuilder->setInput($data);
62+
$process->setInput($data);
6463

65-
return $processBuilder->getProcess();
64+
return $process;
6665
}
6766
}

tests/Decoder/Bzip2DecoderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class Bzip2DecoderTest extends TestCase
2525
*/
2626
private $decoder;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
$this->decoder = new Bzip2Decoder();
3131
}
3232

33-
public function testDecode()
33+
public function testDecode(): void
3434
{
3535
$testString = 'a string to be decompressed';
3636
$encodedString = bzcompress($testString);
@@ -40,7 +40,7 @@ public function testDecode()
4040
$this->assertSame($testString, $result);
4141
}
4242

43-
public function testDecodeThrowsErrorOnEmptyResult()
43+
public function testDecodeThrowsErrorOnEmptyResult(): void
4444
{
4545
$this->expectException(DecodeFailedException::class);
4646

@@ -52,7 +52,7 @@ public function testDecodeThrowsErrorOnEmptyResult()
5252
$this->assertSame($testString, $result);
5353
}
5454

55-
public function testDecodeError()
55+
public function testDecodeError(): void
5656
{
5757
$this->expectException(DecodeFailedException::class);
5858

@@ -61,7 +61,7 @@ public function testDecodeError()
6161
$this->decoder->decode($testString);
6262
}
6363

64-
public function testSupports()
64+
public function testSupports(): void
6565
{
6666
$this->assertTrue($this->decoder->supports('bzip2'));
6767
$this->assertFalse($this->decoder->supports('foo'));

tests/Decoder/DecoderResolverTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Brainbits\Transcoder\Decoder\DecoderResolver;
1616
use Brainbits\Transcoder\Tests\TranscoderTestHelper;
1717
use PHPUnit\Framework\TestCase;
18+
use Prophecy\PhpUnit\ProphecyTrait;
1819
use Prophecy\Prophecy\ObjectProphecy;
1920
use RuntimeException;
2021

@@ -23,12 +24,13 @@
2324
*/
2425
class DecoderResolverTest extends TestCase
2526
{
27+
use ProphecyTrait;
2628
use TranscoderTestHelper;
2729

2830
/**
2931
* @expectedException RuntimeException
3032
*/
31-
public function testResolveThrowsRuntimeExceptionWithoutDecoders()
33+
public function testResolveThrowsRuntimeExceptionWithoutDecoders(): void
3234
{
3335
$this->expectException(RuntimeException::class);
3436

@@ -37,11 +39,10 @@ public function testResolveThrowsRuntimeExceptionWithoutDecoders()
3739
$resolver->resolve('test');
3840
}
3941

40-
/**
41-
* @expectedException RuntimeException
42-
*/
43-
public function testResolveRuntimeExceptionWithoutMatchingDecoder()
42+
public function testResolveRuntimeExceptionWithoutMatchingDecoder(): void
4443
{
44+
$this->expectException(RuntimeException::class);
45+
4546
$decoder = $this->prophesizeDecoder();
4647
$decoder->supports('test')
4748
->shouldBeCalled()
@@ -52,7 +53,7 @@ public function testResolveRuntimeExceptionWithoutMatchingDecoder()
5253
$resolver->resolve('test');
5354
}
5455

55-
public function testResolveReturnsCorrectDecoder()
56+
public function testResolveReturnsCorrectDecoder(): void
5657
{
5758
$decoder = $this->prophesizeDecoder();
5859
$decoder->supports('test')

tests/Decoder/DeflateDecoderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class DeflateDecoderTest extends TestCase
2525
*/
2626
private $decoder;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
$this->decoder = new DeflateDecoder();
3131
}
3232

33-
public function testDecode()
33+
public function testDecode(): void
3434
{
3535
$testString = 'a string to be decompressed';
3636
$encodedString = gzdeflate($testString);
@@ -40,7 +40,7 @@ public function testDecode()
4040
$this->assertSame($testString, $result);
4141
}
4242

43-
public function testDecodeThrowsErrorOnEmptyResult()
43+
public function testDecodeThrowsErrorOnEmptyResult(): void
4444
{
4545
$this->expectException(DecodeFailedException::class);
4646

@@ -52,7 +52,7 @@ public function testDecodeThrowsErrorOnEmptyResult()
5252
$this->assertSame($testString, $result);
5353
}
5454

55-
public function testSupports()
55+
public function testSupports(): void
5656
{
5757
$this->assertTrue($this->decoder->supports('deflate'));
5858
$this->assertFalse($this->decoder->supports('foo'));

tests/Decoder/GzipDecoderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class GzipDecoderTest extends TestCase
2525
*/
2626
private $decoder;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
$this->decoder = new GzipDecoder();
3131
}
3232

33-
public function testDecode()
33+
public function testDecode(): void
3434
{
3535
$testString = 'a string to be decompressed';
3636
$encodedString = gzencode($testString);
@@ -40,7 +40,7 @@ public function testDecode()
4040
$this->assertSame($testString, $result);
4141
}
4242

43-
public function testDecodeThrowsErrorOnEmptyResult()
43+
public function testDecodeThrowsErrorOnEmptyResult(): void
4444
{
4545
$this->expectException(DecodeFailedException::class);
4646

@@ -52,7 +52,7 @@ public function testDecodeThrowsErrorOnEmptyResult()
5252
$this->assertSame($testString, $result);
5353
}
5454

55-
public function testSupports()
55+
public function testSupports(): void
5656
{
5757
$this->assertTrue($this->decoder->supports('gzip'));
5858
$this->assertFalse($this->decoder->supports('foo'));

tests/Decoder/NullDecoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class NullDecoderTest extends TestCase
2424
*/
2525
private $decoder;
2626

27-
protected function setUp()
27+
protected function setUp(): void
2828
{
2929
$this->decoder = new NullDecoder();
3030
}
3131

32-
public function testDecode()
32+
public function testDecode(): void
3333
{
3434
$testString = 'a string to be decompressed';
3535

@@ -38,7 +38,7 @@ public function testDecode()
3838
$this->assertSame($testString, $result);
3939
}
4040

41-
public function testSupports()
41+
public function testSupports(): void
4242
{
4343
$this->assertTrue($this->decoder->supports('null'));
4444
$this->assertTrue($this->decoder->supports(null));

tests/Decoder/SevenzDecoderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@
2020
*/
2121
class SevenzDecoderTest extends TestCase
2222
{
23-
public function testEmptyConstructor()
23+
public function testEmptyConstructor(): void
2424
{
2525
$decoder = new SevenzDecoder();
2626

2727
$this->assertSame('7z', $decoder->getExecutable());
2828
}
2929

30-
public function testExecutable()
30+
public function testExecutable(): void
3131
{
3232
$decoder = new SevenzDecoder('foo');
3333

3434
$this->assertSame('foo', $decoder->getExecutable());
3535
}
3636

37-
public function testSupports()
37+
public function testSupports(): void
3838
{
3939
$decoder = new SevenzDecoder();
4040

4141
$this->assertTrue($decoder->supports('7z'));
4242
$this->assertFalse($decoder->supports('foo'));
4343
}
4444

45-
public function testDecode()
45+
public function testDecode(): void
4646
{
4747
$rc = null;
4848
$out = null;
@@ -65,7 +65,7 @@ public function testDecode()
6565
/**
6666
* @depends testDecode
6767
*/
68-
public function testFail()
68+
public function testFail(): void
6969
{
7070
$this->expectException(DecodeFailedException::class);
7171

tests/Encoder/Bzip2EncoderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Bzip2EncoderTest extends TestCase
2424
*/
2525
private $encoder;
2626

27-
protected function setUp()
27+
protected function setUp(): void
2828
{
2929
$this->encoder = new Bzip2Encoder();
3030
}

tests/Encoder/DeflateEncoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class DeflateEncoderTest extends TestCase
2424
*/
2525
private $encoder;
2626

27-
protected function setUp()
27+
protected function setUp(): void
2828
{
2929
$this->encoder = new DeflateEncoder();
3030
}
3131

32-
public function testEncode()
32+
public function testEncode(): void
3333
{
3434
$testString = 'a string to be compressed';
3535

@@ -40,7 +40,7 @@ public function testEncode()
4040
$this->assertSame($testString, $uncompressedResult);
4141
}
4242

43-
public function testSupports()
43+
public function testSupports(): void
4444
{
4545
$this->assertTrue($this->encoder->supports('deflate'));
4646
$this->assertFalse($this->encoder->supports('foo'));

tests/Encoder/EncoderResolverTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515
use Brainbits\Transcoder\Encoder\EncoderResolver;
1616
use Brainbits\Transcoder\Tests\TranscoderTestHelper;
1717
use PHPUnit\Framework\TestCase;
18+
use Prophecy\PhpUnit\ProphecyTrait;
1819
use RuntimeException;
1920

2021
/**
2122
* @covers \Brainbits\Transcoder\Encoder\EncoderResolver
2223
*/
2324
class EncoderResolverTest extends TestCase
2425
{
26+
use ProphecyTrait;
2527
use TranscoderTestHelper;
2628

27-
public function testResolveThrowsRuntimeExceptionWithoutDecoders()
29+
public function testResolveThrowsRuntimeExceptionWithoutDecoders(): void
2830
{
2931
$this->expectException(RuntimeException::class);
3032

@@ -33,7 +35,7 @@ public function testResolveThrowsRuntimeExceptionWithoutDecoders()
3335
$resolver->resolve('test');
3436
}
3537

36-
public function testResolveRuntimeExceptionWithoutMatchingDecoder()
38+
public function testResolveRuntimeExceptionWithoutMatchingDecoder(): void
3739
{
3840
$this->expectException(RuntimeException::class);
3941

@@ -47,7 +49,7 @@ public function testResolveRuntimeExceptionWithoutMatchingDecoder()
4749
$resolver->resolve('test');
4850
}
4951

50-
public function testResolveReturnsCorrectDecoder()
52+
public function testResolveReturnsCorrectDecoder(): void
5153
{
5254
$encoder = $this->prophesizeEncoder();
5355
$encoder->supports('test')

tests/Encoder/GzipEncoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class GzipEncoderTest extends TestCase
2424
*/
2525
private $encoder;
2626

27-
protected function setUp()
27+
protected function setUp(): void
2828
{
2929
$this->encoder = new GzipEncoder();
3030
}
3131

32-
public function testEncode()
32+
public function testEncode(): void
3333
{
3434
$testString = 'a string to be compressed';
3535

@@ -40,7 +40,7 @@ public function testEncode()
4040
$this->assertSame($testString, $uncompressedResult);
4141
}
4242

43-
public function testSupports()
43+
public function testSupports(): void
4444
{
4545
$this->assertTrue($this->encoder->supports('gzip'));
4646
$this->assertFalse($this->encoder->supports('foo'));

0 commit comments

Comments
 (0)