create-behat-contextlisted
Install: claude install-skill jeffsenso/prestashop-skills
# create-behat-context
Read `@.ai/Component/Behat/CONTEXT.md` for conventions (base class, entity references, stateless steps, bus access).
## 1. Context class
Create `tests/Integration/Behaviour/Features/Context/Domain/{Domain}/{Domain}FeatureContext.php`:
- Extend `AbstractDomainFeatureContext`
- Implement step definitions as methods with `@Given`, `@When`, `@Then` annotations
- Use `$this->getCommandBus()->handle(...)` for write operations
- Use `$this->getQueryBus()->handle(...)` for read/verification
- Use `$this->referenceToId($reference)` to resolve string references to integer IDs
- After creating an entity, store reference: `$this->getSharedStorage()->set($reference, $newId)`
**Reference:** `tests/Integration/Behaviour/Features/Context/Domain/Tax/TaxFeatureContext.php` (simple)
## 2. Step implementation patterns
### Action steps (@When)
```php
/**
* @When I add a {domain} :reference with following properties:
*/
public function iAddDomainWithProperties(string $reference, TableNode $table): void
{
$data = $this->localizeByRows($table);
$command = new Add{Domain}Command(
$data['name'],
(bool) $data['active'],
);
$id = $this->getCommandBus()->handle($command);
$this->getSharedStorage()->set($reference, $id->getValue());
}
```
### Assertion steps (@Then) — must be stateless
```php
/**
* @Then {domain} :reference should have the following properties:
*/
public function domainShouldHaveProperties(string $reference, TableNod