soyuka/contexts
Add lightweight context handling to PHP/Laravel apps with soyuka/contexts. Store and retrieve per-request or runtime context data (like user, locale, tracing IDs) in a clean API to simplify logging, debugging, and cross-cutting concerns without global state.
Behatch contexts provide most common Behat tests.
This extension requires:
$ composer require --dev soyuka/contexts
behat.yml:# behat.yml
default:
# ...
extensions:
Behatch\Extension: ~
$ php composer.phar create-project behatch/skeleton
Browser, json, table and rest step need a mink configuration, see Mink extension for more information.
In behat.yml, enable desired contexts:
default:
suites:
default:
contexts:
- behatch:context:browser
- behatch:context:debug
- behatch:context:system
- behatch:context:json
- behatch:context:table
- behatch:context:rest
- behatch:context:xml
This project is self-tested, you can explore the features directory to find some examples.
browser - more browser related steps (like mink)
timeout - default timeoutdebug - helper steps for debugging
screenshotDir - the directory where store screenshotssystem - shell related steps
root - the root directory of the filesystemjson - JSON related steps
evaluationMode - javascript "foo.bar" or php "foo->bar"table - play with HTML the tablesrest - send GET, POST, ... requests and test the HTTP headersxml - XML related stepsFor example, if you want to change default directory to screenshots - you can do it this way:
default:
suites:
default:
contexts:
- behatch:context:debug:
screenshotDir: "var"
How can I help you explore Laravel packages today?