mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Step def for "record has the <field> <value>"
This commit is contained in:
parent
2550d5e858
commit
f89879836a
@ -137,6 +137,21 @@ class FixtureContext extends BehatContext
|
||||
}
|
||||
$this->fixtureFactory->createObject($class, $id, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Given a "page" "Page 1" has the "content" "My content"
|
||||
*
|
||||
* @Given /^(?:(an|a|the) )"(?<type>[^"]+)" "(?<id>[^"]+)" has (?:(an|a|the) )"(?<field>.*)" "(?<value>.*)"$/
|
||||
*/
|
||||
public function stepCreateRecordHasField($type, $id, $field, $value)
|
||||
{
|
||||
$class = $this->convertTypeToClass($type);
|
||||
$fields = $this->convertFields(
|
||||
$class,
|
||||
array($field => $value)
|
||||
);
|
||||
$this->fixtureFactory->createObject($class, $id, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Given a "page" "Page 1" with "URL"="page-1" and "Content"="my page 1"
|
||||
|
Loading…
Reference in New Issue
Block a user