diff --git a/.github/workflows/runTests.yml b/.github/workflows/runTests.yml
index a833ef50..3d4f4827 100644
--- a/.github/workflows/runTests.yml
+++ b/.github/workflows/runTests.yml
@@ -16,11 +16,6 @@ jobs:
fail-fast: false
matrix:
php-versions:
- - '5.3'
- - '5.4'
- - '5.5'
- - '5.6'
- - '7.0'
- '7.1'
- '7.2'
- '7.3'
@@ -28,6 +23,8 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
+ - '8.3'
+ - '8.4'
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
@@ -61,15 +58,14 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- - name: Install dependencies for PHP < 8.0
- if: matrix.php-versions != '8.0' && matrix.php-versions != '8.1' && matrix.php-versions != '8.2'
- run: composer install --prefer-dist --no-progress
-
- - name: Install PHPUnit 8 for PHP 8
- if: matrix.php-versions == '8.0' || matrix.php-versions == '8.1' || matrix.php-versions == '8.2'
+ - name: Install dependencies
run: |
- composer require --dev phpunit/phpunit:8.5.17 --ignore-platform-reqs
- git apply --reject --whitespace=fix src/test/patches/php8-return-types.diff
+ composer install --prefer-dist --no-progress
+
+ - name: Run test suite
+ if: matrix.php-versions == '7.1'
+ run: composer run-script test -- --no-coverage
- name: Run test suite
+ if: matrix.php-versions > '7.1'
run: composer run-script test -- --coverage-text
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4ba58fe..c52bfda1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
-1.6.?? (2022-??-??)
+1.6.12 (2024-??-??)
+-------------------
+
+* Drop php 5 and 7.0 support as new versions enforced a syntax change that is not compatible with the old versions.
+
+1.6.11 (2022-07-26)
-------------------
* Add support for PHP 8.2's `$content` property in `vfsStreamWrapper`
diff --git a/composer.json b/composer.json
index 2f5b8a94..f729a8d3 100644
--- a/composer.json
+++ b/composer.json
@@ -17,10 +17,11 @@
"wiki": "https://github.com/bovigo/vfsStream/wiki"
},
"require": {
- "php": ">=5.3.0"
+ "php": ">=7.1.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5|^5.0"
+ "phpunit/phpunit": "^7.5||^8.5||^9.6",
+ "yoast/phpunit-polyfills": "^2.0"
},
"autoload": {
"psr-0": { "org\\bovigo\\vfs\\": "src/main/php" }
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e48588e4..56057d76 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
- printerClass="PHPUnit_TextUI_ResultPrinter"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
@@ -41,4 +40,4 @@
-
\ No newline at end of file
+
diff --git a/src/test/bootstrap.php b/src/test/bootstrap.php
index 8b1f8899..d4b3ba9b 100644
--- a/src/test/bootstrap.php
+++ b/src/test/bootstrap.php
@@ -12,34 +12,15 @@ class_alias('\PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase');
class_alias('PHPUnit\Framework\Error\Warning', 'PHPUnit_Framework_Error');
}
-if (!class_exists("PHPUnit_Util_ErrorHandler"))
-{
- class PHPUnit_Util_ErrorHandler {
- public static function handleError($errno, $errstr, $errfile, $errline)
- {
- $errorHandler = new \PHPUnit\Util\ErrorHandler(
- true,
- true,
- true,
- true
- );
-
- return $errorHandler($errno, $errstr, $errfile, $errline);
- }
- }
-}
-
-if (!class_exists("PHPUnit_TextUI_ResultPrinter"))
-{
- class PHPUnit_TextUI_ResultPrinter extends \PHPUnit\TextUI\ResultPrinter {}
-}
-
/**
* A modified version of PHPUnit's TestCase to rid ourselves of deprecation
* warnings since we're using two different versions of PHPUnit in this branch
* (PHPUnit 4 and 5).
*/
-class BC_PHPUnit_Framework_TestCase extends \PHPUnit_Framework_TestCase {
+class BC_PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase {
+
+ use \Yoast\PHPUnitPolyfills\Polyfills\AssertionRenames;
+
public function bc_expectException($exception)
{
if (method_exists($this, 'expectException')) {
@@ -63,22 +44,3 @@ public function bc_getMock($originalClassName, $methods = array(), array $argume
return parent::getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods, $proxyTarget);
}
}
-
-// The only deprecation warnings we need to ignore/handle are in PHP 7.4 so far
-if (PHP_VERSION_ID >= 70400) {
- function customErrorHandler($errno, $errstr, $errfile, $errline) {
- // We know about this deprecation warning exists and it's already been
- // fixed in the 2.x branch. For BC reasons in the 1.x branch, we'll
- // ignore this warning to let tests pass.
- if ($errno === E_DEPRECATED) {
- if ($errstr === "Function ReflectionType::__toString() is deprecated") {
- return true;
- }
- }
-
- // Any other error should be left up to PHPUnit to handle
- return \PHPUnit_Util_ErrorHandler::handleError($errno, $errstr, $errfile, $errline);
- }
-
- set_error_handler("customErrorHandler");
-}
diff --git a/src/test/patches/php8-return-types.diff b/src/test/patches/php8-return-types.diff
deleted file mode 100644
index 040906d7..00000000
--- a/src/test/patches/php8-return-types.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/vendor/phpunit/phpunit/src/Framework/TestCase.php b/vendor/phpunit/phpunit/src/Framework/TestCase.php
-index 1223ca0c8..b5725af4c 100644
---- a/vendor/phpunit/phpunit/src/Framework/TestCase.php
-+++ b/vendor/phpunit/phpunit/src/Framework/TestCase.php
-@@ -475,14 +475,14 @@ public static function tearDownAfterClass(): void
- /**
- * This method is called before each test.
- */
-- protected function setUp(): void
-+ protected function setUp()
- {
- }
-
- /**
- * This method is called after each test.
- */
-- protected function tearDown(): void
-+ protected function tearDown()
- {
- }
-
diff --git a/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php b/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php
index 4f30b038..6fcdf2ad 100644
--- a/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php
+++ b/src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php
@@ -20,7 +20,7 @@ class DirectoryIterationTestCase extends vfsStreamWrapperBaseTestCase
/**
* clean up test environment
*/
- public function tearDown()
+ public function tearDown(): void
{
vfsStream::enableDotfiles();
}
@@ -315,4 +315,4 @@ public function recursiveDirectoryIterationWithDotsDisabled()
$pathes
);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/php/org/bovigo/vfs/FilenameTestCase.php b/src/test/php/org/bovigo/vfs/FilenameTestCase.php
index 4b441306..678038f2 100644
--- a/src/test/php/org/bovigo/vfs/FilenameTestCase.php
+++ b/src/test/php/org/bovigo/vfs/FilenameTestCase.php
@@ -23,7 +23,7 @@ class FilenameTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
vfsStream::setup('root');
$this->rootDir = vfsStream::url('root');
@@ -53,11 +53,11 @@ public function worksWithCorrectName()
/**
* @test
- * @expectedException UnexpectedValueException
- * @expectedExceptionMessage ailed to open dir
*/
public function doesNotWorkWithInvalidName()
{
+ $this->expectException(\UnexpectedValueException::class);
+ $this->expectExceptionMessage('ailed to open dir');
$results = array();
$it = new \RecursiveDirectoryIterator($this->rootDir . '/lost found/');
foreach ($it as $f) {
diff --git a/src/test/php/org/bovigo/vfs/PermissionsTestCase.php b/src/test/php/org/bovigo/vfs/PermissionsTestCase.php
index e99a55a4..185be7ff 100644
--- a/src/test/php/org/bovigo/vfs/PermissionsTestCase.php
+++ b/src/test/php/org/bovigo/vfs/PermissionsTestCase.php
@@ -8,6 +8,8 @@
* @package org\bovigo\vfs
*/
namespace org\bovigo\vfs;
+use PHPUnit\Framework\Error;
+
/**
* Test for permissions related functionality.
*
@@ -23,7 +25,7 @@ class PermissionsTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setup()
+ public function setUp(): void
{
$structure = array('test_directory' => array('test.file' => ''));
$this->root = vfsStream::setup('root', null, $structure);
@@ -92,13 +94,14 @@ public function canNotChangeGroupWhenFileNotOwned()
/**
* @test
* @group issue_107
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Can not create new file in non-writable path root
* @requires PHP 5.4
* @since 1.5.0
*/
public function touchOnNonWriteableDirectoryTriggersError()
{
+ $this->expectException(Error\Warning::class);
+ $this->expectExceptionMessage('Can not create new file in non-writable path root');
+
$this->root->chmod(0555);
touch($this->root->url() . '/touch.txt');
}
diff --git a/src/test/php/org/bovigo/vfs/QuotaTestCase.php b/src/test/php/org/bovigo/vfs/QuotaTestCase.php
index 8c0f5b24..b56afd9d 100644
--- a/src/test/php/org/bovigo/vfs/QuotaTestCase.php
+++ b/src/test/php/org/bovigo/vfs/QuotaTestCase.php
@@ -25,7 +25,7 @@ class QuotaTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->quota = new Quota(10);
}
diff --git a/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php b/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php
index c9015e16..203f598b 100644
--- a/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php
+++ b/src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php
@@ -26,7 +26,7 @@ class LargeFileContentTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->largeFileContent = new LargeFileContent(100);
}
diff --git a/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php b/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php
index 137a0925..75fc3f96 100644
--- a/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php
+++ b/src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php
@@ -26,7 +26,7 @@ class StringBasedFileContentTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->stringBasedFileContent = new StringBasedFileContent('foobarbaz');
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php
index cd8e1a48..40a8b59a 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php
@@ -20,7 +20,7 @@ class vfsStreamBlockTestCase extends \BC_PHPUnit_Framework_TestCase
*/
protected $block;
- public function setUp()
+ public function setUp(): void
{
$this->block = new vfsStreamBlock('foo');
}
@@ -73,10 +73,10 @@ public function addStructure()
/**
* tests that a blank name for a block device throws an exception
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
*/
public function createWithEmptyName()
{
+ $this->expectException(vfsStreamException::class);
$structure = array(
'topLevel' => array(
'thisIsAFile' => 'file contents',
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php
index 934e014d..7698be03 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php
@@ -35,7 +35,7 @@ class vfsStreamContainerIteratorTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->dir = new vfsStreamDirectory('foo');
$this->mockChild1 = $this->bc_getMock('org\\bovigo\\vfs\\vfsStreamContent');
@@ -53,7 +53,7 @@ public function setUp()
/**
* clean up test environment
*/
- public function tearDown()
+ public function tearDown(): void
{
vfsStream::enableDotfiles();
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue134TestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue134TestCase.php
index c1c0dda8..3e825891 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue134TestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue134TestCase.php
@@ -22,7 +22,7 @@ class vfsStreamDirectoryIssue134TestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->rootDirectory = vfsStream::newDirectory('/');
$this->rootDirectory->addChild(vfsStream::newDirectory('var/log/app'));
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php
index fdf45b2c..1bf8661e 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php
@@ -25,7 +25,7 @@ class vfsStreamDirectoryIssue18TestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->rootDirectory = vfsStream::newDirectory('/');
$this->rootDirectory->addChild(vfsStream::newDirectory('var/log/app'));
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php
index 19ed51b8..68e1bee9 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php
@@ -23,7 +23,7 @@ class vfsStreamDirectoryTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->dir = new vfsStreamDirectory('foo');
}
@@ -32,10 +32,10 @@ public function setUp()
* assure that a directory seperator inside the name throws an exception
*
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
*/
public function invalidCharacterInName()
{
+ $this->expectException(vfsStreamException::class);
$dir = new vfsStreamDirectory('foo/bar');
}
@@ -72,10 +72,10 @@ public function rename()
* renaming the directory to an invalid name throws a vfsStreamException
*
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
*/
public function renameToInvalidNameThrowsvfsStreamException()
{
+ $this->expectException(vfsStreamException::class);
$this->dir->rename('foo/baz');
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php
index 66ad14d6..891ee1d4 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php
@@ -19,7 +19,7 @@ class vfsStreamExLockTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- protected function setUp()
+ public function setUp(): void
{
$root = vfsStream::setup();
vfsStream::newFile('testfile')->at($root);
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php
index 5b7ade6c..537bcbe3 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php
@@ -23,7 +23,7 @@ class vfsStreamFileTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->file = new vfsStreamFile('foo');
}
@@ -327,11 +327,11 @@ public function withContentAcceptsAnyFileContentInstance()
/**
* @test
* @group issue_79
- * @expectedException \InvalidArgumentException
* @since 1.3.0
*/
public function withContentThrowsInvalidArgumentExceptionWhenContentIsNoStringAndNoFileContent()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->file->withContent(313);
}
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php
index 74fb773b..7f0130c7 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php
@@ -26,7 +26,7 @@ class vfsStreamResolveIncludePathTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->backupIncludePath = get_include_path();
vfsStream::setup();
@@ -37,7 +37,7 @@ public function setUp()
/**
* clean up test environment
*/
- public function tearDown()
+ public function tearDown(): void
{
set_include_path($this->backupIncludePath);
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php
index cc2bad7a..38e1f0d1 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamTestCase.php
@@ -19,7 +19,7 @@ class vfsStreamTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
vfsStreamWrapper::register();
}
@@ -387,11 +387,11 @@ public function createArraysAreTurnedIntoSubdirectoriesOfRoot()
/**
* @test
* @group issue_20
- * @expectedException \InvalidArgumentException
* @since 0.11.0
*/
public function createThrowsExceptionIfNoBaseDirGivenAndNoRootSet()
{
+ $this->expectException(\InvalidArgumentException::class);
vfsStream::create(array('test' => array()));
}
@@ -566,11 +566,11 @@ public function inspectWithoutContentGivesRootToVisitor()
/**
* @test
* @group issue_10
- * @expectedException \InvalidArgumentException
* @since 0.10.0
*/
public function inspectWithoutContentAndWithoutRootThrowsInvalidArgumentException()
{
+ $this->expectException(\InvalidArgumentException::class);
$mockVisitor = $this->bc_getMock('org\\bovigo\\vfs\\visitor\\vfsStreamVisitor');
$mockVisitor->expects($this->never())
->method('visit');
@@ -592,11 +592,11 @@ protected function getFileSystemCopyDir()
/**
* @test
* @group issue_4
- * @expectedException \InvalidArgumentException
* @since 0.11.0
*/
public function copyFromFileSystemThrowsExceptionIfNoBaseDirGivenAndNoRootSet()
{
+ $this->expectException(\InvalidArgumentException::class);
vfsStream::copyFromFileSystem($this->getFileSystemCopyDir());
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php
index 62fc2e12..2747399b 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php
@@ -20,7 +20,7 @@ class vfsStreamUmaskTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
vfsStream::umask(0000);
}
@@ -28,7 +28,7 @@ public function setUp()
/**
* clean up test environment
*/
- public function tearDown()
+ public function tearDown(): void
{
vfsStream::umask(0000);
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php
index 279a2cee..786c3b84 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php
@@ -33,7 +33,7 @@ class vfsStreamWrapperAlreadyRegisteredTestCase extends \BC_PHPUnit_Framework_Te
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
TestvfsStreamWrapper::unregister();
$mock = $this->bc_getMock('org\\bovigo\\vfs\\vfsStreamWrapper');
@@ -43,7 +43,7 @@ public function setUp()
/**
* clean up test environment
*/
- public function tearDown()
+ public function tearDown(): void
{
TestvfsStreamWrapper::unregister();
}
@@ -53,10 +53,10 @@ public function tearDown()
* registered for the vfs scheme should throw an exception
*
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
*/
public function registerOverAnotherStreamWrapper()
{
+ $this->expectException(vfsStreamException::class);
vfsStreamWrapper::register();
}
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php
index 4c12a45e..c60806de 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php
@@ -65,7 +65,7 @@ abstract class vfsStreamWrapperBaseTestCase extends \BC_PHPUnit_Framework_TestCa
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->fooURL = vfsStream::url('foo');
$this->barURL = vfsStream::url('foo/bar');
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php
index 35fc0ce2..f9010437 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php
@@ -26,7 +26,7 @@ class vfsStreamWrapperDirSeparatorTestCase extends \BC_PHPUnit_Framework_TestCas
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->root = vfsStream::setup();
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php
index 5f840c47..bd61597a 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php
@@ -8,6 +8,8 @@
* @package org\bovigo\vfs
*/
namespace org\bovigo\vfs;
+use PHPUnit\Framework\Error;
+
require_once __DIR__ . '/vfsStreamWrapperBaseTestCase.php';
/**
* Test for org\bovigo\vfs\vfsStreamWrapper around mkdir().
@@ -214,11 +216,12 @@ public function mkDirShouldNotOverwriteExistingDirectories()
/**
* @test
* @group issue_28
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage mkdir(): Path vfs://root/dir exists
*/
public function mkDirShouldNotOverwriteExistingDirectoriesAndTriggerE_USER_WARNING()
{
+ $this->expectException(Error\Warning::class);
+ $this->expectExceptionMessage('mkdir(): Path vfs://root/dir exists');
+
vfsStream::setup('root');
$dir = vfsStream::url('root/dir');
$this->assertTrue(mkdir($dir));
@@ -239,11 +242,11 @@ public function mkDirShouldNotOverwriteExistingFiles()
/**
* @test
* @group issue_28
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage mkdir(): Path vfs://root/test.txt exists
*/
public function mkDirShouldNotOverwriteExistingFilesAndTriggerE_USER_WARNING()
{
+ $this->expectException(Error\Warning::class);
+ $this->expectExceptionMessage('mkdir(): Path vfs://root/test.txt exists');
$root = vfsStream::setup('root');
vfsStream::newFile('test.txt')->at($root);
$this->assertFalse(mkdir(vfsStream::url('root/test.txt')));
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php
index cd3ea22c..f58b6bca 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php
@@ -37,7 +37,7 @@ class vfsStreamWrapperFileTimesTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
vfsStream::setup()
->lastModified(50)
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php
index 3fb137f7..114dd48c 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php
@@ -29,7 +29,7 @@ class vfsStreamWrapperFlockTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->root = vfsStream::setup();
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php
index fb5d9fd0..d6ae211a 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php
@@ -29,7 +29,7 @@ class vfsStreamWrapperLargeFileTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$root = vfsStream::setup();
$this->largeFile = vfsStream::newFile('large.txt')
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php
index 95031909..574ab9f8 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php
@@ -25,7 +25,7 @@ class vfsStreamWrapperQuotaTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->root = vfsStream::setup();
vfsStream::setQuota(10);
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php
index ff2ab14f..8f232b7b 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php
@@ -27,7 +27,7 @@ class vfsStreamWrapperSetOptionTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->root = vfsStream::setup();
vfsStream::newFile('foo.txt')->at($this->root);
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php
index f2b3234d..b9919638 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php
@@ -8,6 +8,8 @@
* @package org\bovigo\vfs
*/
namespace org\bovigo\vfs;
+use PHPUnit\Framework\Error;
+
require_once __DIR__ . '/vfsStreamWrapperBaseTestCase.php';
/**
* Test for org\bovigo\vfs\vfsStreamWrapper.
@@ -405,7 +407,7 @@ public function renameDirectory()
$baz3URL = vfsStream::url('foo/baz3');
$this->assertTrue(rename($this->barURL, $baz3URL));
$this->assertFileExists($baz3URL);
- $this->assertFileNotExists($this->barURL);
+ $this->assertFileDoesNotExist($this->barURL);
}
/**
@@ -417,7 +419,7 @@ public function renameDirectoryWithDots()
$baz3URL = vfsStream::url('foo/baz3');
$this->assertTrue(rename($this->barURL . '/.', $baz3URL));
$this->assertFileExists($baz3URL);
- $this->assertFileNotExists($this->barURL);
+ $this->assertFileDoesNotExist($this->barURL);
}
/**
@@ -431,7 +433,7 @@ public function renameDirectoryWithDotsInTarget()
$baz3URL = vfsStream::url('foo/../baz3/.');
$this->assertTrue(rename($this->barURL . '/.', $baz3URL));
$this->assertFileExists($baz3URL);
- $this->assertFileNotExists($this->barURL);
+ $this->assertFileDoesNotExist($this->barURL);
}
/**
@@ -443,20 +445,20 @@ public function renameDirectoryOverwritingExistingFile()
// move foo/bar to foo/baz2
$this->assertTrue(rename($this->barURL, $this->baz2URL));
$this->assertFileExists(vfsStream::url('foo/baz2/baz1'));
- $this->assertFileNotExists($this->barURL);
+ $this->assertFileDoesNotExist($this->barURL);
}
/**
* @test
- * @expectedException PHPUnit_Framework_Error
*/
public function renameFileIntoFile()
{
+ $this->expectException(Error\Warning::class);
// foo/baz2 is a file, so it can not be turned into a directory
$baz3URL = vfsStream::url('foo/baz2/baz3');
$this->assertTrue(rename($this->baz1URL, $baz3URL));
$this->assertFileExists($baz3URL);
- $this->assertFileNotExists($this->baz1URL);
+ $this->assertFileDoesNotExist($this->baz1URL);
}
/**
@@ -470,27 +472,27 @@ public function renameFileToDirectory()
$this->assertTrue(rename($this->baz1URL, $baz3URL));
$this->assertFileExists($this->barURL);
$this->assertFileExists($baz3URL);
- $this->assertFileNotExists($this->baz1URL);
+ $this->assertFileDoesNotExist($this->baz1URL);
}
/**
* assert that trying to rename from a non existing file trigger a warning
*
- * @expectedException PHPUnit_Framework_Error
* @test
*/
public function renameOnSourceFileNotFound()
{
+ $this->expectException(Error\Warning::class);
rename(vfsStream::url('notfound'), $this->baz1URL);
}
/**
* assert that trying to rename to a directory that is not found trigger a warning
- * @expectedException PHPUnit_Framework_Error
* @test
*/
public function renameOnDestinationDirectoryFileNotFound()
{
+ $this->expectException(Error\Warning::class);
rename($this->baz1URL, vfsStream::url('foo/notfound/file2'));
}
/**
@@ -619,10 +621,10 @@ public function statReturnsFullDataForDirectoriesWithDot()
/**
* @test
- * @expectedException PHPUnit_Framework_Error
*/
public function openFileWithoutDirectory()
{
+ $this->expectException(Error\Warning::class);
vfsStreamWrapper::register();
$this->assertFalse(file_get_contents(vfsStream::url('file.txt')));
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
index 4e27685a..01d1cfa5 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
@@ -31,11 +31,11 @@ public function unregisterRegisteredUrlWrapper()
* Unregistering a third party wrapper for vfs:// fails.
*
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
* @runInSeparateProcess
*/
public function unregisterThirdPartyVfsScheme()
{
+ $this->expectException(vfsStreamException::class);
// Unregister possible registered URL wrapper.
vfsStreamWrapper::unregister();
@@ -49,11 +49,11 @@ public function unregisterThirdPartyVfsScheme()
* Unregistering when not in registered state will fail.
*
* @test
- * @expectedException org\bovigo\vfs\vfsStreamException
* @runInSeparateProcess
*/
public function unregisterWhenNotInRegisteredState()
{
+ $this->expectException(vfsStreamException::class);
vfsStreamWrapper::register();
stream_wrapper_unregister(vfsStream::SCHEME);
vfsStreamWrapper::unregister();
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php
index 8267a327..03c3d5b9 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php
@@ -16,7 +16,7 @@ class vfsStreamWrapperWithoutRootTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
vfsStreamWrapper::register();
}
diff --git a/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php b/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php
index 210642c2..166186be 100644
--- a/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php
+++ b/src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php
@@ -18,7 +18,7 @@ class vfsStreamZipTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
if (extension_loaded('zip') === false) {
$this->markTestSkipped('No ext/zip installed, skipping test.');
diff --git a/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php b/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php
index dfb3ed5a..e1d10109 100644
--- a/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php
+++ b/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php
@@ -30,7 +30,7 @@ class vfsStreamAbstractVisitorTestCase extends \BC_PHPUnit_Framework_TestCase
/**
* set up test environment
*/
- public function setUp()
+ public function setUp(): void
{
$this->abstractVisitor = $this->bc_getMock('org\\bovigo\\vfs\\visitor\\vfsStreamAbstractVisitor',
array('visitFile', 'visitDirectory')
@@ -39,10 +39,10 @@ public function setUp()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function visitThrowsInvalidArgumentExceptionOnUnknownContentType()
{
+ $this->expectException(\InvalidArgumentException::class);
$mockContent = $this->bc_getMock('org\\bovigo\\vfs\\vfsStreamContent');
$mockContent->expects($this->any())
->method('getType')
diff --git a/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php b/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php
index 294bd77d..3f8b8c70 100644
--- a/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php
+++ b/src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php
@@ -22,19 +22,19 @@ class vfsStreamPrintVisitorTestCase extends \BC_PHPUnit_Framework_TestCase
{
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructWithNonResourceThrowsInvalidArgumentException()
{
+ $this->expectException(\InvalidArgumentException::class);
new vfsStreamPrintVisitor('invalid');
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructWithNonStreamResourceThrowsInvalidArgumentException()
{
+ $this->expectException(\InvalidArgumentException::class);
new vfsStreamPrintVisitor(xml_parser_create());
}