Skip to content

Commit

Permalink
Merge pull request #4 from olivervogel/main
Browse files Browse the repository at this point in the history
PHPUnit 10 Shift (#1)
  • Loading branch information
olivervogel committed Feb 28, 2024
2 parents abcacc9 + 53b1ab6 commit 6333dc0
Show file tree
Hide file tree
Showing 33 changed files with 114 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ composer.lock
vendor/
dev/
.idea/
.phpunit.result.cache
/.phpunit.cache
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"name": "intervention/mimesniffer",
"description": "PHP MIME Type Sniffer",
"homepage": "http://intervention.io/",
"keywords": ["mime", "type", "sniffer", "detector"],
"keywords": [
"mime",
"type",
"sniffer",
"detector"
],
"license": "MIT",
"authors": [
{
Expand All @@ -15,7 +20,7 @@
"php": "^7.3|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^10.0",
"phpstan/phpstan": "^1"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
tests:
build: ./
working_dir: /project
command: bash -c "composer install && ./vendor/bin/phpunit -vvv"
command: bash -c "composer install && ./vendor/bin/phpunit"
volumes:
- ./:/project
analysis:
Expand Down
17 changes: 0 additions & 17 deletions phpunit.xml

This file was deleted.

8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
6 changes: 3 additions & 3 deletions tests/AbstractBinaryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use PHPUnit\Framework\TestCase;
use Intervention\MimeSniffer\AbstractBinaryType;

class AbstractBinaryTypeTest extends TestCase
final class AbstractBinaryTypeTest extends TestCase
{
public function testPrepareContent()
public function testPrepareContent(): void
{
$content = '';
for ($i = 0; $i < 2048; $i++) {
Expand All @@ -19,7 +19,7 @@ public function testPrepareContent()
$this->assertEquals('78787878', substr($type->prepareContent($content), 0, 8));
}

public function testIsBinary()
public function testIsBinary(): void
{
$type = $this->getMockForAbstractClass(AbstractBinaryType::class);
$this->assertTrue($type->isBinary());
Expand Down
12 changes: 6 additions & 6 deletions tests/AbstractTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
use PHPUnit\Framework\TestCase;
use Intervention\MimeSniffer\AbstractType;

class AbstractTypeTest extends TestCase
final class AbstractTypeTest extends TestCase
{
public function testToString()
public function testToString(): void
{
$type = $this->getMockForAbstractClass(AbstractType::class);
$this->assertEquals('', $type);
}

public function testMatches()
public function testMatches(): void
{
$type = $this->getMockForAbstractClass(AbstractType::class);
$this->assertFalse($type->matches('test'));
}

public function testIsImage()
public function testIsImage(): void
{
$type = $this->getMockForAbstractClass(AbstractType::class);
$this->assertFalse($type->isImage());
}

public function testPrepareContent()
public function testPrepareContent(): void
{
$content = '';
for ($i = 0; $i < 2048; $i++) {
Expand All @@ -36,7 +36,7 @@ public function testPrepareContent()
$this->assertEquals(1024, strlen($type->prepareContent($content)));
}

public function testIsBinary()
public function testIsBinary(): void
{
$type = $this->getMockForAbstractClass(AbstractType::class);
$this->assertFalse($type->isBinary());
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationGzipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationGzip;

class ApplicationGzipTest extends TestCase
final class ApplicationGzipTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationGzip::class, $this->type);
}

public function testIsImage()
public function testIsImage(): void
{
$this->assertFalse($this->type->isImage());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationOggTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationOgg;

class ApplicationOggTest extends TestCase
final class ApplicationOggTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationOgg::class, $this->type);
}

public function testIsImage()
public function testIsImage(): void
{
$this->assertFalse($this->type->isImage());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationPdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationPdf;

class ApplicationPdfTest extends TestCase
final class ApplicationPdfTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationPdf::class, $this->type);
}

public function testIsImage()
public function testIsImage(): void
{
$this->assertFalse($this->type->isImage());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationRarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationRar;

class ApplicationRarTest extends TestCase
final class ApplicationRarTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationRar::class, $this->type);
}

public function testIsArchive()
public function testIsArchive(): void
{
$this->assertTrue($this->type->isArchive());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ApplicationSqliteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationSqlite;

class ApplicationSqliteTest extends TestCase
final class ApplicationSqliteTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,7 +17,7 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationSqlite::class, $this->type);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationTarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationTar;

class ApplicationTarTest extends TestCase
final class ApplicationTarTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationTar::class, $this->type);
}

public function testIsArchive()
public function testIsArchive(): void
{
$this->assertTrue($this->type->isArchive());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ApplicationZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ApplicationZip;

class ApplicationZipTest extends TestCase
final class ApplicationZipTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ApplicationZip::class, $this->type);
}

public function testIsArchive()
public function testIsArchive(): void
{
$this->assertTrue($this->type->isArchive());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/AudioFlacTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\AudioFlac;

class AudioFlacTest extends TestCase
final class AudioFlacTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(AudioFlac::class, $this->type);
}

public function testIsImage()
public function testIsImage(): void
{
$this->assertFalse($this->type->isImage());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/AudioMpegId3v2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\AudioMpeg;

class AudioMpegId3v2Test extends TestCase
final class AudioMpegId3v2Test extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(AudioMpeg::class, $this->type);
}

public function testIsAudio()
public function testIsAudio(): void
{
$this->assertTrue($this->type->isAudio());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/AudioMpegTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\AudioMpeg;

class AudioMpegTest extends TestCase
final class AudioMpegTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(AudioMpeg::class, $this->type);
}

public function testIsAudio()
public function testIsAudio(): void
{
$this->assertTrue($this->type->isAudio());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/ImageAvifTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Intervention\MimeSniffer\MimeSniffer;
use Intervention\MimeSniffer\Types\ImageAvif;

class ImageAvifTest extends TestCase
final class ImageAvifTest extends TestCase
{
public $sniffer;
public $type;
Expand All @@ -17,12 +17,12 @@ protected function setUp(): void
$this->type = $this->sniffer->getType();
}

public function testType()
public function testType(): void
{
$this->assertInstanceOf(ImageAvif::class, $this->type);
}

public function testIsImage()
public function testIsImage(): void
{
$this->assertTrue($this->type->isImage());
}
Expand Down
Loading

0 comments on commit 6333dc0

Please sign in to comment.