PHPackages                             ecomdev/phpspec-file-matcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ecomdev/phpspec-file-matcher

ActiveLibrary

ecomdev/phpspec-file-matcher
============================

PHPSpec extension that adds file matcher

2.0.2(9y ago)19621MITPHPPHP &gt;= 5.6

Since Feb 29Pushed 9y agoCompare

[ Source](https://github.com/EcomDev/phpspec-file-matcher)[ Packagist](https://packagist.org/packages/ecomdev/phpspec-file-matcher)[ RSS](/packages/ecomdev-phpspec-file-matcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (6)Used By (1)

PHPSpec File Matcher [![Build Status](https://camo.githubusercontent.com/44e29d5ef6ab165a66f67e0a25bb2e85bc8ee9d54e286b9f0e1ac546b40c3c7f/68747470733a2f2f7472617669732d63692e6f72672f45636f6d4465762f706870737065632d66696c652d6d6174636865722e737667)](https://travis-ci.org/EcomDev/phpspec-file-matcher) [![Coverage Status](https://camo.githubusercontent.com/2970b8e22174af25df234ac7bf9764127ddd355b8857417d474c7765140a5c3d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f45636f6d4465762f706870737065632d66696c652d6d6174636865722f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/EcomDev/phpspec-file-matcher?branch=develop)
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#phpspec-file-matcher--)

Allows to match directory/file existence and basic file content match.

Installation
------------

[](#installation)

1. Add composer dependency

    ```
    composer require --dev "ecomdev/phpspec-file-matcher"
    ```
2. Add extension to your PHPSpec configuration

    ```
    extensions:
      EcomDev\PHPSpec\FileMatcher\Extension: ~
    ```

Matchers
--------

[](#matchers)

- Directory existence:

    - `shouldCreateDirectory($path)`
    - `shouldBeDirectory($path)`
    - `shouldHaveDirectory($path)`
- File existence:

    - `shouldCreateFile($filePath)`
    - `shouldBeFile($filePath)`
    - `shouldHaveFile($filePath)`
- File content:

    - `shouldCreateFileContent($filePath, $content)`
    - `shouldHaveFile($filePath, $content)`

Example
-------

[](#example)

```
