Search code examples
zend-framework2phpspec

phpspec tests within zend 2 module


I'm trying to move my spec folder into a zend 2 module folder. I don't totally understand how phpspec determines where the source folder is. How can I configure it to use the below folder structure.

\ModuleName
    \spec
        \ModuleName
            \Class.php
    \src
        \ModuleName
            ClassSpec.php
    ...
...

Solution

  • You can configure spec and src paths, see the docs: http://phpspec.net/en/latest/cookbook/configuration.html

    If that doesn't solve your issue, you'll need to write a phpspec extension and provide a custom resource locator. Here's a similar example for Symfony: https://github.com/phpspec/Symfony2Extension/blob/master/src/PhpSpec/Symfony2Extension/Locator/PSR0Locator.php