Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Compatible with phpunit 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Moon committed Oct 7, 2019
1 parent 924b82e commit 204c2ce
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 65 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ composer.phar
composer.lock
.DS_Store
Thumbs.db
.idea
.idea
.phpunit.result.cache
62 changes: 33 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
{
"name": "infinity-next/sleuth",
"keywords": ["file", "type", "mime", "detection", "laravel"],
"license": "MIT",
"type": "library",

"authors": [
{
"name": "Joshua Moon",
"email": "josh@jaw.sh",
"homepage": "https://jaw.sh"
}
],

"require": {
"php": ">=5.4.0",
"enshrined/svg-sanitize": "0.2.*",
"illuminate/support": "5.*"
},

"require-dev": {
"mockery/mockery": "~0.9",
"phpunit/phpunit": "~4.0"

},
"autoload": {
"psr-4": {
"InfinityNext\\Sleuth\\": "src/"
}
}
"name": "infinity-next/sleuth",
"keywords": ["file", "type", "mime", "detection", "laravel"],
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Joshua Moon",
"email": "josh@jaw.sh",
"homepage": "https://jaw.sh"
}
],
"require": {
"php": "^7.2",
"enshrined/svg-sanitize": "0.10.*",
"illuminate/support": "6.*"
},
"require-dev": {
"mockery/mockery": "^1.2.3",
"phpunit/phpunit": "^8.0"

},
"autoload": {
"psr-4": {
"InfinityNext\\Sleuth\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"InfinityNext\\Sleuth\\Eightdown\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
8 changes: 7 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>

<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
</listeners>
Expand Down
8 changes: 5 additions & 3 deletions tests/AppEPUBTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

class AppEPUBTest extends PHPUnit_Framework_TestCase
use \PHPUnit\Framework\TestCase;

class AppEPUBTest extends TestCase
{


}
8 changes: 5 additions & 3 deletions tests/AppPDFTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

class AppPDFTest extends PHPUnit_Framework_TestCase
use \PHPUnit\Framework\TestCase;

class AppPDFTest extends TestCase
{


}
3 changes: 2 additions & 1 deletion tests/AppSWFTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ImageGDDetective as FlashDetective;
use \PHPUnit\Framework\TestCase;

class AppSWFTest extends PHPUnit_Framework_TestCase
class AppSWFTest extends TestCase
{
public function testSWF()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/AudioOGGTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as AudioDetective;
use \PHPUnit\Framework\TestCase;

class AudioOGGTest extends PHPUnit_Framework_TestCase
class AudioOGGTest extends TestCase
{
public function testOGG()
{
Expand Down
8 changes: 5 additions & 3 deletions tests/DocTXTTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

class DocTXTTest extends PHPUnit_Framework_TestCase
use \PHPUnit\Framework\TestCase;

class DocTXTTest extends TestCase
{


}
11 changes: 6 additions & 5 deletions tests/ImageGIFTest.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<?php

use \InfinityNext\Sleuth\Detectives\ImageGDDetective as ImageDetective;
use \PHPUnit\Framework\TestCase;

class ImageGIFTest extends PHPUnit_Framework_TestCase
class ImageGIFTest extends TestCase
{
public function testGood()
{
$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/normal.gif");
$this->assertEquals('gif', $detective->getExtension());

$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/animated.gif");
$this->assertEquals('gif', $detective->getExtension());
}

public function testBad()
{
$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/normal.png");
$this->assertNotEquals('gif', $detective->getExtension());
}

/**
* @expectedException \InfinityNext\Sleuth\Exceptions\CaseNotSolved
* @expectException \InfinityNext\Sleuth\Exceptions\CaseNotSolved
*/
public function testException()
{
Expand Down
7 changes: 4 additions & 3 deletions tests/ImageJPGTest.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php

use \InfinityNext\Sleuth\Detectives\ImageGDDetective as ImageDetective;
use \PHPUnit\Framework\TestCase;

class ImageJPGTest extends PHPUnit_Framework_TestCase
class ImageJPGTest extends TestCase
{
public function testGood()
{
$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/normal.jpg");
$this->assertEquals('jpg', $detective->getExtension());
}

public function testBad()
{
$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/normal.png");
$this->assertNotEquals('jpg', $detective->getExtension());

$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/png.jpg");
$this->assertNotEquals('jpg', $detective->getExtension());
Expand Down
7 changes: 4 additions & 3 deletions tests/ImagePNGTest.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?php

use \InfinityNext\Sleuth\Detectives\ImageGDDetective as ImageDetective;
use \PHPUnit\Framework\TestCase;

class ImagePNGTest extends PHPUnit_Framework_TestCase
class ImagePNGTest extends TestCase
{
public function testGood()
{
$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/normal.png");
$this->assertEquals('png', $detective->getExtension());

$detective = new ImageDetective;
$detective->check(__DIR__ . "/files/png.jpg");
$this->assertEquals('png', $detective->getExtension());
}

public function testBad()
{
$detective = new ImageDetective;
Expand Down
9 changes: 5 additions & 4 deletions tests/MarkupSVGTest.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?php

use InfinityNext\Sleuth\Detectives\svgDetective as MarkupDetective;
use \PHPUnit\Framework\TestCase;

class MarkupSVGTest extends PHPUnit_Framework_TestCase
class MarkupSVGTest extends TestCase
{
public function testGood()
{
$detective = new MarkupDetective;
$detective->check(__DIR__ . "/files/normal.svg");
$this->assertEquals('svg', $detective->getExtension());
}

/**
* @expectedException \InfinityNext\Sleuth\Exceptions\CaseNotSolved
* @expectException \InfinityNext\Sleuth\Exceptions\CaseNotSolved
*/
public function testException()
{
$detective = new MarkupDetective;
$detective->check(__DIR__ . "/files/normal.png");
$detective->getExtension();
}
}
}
7 changes: 4 additions & 3 deletions tests/SleuthTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use InfinityNext\Sleuth\FileSleuth;
use \PHPUnit\Framework\TestCase;

class SleuthTest extends PHPUnit_Framework_TestCase
class SleuthTest extends TestCase
{
public function testSleuth()
{
Expand All @@ -11,12 +12,12 @@ public function testSleuth()
'mp4' => __DIR__ . "/files/normal.mp4",
'svg' => __DIR__ . "/files/normal.svg",
];

foreach ($files as $ext => $file)
{
$sleuth = new FileSleuth($file);
$case = $sleuth->check($file);

$this->assertEquals($ext, $case->getExtension());
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Video3GPTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as VideoDetective;
use \PHPUnit\Framework\TestCase;

class Video3GPTest extends PHPUnit_Framework_TestCase
class Video3GPTest extends TestCase
{
public function test3GP()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/VideoFLVTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as VideoDetective;
use \PHPUnit\Framework\TestCase;

class VideoFLVTest extends PHPUnit_Framework_TestCase
class VideoFLVTest extends TestCase
{
public function testFLV()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/VideoMP4Test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as VideoDetective;
use \PHPUnit\Framework\TestCase;

class VideoMP4Test extends PHPUnit_Framework_TestCase
class VideoMP4Test extends TestCase
{
public function testMP4()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/VideoOGGTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as VideoDetective;
use \PHPUnit\Framework\TestCase;

class VideoOGGTest extends PHPUnit_Framework_TestCase
class VideoOGGTest extends TestCase
{
public function testGood()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/VideoWEBMTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use \InfinityNext\Sleuth\Detectives\ffmpegDetective as VideoDetective;
use \PHPUnit\Framework\TestCase;

class VideoWEBMTest extends PHPUnit_Framework_TestCase
class VideoWEBMTest extends TestCase
{
public function testGood()
{
Expand Down

0 comments on commit 204c2ce

Please sign in to comment.