These are chat archives for Behat/Behat

1st
Mar 2017
Adam Copley
@adamcopleyrpa
Mar 01 2017 14:48
Having trouble with installing into an already existing project. I don't want to have to put my applications classes in a features/bootstrap folder. - I just want the Context files to live in there and it be able to find my classes in app/classes with PSR-0 naming convention. Can anyone help?
FlyLo11
@FlyLo11
Mar 01 2017 16:47
@adamcopleyrpa AFAIK, if you install behat in your project with composer, then behat will automatically use the composer autoloader. So if app/classes directory is defined as PSR-0 in composer.json autoload section, then behat will be able to use the classes.
@adamcopleyrpa but for some "uglier" non-composer projects, I created a init.php file with all the loading/initialization logic, which I required in every Context file.
Adam Copley
@adamcopleyrpa
Mar 01 2017 16:55
Thanks @FlyLo11 could you take a look at this post: http://stackoverflow.com/questions/42530127/how-do-i-configure-behat-to-autoload-classes-from-my-app-specific-folder , which has my apps directory structure, and advise on what best action to take, my project isn't a composer project at all, but I did include the behat framework by using composer. My application currently doesn't use namespaces either, just underscore separated class names to represent directories.
FlyLo11
@FlyLo11
Mar 01 2017 17:05
@adamcopleyrpa if your classes follow PSR-0, it's pretty straightforward to define them in composer autoloader https://getcomposer.org/doc/04-schema.md#psr-0
Adam Copley
@adamcopleyrpa
Mar 01 2017 17:17
got it, thanks very much mate :D
Bit Wombat
@bitwombat
Mar 01 2017 22:50
I have trouble with reusing methods in my Contexts - if they're inherited they clash if I have more than one context. Same if I use traits...
What does everybody else do?