Skip to content

Virtual filesystem for PHP that can be used for testing

License

Notifications You must be signed in to change notification settings

christeredvartsen/testfs

Repository files navigation

TestFs

CI

Virtual filesystem for PHP for use with testing, implemented using a stream wrapper.

Requirements

This library requires PHP >= 8.1.

Installation

Install using Composer:

composer require christeredvartsen/testfs

Usage

To enable the stream wrapper you must first register it:

TestFs\StreamWrapper::register();

When it is registered it will pick up usage of the tfs:// protocol used with filesystem functions, for instance fopen(), file_get_contents(), touch() and so forth.

You can also fetch the "root" of the virtual filesystem after registering the wrapper to inspect the assets (files and/or directories within the virtual filesystem):

$root = TestFs\StreamWrapper::getRoot();

Development

git clone git@github.com:christeredvartsen/testfs.git
composer install
composer run ci

License

Licensed under the MIT License.

About

Virtual filesystem for PHP that can be used for testing

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages