Step def for "record has the <field> <value>"

This commit is contained in:
Ingo Schommer 2013-09-14 19:20:58 +02:00
parent 2550d5e858
commit f89879836a

View File

@ -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"