phpactor / test-utils
Utilities for managing the test environment
Installs: 83 016
Dependents: 35
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: ^7.3 || ^8.0
- symfony/filesystem: ^4.2 || ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- dms/phpunit-arraysubset-asserts: dev-master
- ergebnis/composer-normalize: ^2.0
- friendsofphp/php-cs-fixer: ^2.17
- phpspec/prophecy-phpunit: dev-master
- phpstan/phpstan: ~0.12.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-30 21:58:08 UTC
README
Set of general test utilties for Phpactor.
Workspace
The Workspace
class is used to manage a test file workspace.
Resetting / Creating a workspace
$workspace = Workspace::create(__DIR__ . '/workspace'); $workspace->reset(); // creates or deletes then creates the workspace directory
Loading test files
Load a set of test files from a "manifest":
$manifest = <<<'EOT' // File: lib/ClassOne.php <?php class ClassOne {} // File: lib/Foo/ClassTwo.php <?php namespace Foo; class ClassTwo {} EOT ; $workspace = Workspace::create(__DIR__ . '/workspace'); $workspace->loadManifest($manifest); // create the files in the manifest Assert::assertTrue($workspace->exists('lib/ClassOne.php')); Assert::assertTrue($workspace->exists('lib/Foo/ClassTwo.php')); echo $workspace->getContents('/lib/Foo/ClassTwo.php');
Contributing
This package is open source and welcomes contributions! Feel free to open a pull request on this repository.
Support
- Create an issue on the main Phpactor repository.
- Join the
#phpactor
channel on the Slack Symfony Devs channel.