repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Listener/DriverListener.php | DriverListener.prepareDefaultDrupalDriver | public function prepareDefaultDrupalDriver($event)
{
$feature = $event->getFeature();
$scenario = $event instanceof ScenarioLikeTested ? $event->getScenario() : $event->getOutline();
// Get the default driver.
$driver = $this->parameters['default_driver'];
foreach (array_me... | php | public function prepareDefaultDrupalDriver($event)
{
$feature = $event->getFeature();
$scenario = $event instanceof ScenarioLikeTested ? $event->getScenario() : $event->getOutline();
// Get the default driver.
$driver = $this->parameters['default_driver'];
foreach (array_me... | [
"public",
"function",
"prepareDefaultDrupalDriver",
"(",
"$",
"event",
")",
"{",
"$",
"feature",
"=",
"$",
"event",
"->",
"getFeature",
"(",
")",
";",
"$",
"scenario",
"=",
"$",
"event",
"instanceof",
"ScenarioLikeTested",
"?",
"$",
"event",
"->",
"getScenar... | Configures default Drupal driver to use before each scenario or outline.
`@api` tagged scenarios will get the `api_driver` as the default driver.
Other scenarios get the `default_driver` as the default driver.
@param ScenarioEvent|OutlineEvent $event | [
"Configures",
"default",
"Drupal",
"driver",
"to",
"use",
"before",
"each",
"scenario",
"or",
"outline",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Listener/DriverListener.php#L61-L81 |
jhedstrom/drupalextension | src/Drupal/MinkExtension/ServiceContainer/MinkExtension.php | MinkExtension.configure | public function configure(ArrayNodeDefinition $builder)
{
parent::configure($builder);
// Add extended options.
$builder->
children()->
scalarNode('ajax_timeout')->
defaultValue(static::AJAX_TIMEOUT)->
info(sprintf('Change the maximum time to wait for... | php | public function configure(ArrayNodeDefinition $builder)
{
parent::configure($builder);
// Add extended options.
$builder->
children()->
scalarNode('ajax_timeout')->
defaultValue(static::AJAX_TIMEOUT)->
info(sprintf('Change the maximum time to wait for... | [
"public",
"function",
"configure",
"(",
"ArrayNodeDefinition",
"$",
"builder",
")",
"{",
"parent",
"::",
"configure",
"(",
"$",
"builder",
")",
";",
"// Add extended options.",
"$",
"builder",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'ajax_timeout'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/MinkExtension/ServiceContainer/MinkExtension.php#L21-L32 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Selector/RegionSelector.php | RegionSelector.translateToXPath | public function translateToXPath($region)
{
if (!isset($this->regionMap[$region])) {
throw new \InvalidArgumentException(sprintf('The "%s" region isn\'t configured!', $region));
}
$css = $this->regionMap[$region];
return $this->cssSelector->translateToXPath($css);
} | php | public function translateToXPath($region)
{
if (!isset($this->regionMap[$region])) {
throw new \InvalidArgumentException(sprintf('The "%s" region isn\'t configured!', $region));
}
$css = $this->regionMap[$region];
return $this->cssSelector->translateToXPath($css);
} | [
"public",
"function",
"translateToXPath",
"(",
"$",
"region",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"regionMap",
"[",
"$",
"region",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The \"%... | Translates provided locator into XPath.
@param string $region
@return string
@throws \InvalidArgumentException | [
"Translates",
"provided",
"locator",
"into",
"XPath",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Selector/RegionSelector.php#L30-L38 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.getRegion | public function getRegion($region)
{
$session = $this->getSession();
$regionObj = $session->getPage()->find('region', $region);
if (!$regionObj) {
throw new \Exception(sprintf('No region "%s" found on the page %s.', $region, $session->getCurrentUrl()));
}
return ... | php | public function getRegion($region)
{
$session = $this->getSession();
$regionObj = $session->getPage()->find('region', $region);
if (!$regionObj) {
throw new \Exception(sprintf('No region "%s" found on the page %s.', $region, $session->getCurrentUrl()));
}
return ... | [
"public",
"function",
"getRegion",
"(",
"$",
"region",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"$",
"regionObj",
"=",
"$",
"session",
"->",
"getPage",
"(",
")",
"->",
"find",
"(",
"'region'",
",",
"$",
"region",... | Return a region from the current page.
@throws \Exception
If region cannot be found.
@param string $region
The machine name of the region to return.
@return \Behat\Mink\Element\NodeElement | [
"Return",
"a",
"region",
"from",
"the",
"current",
"page",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L39-L48 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertAtPath | public function assertAtPath($path)
{
$this->getSession()->visit($this->locatePath($path));
// If available, add extra validation that this is a 200 response.
try {
$this->getSession()->getStatusCode();
$this->assertHttpResponse('200');
} catch (UnsupportedDr... | php | public function assertAtPath($path)
{
$this->getSession()->visit($this->locatePath($path));
// If available, add extra validation that this is a 200 response.
try {
$this->getSession()->getStatusCode();
$this->assertHttpResponse('200');
} catch (UnsupportedDr... | [
"public",
"function",
"assertAtPath",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"visit",
"(",
"$",
"this",
"->",
"locatePath",
"(",
"$",
"path",
")",
")",
";",
"// If available, add extra validation that this is a 200 response.... | Visit a given path, and additionally check for HTTP response code 200.
@Given I am at :path
@When I visit :path
@throws UnsupportedDriverActionException | [
"Visit",
"a",
"given",
"path",
"and",
"additionally",
"check",
"for",
"HTTP",
"response",
"code",
"200",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L58-L69 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.beforeJavascriptStep | public function beforeJavascriptStep($event)
{
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
// Make sure the feature is registered in case this hook fires before
// ::registerFeature() which is also a @BeforeStep. Behat doesn't
// support ordering hooks.
$this->... | php | public function beforeJavascriptStep($event)
{
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
// Make sure the feature is registered in case this hook fires before
// ::registerFeature() which is also a @BeforeStep. Behat doesn't
// support ordering hooks.
$this->... | [
"public",
"function",
"beforeJavascriptStep",
"(",
"$",
"event",
")",
"{",
"/** @var \\Behat\\Behat\\Hook\\Scope\\BeforeStepScope $event */",
"// Make sure the feature is registered in case this hook fires before",
"// ::registerFeature() which is also a @BeforeStep. Behat doesn't",
"// suppor... | For javascript enabled scenarios, always wait for AJAX before clicking.
@BeforeStep | [
"For",
"javascript",
"enabled",
"scenarios",
"always",
"wait",
"for",
"AJAX",
"before",
"clicking",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L95-L109 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.afterJavascriptStep | public function afterJavascriptStep($event)
{
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
if (!$this->hasTag('javascript')) {
return;
}
$text = $event->getStep()->getText();
if (preg_match('/(follow|press|click|submit)/i', $text)) {
$thi... | php | public function afterJavascriptStep($event)
{
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
if (!$this->hasTag('javascript')) {
return;
}
$text = $event->getStep()->getText();
if (preg_match('/(follow|press|click|submit)/i', $text)) {
$thi... | [
"public",
"function",
"afterJavascriptStep",
"(",
"$",
"event",
")",
"{",
"/** @var \\Behat\\Behat\\Hook\\Scope\\BeforeStepScope $event */",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTag",
"(",
"'javascript'",
")",
")",
"{",
"return",
";",
"}",
"$",
"text",
"=",
"$... | For javascript enabled scenarios, always wait for AJAX after clicking.
@AfterStep | [
"For",
"javascript",
"enabled",
"scenarios",
"always",
"wait",
"for",
"AJAX",
"after",
"clicking",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L116-L126 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.iWaitForAjaxToFinish | public function iWaitForAjaxToFinish($event = null)
{
$condition = <<<JS
(function() {
function isAjaxing(instance) {
return instance && instance.ajaxing === true;
}
var d7_not_ajaxing = true;
if (typeof Drupal !== 'undefined' && typeof Drupal.ajax !== 'undefined' && type... | php | public function iWaitForAjaxToFinish($event = null)
{
$condition = <<<JS
(function() {
function isAjaxing(instance) {
return instance && instance.ajaxing === true;
}
var d7_not_ajaxing = true;
if (typeof Drupal !== 'undefined' && typeof Drupal.ajax !== 'undefined' && type... | [
"public",
"function",
"iWaitForAjaxToFinish",
"(",
"$",
"event",
"=",
"null",
")",
"{",
"$",
"condition",
"=",
" <<<JS\n (function() {\n function isAjaxing(instance) {\n return instance && instance.ajaxing === true;\n }\n var d7_not_ajaxing = true;\n if (typeo... | Wait for AJAX to finish.
@see \Drupal\FunctionalJavascriptTests\JSWebAssert::assertWaitOnAjaxRequest()
@Given I wait for AJAX to finish | [
"Wait",
"for",
"AJAX",
"to",
"finish",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L135-L174 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.pressButton | public function pressButton($button)
{
// Wait for any open autocomplete boxes to finish closing. They block
// form-submission if they are still open.
// Use a step 'I press the "Esc" key in the "LABEL" field' to close
// autocomplete suggestion boxes with Mink. "Click" events on ... | php | public function pressButton($button)
{
// Wait for any open autocomplete boxes to finish closing. They block
// form-submission if they are still open.
// Use a step 'I press the "Esc" key in the "LABEL" field' to close
// autocomplete suggestion boxes with Mink. "Click" events on ... | [
"public",
"function",
"pressButton",
"(",
"$",
"button",
")",
"{",
"// Wait for any open autocomplete boxes to finish closing. They block",
"// form-submission if they are still open.",
"// Use a step 'I press the \"Esc\" key in the \"LABEL\" field' to close",
"// autocomplete suggestion boxe... | Presses button with specified id|name|title|alt|value.
@When I press the :button button | [
"Presses",
"button",
"with",
"specified",
"id|name|title|alt|value",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L180-L197 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.pressKey | public function pressKey($char, $field)
{
static $keys = array(
'backspace' => 8,
'tab' => 9,
'enter' => 13,
'shift' => 16,
'ctrl' => 17,
'alt' => 18,
'pause' => 19,
'break' => 19,
'escape' => 27,
'esc' => 27,
'end' =... | php | public function pressKey($char, $field)
{
static $keys = array(
'backspace' => 8,
'tab' => 9,
'enter' => 13,
'shift' => 16,
'ctrl' => 17,
'alt' => 18,
'pause' => 19,
'break' => 19,
'escape' => 27,
'esc' => 27,
'end' =... | [
"public",
"function",
"pressKey",
"(",
"$",
"char",
",",
"$",
"field",
")",
"{",
"static",
"$",
"keys",
"=",
"array",
"(",
"'backspace'",
"=>",
"8",
",",
"'tab'",
"=>",
"9",
",",
"'enter'",
"=>",
"13",
",",
"'shift'",
"=>",
"16",
",",
"'ctrl'",
"=>... | @Given I press the :char key in the :field field
@param mixed $char could be either char ('b') or char-code (98)
@throws \Exception | [
"@Given",
"I",
"press",
"the",
":",
"char",
"key",
"in",
"the",
":",
"field",
"field"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L205-L252 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertRegionLinkFollow | public function assertRegionLinkFollow($link, $region)
{
$regionObj = $this->getRegion($region);
// Find the link within the region
$linkObj = $regionObj->findLink($link);
if (empty($linkObj)) {
throw new \Exception(sprintf('The link "%s" was not found in the region "%s"... | php | public function assertRegionLinkFollow($link, $region)
{
$regionObj = $this->getRegion($region);
// Find the link within the region
$linkObj = $regionObj->findLink($link);
if (empty($linkObj)) {
throw new \Exception(sprintf('The link "%s" was not found in the region "%s"... | [
"public",
"function",
"assertRegionLinkFollow",
"(",
"$",
"link",
",",
"$",
"region",
")",
"{",
"$",
"regionObj",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"region",
")",
";",
"// Find the link within the region",
"$",
"linkObj",
"=",
"$",
"regionObj",
... | @When I follow/click :link in the :region( region)
@throws \Exception
If region or link within it cannot be found. | [
"@When",
"I",
"follow",
"/",
"click",
":",
"link",
"in",
"the",
":",
"region",
"(",
"region",
")"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L392-L402 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.regionFillField | public function regionFillField($field, $value, $region)
{
$field = $this->fixStepArgument($field);
$value = $this->fixStepArgument($value);
$regionObj = $this->getRegion($region);
$regionObj->fillField($field, $value);
} | php | public function regionFillField($field, $value, $region)
{
$field = $this->fixStepArgument($field);
$value = $this->fixStepArgument($value);
$regionObj = $this->getRegion($region);
$regionObj->fillField($field, $value);
} | [
"public",
"function",
"regionFillField",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"region",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"fixStepArgument",
"(",
"$",
"field",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"fixStepArgument",
... | Fills in a form field with id|name|title|alt|value in the specified region.
@Given I fill in :value for :field in the :region( region)
@Given I fill in :field with :value in the :region( region)
@throws \Exception
If region cannot be found. | [
"Fills",
"in",
"a",
"form",
"field",
"with",
"id|name|title|alt|value",
"in",
"the",
"specified",
"region",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L437-L443 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertRegionHeading | public function assertRegionHeading($heading, $region)
{
$regionObj = $this->getRegion($region);
foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
$elements = $regionObj->findAll('css', $tag);
if (!empty($elements)) {
foreach ($elements as $elemen... | php | public function assertRegionHeading($heading, $region)
{
$regionObj = $this->getRegion($region);
foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
$elements = $regionObj->findAll('css', $tag);
if (!empty($elements)) {
foreach ($elements as $elemen... | [
"public",
"function",
"assertRegionHeading",
"(",
"$",
"heading",
",",
"$",
"region",
")",
"{",
"$",
"regionObj",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"region",
")",
";",
"foreach",
"(",
"array",
"(",
"'h1'",
",",
"'h2'",
",",
"'h3'",
",",
... | Find a heading in a specific region.
@Then I should see the heading :heading in the :region( region)
@Then I should see the :heading heading in the :region( region)
@throws \Exception
If region or header within it cannot be found. | [
"Find",
"a",
"heading",
"in",
"a",
"specific",
"region",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L454-L470 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertLinkRegion | public function assertLinkRegion($link, $region)
{
$regionObj = $this->getRegion($region);
$result = $regionObj->findLink($link);
if (empty($result)) {
throw new \Exception(sprintf('No link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurre... | php | public function assertLinkRegion($link, $region)
{
$regionObj = $this->getRegion($region);
$result = $regionObj->findLink($link);
if (empty($result)) {
throw new \Exception(sprintf('No link to "%s" in the "%s" region on the page %s', $link, $region, $this->getSession()->getCurre... | [
"public",
"function",
"assertLinkRegion",
"(",
"$",
"link",
",",
"$",
"region",
")",
"{",
"$",
"regionObj",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"region",
")",
";",
"$",
"result",
"=",
"$",
"regionObj",
"->",
"findLink",
"(",
"$",
"link",
"... | @Then I should see the link :link in the :region( region)
@throws \Exception
If region or link within it cannot be found. | [
"@Then",
"I",
"should",
"see",
"the",
"link",
":",
"link",
"in",
"the",
":",
"region",
"(",
"region",
")"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L478-L486 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertRegionText | public function assertRegionText($text, $region)
{
$regionObj = $this->getRegion($region);
// Find the text within the region
$regionText = $regionObj->getText();
if (strpos($regionText, $text) === false) {
throw new \Exception(sprintf("The text '%s' was not found in the... | php | public function assertRegionText($text, $region)
{
$regionObj = $this->getRegion($region);
// Find the text within the region
$regionText = $regionObj->getText();
if (strpos($regionText, $text) === false) {
throw new \Exception(sprintf("The text '%s' was not found in the... | [
"public",
"function",
"assertRegionText",
"(",
"$",
"text",
",",
"$",
"region",
")",
"{",
"$",
"regionObj",
"=",
"$",
"this",
"->",
"getRegion",
"(",
"$",
"region",
")",
";",
"// Find the text within the region",
"$",
"regionText",
"=",
"$",
"regionObj",
"->... | @Then I should see( the text) :text in the :region( region)
@throws \Exception
If region or text within it cannot be found. | [
"@Then",
"I",
"should",
"see",
"(",
"the",
"text",
")",
":",
"text",
"in",
"the",
":",
"region",
"(",
"region",
")"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L510-L519 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MinkContext.php | MinkContext.assertSelectRadioById | public function assertSelectRadioById($label, $id = '')
{
$element = $this->getSession()->getPage();
$radiobutton = $id ? $element->findById($id) : $element->find('named', array('radio', $this->getSession()->getSelectorsHandler()->xpathLiteral($label)));
if ($radiobutton === null) {
... | php | public function assertSelectRadioById($label, $id = '')
{
$element = $this->getSession()->getPage();
$radiobutton = $id ? $element->findById($id) : $element->find('named', array('radio', $this->getSession()->getSelectorsHandler()->xpathLiteral($label)));
if ($radiobutton === null) {
... | [
"public",
"function",
"assertSelectRadioById",
"(",
"$",
"label",
",",
"$",
"id",
"=",
"''",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getPage",
"(",
")",
";",
"$",
"radiobutton",
"=",
"$",
"id",
"?",
"$",
"el... | @When I select the radio button :label with the id :id
@When I select the radio button :label
@TODO convert to mink extension. | [
"@When",
"I",
"select",
"the",
"radio",
"button",
":",
"label",
"with",
"the",
"id",
":",
"id",
"@When",
"I",
"select",
"the",
"radio",
"button",
":",
"label"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MinkContext.php#L598-L612 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalSubContextBase.php | DrupalSubContextBase.getUser | protected function getUser()
{
trigger_error('DrupalSubContextBase::getUser() is deprecated. Use RawDrupalContext::getUserManager()->getCurrentUser() instead.', E_USER_DEPRECATED);
$user = $this->getUserManager()->getCurrentUser();
if (empty($user)) {
throw new \Exception('No u... | php | protected function getUser()
{
trigger_error('DrupalSubContextBase::getUser() is deprecated. Use RawDrupalContext::getUserManager()->getCurrentUser() instead.', E_USER_DEPRECATED);
$user = $this->getUserManager()->getCurrentUser();
if (empty($user)) {
throw new \Exception('No u... | [
"protected",
"function",
"getUser",
"(",
")",
"{",
"trigger_error",
"(",
"'DrupalSubContextBase::getUser() is deprecated. Use RawDrupalContext::getUserManager()->getCurrentUser() instead.'",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManage... | Get the currently logged in user from DrupalContext.
@deprecated
Deprecated in 4.x, will be removed before 5.x.
The currently logged in user is now available in all context classes.
Use $this->getUserManager()->getCurrentUser() instead. | [
"Get",
"the",
"currently",
"logged",
"in",
"user",
"from",
"DrupalContext",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalSubContextBase.php#L44-L55 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/DrupalParametersTrait.php | DrupalParametersTrait.getDrupalParameter | public function getDrupalParameter($name)
{
return isset($this->drupalParameters[$name]) ? $this->drupalParameters[$name] : null;
} | php | public function getDrupalParameter($name)
{
return isset($this->drupalParameters[$name]) ? $this->drupalParameters[$name] : null;
} | [
"public",
"function",
"getDrupalParameter",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"drupalParameters",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"drupalParameters",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
... | Returns a specific Drupal parameter.
@param string $name
Parameter name.
@return mixed
The value. | [
"Returns",
"a",
"specific",
"Drupal",
"parameter",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/DrupalParametersTrait.php#L42-L45 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/DrupalParametersTrait.php | DrupalParametersTrait.getDrupalText | public function getDrupalText($name)
{
$text = $this->getDrupalParameter('text');
if (!isset($text[$name])) {
throw new \Exception(sprintf('No such Drupal string: %s', $name));
}
return $text[$name];
} | php | public function getDrupalText($name)
{
$text = $this->getDrupalParameter('text');
if (!isset($text[$name])) {
throw new \Exception(sprintf('No such Drupal string: %s', $name));
}
return $text[$name];
} | [
"public",
"function",
"getDrupalText",
"(",
"$",
"name",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"getDrupalParameter",
"(",
"'text'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"text",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
... | Returns a specific Drupal text value.
@param string $name
Text value name, such as 'log_out', which corresponds to the default
'Log out' link text.
@return string
The text value.
@throws \Exception
Thrown when the text is not present in the list of parameters. | [
"Returns",
"a",
"specific",
"Drupal",
"text",
"value",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/DrupalParametersTrait.php#L60-L67 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/DrupalParametersTrait.php | DrupalParametersTrait.getDrupalSelector | public function getDrupalSelector($name)
{
$text = $this->getDrupalParameter('selectors');
if (!isset($text[$name])) {
throw new \Exception(sprintf('No such selector configured: %s', $name));
}
return $text[$name];
} | php | public function getDrupalSelector($name)
{
$text = $this->getDrupalParameter('selectors');
if (!isset($text[$name])) {
throw new \Exception(sprintf('No such selector configured: %s', $name));
}
return $text[$name];
} | [
"public",
"function",
"getDrupalSelector",
"(",
"$",
"name",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"getDrupalParameter",
"(",
"'selectors'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"text",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
... | Returns a specific CSS selector.
@param string $name
The name of the CSS selector.
@return string
The CSS selector.
@throws \Exception
Thrown when the selector is not present in the list of parameters. | [
"Returns",
"a",
"specific",
"CSS",
"selector",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/DrupalParametersTrait.php#L81-L88 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php | DrupalAuthenticationManager.logIn | public function logIn(\stdClass $user)
{
// Ensure we aren't already logged in.
$this->fastLogout();
$this->getSession()->visit($this->locatePath($this->getDrupalText('login_url')));
$element = $this->getSession()->getPage();
$element->fillField($this->getDrupalText('usernam... | php | public function logIn(\stdClass $user)
{
// Ensure we aren't already logged in.
$this->fastLogout();
$this->getSession()->visit($this->locatePath($this->getDrupalText('login_url')));
$element = $this->getSession()->getPage();
$element->fillField($this->getDrupalText('usernam... | [
"public",
"function",
"logIn",
"(",
"\\",
"stdClass",
"$",
"user",
")",
"{",
"// Ensure we aren't already logged in.",
"$",
"this",
"->",
"fastLogout",
"(",
")",
";",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"visit",
"(",
"$",
"this",
"->",
"locate... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php#L45-L71 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php | DrupalAuthenticationManager.logout | public function logout()
{
$this->getSession()->visit($this->locatePath($this->getDrupalText('logout_url')));
$this->userManager->setCurrentUser(false);
} | php | public function logout()
{
$this->getSession()->visit($this->locatePath($this->getDrupalText('logout_url')));
$this->userManager->setCurrentUser(false);
} | [
"public",
"function",
"logout",
"(",
")",
"{",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"visit",
"(",
"$",
"this",
"->",
"locatePath",
"(",
"$",
"this",
"->",
"getDrupalText",
"(",
"'logout_url'",
")",
")",
")",
";",
"$",
"this",
"->",
"userM... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php#L76-L80 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php | DrupalAuthenticationManager.loggedIn | public function loggedIn()
{
$session = $this->getSession();
// If the session has not been started yet, or no page has yet been loaded,
// then this is a brand new test session and the user is not logged in.
if (!$session->isStarted() || !$page = $session->getPage()) {
... | php | public function loggedIn()
{
$session = $this->getSession();
// If the session has not been started yet, or no page has yet been loaded,
// then this is a brand new test session and the user is not logged in.
if (!$session->isStarted() || !$page = $session->getPage()) {
... | [
"public",
"function",
"loggedIn",
"(",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"// If the session has not been started yet, or no page has yet been loaded,",
"// then this is a brand new test session and the user is not logged in.",
"if",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php#L85-L127 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php | DrupalAuthenticationManager.fastLogout | public function fastLogout()
{
$session = $this->getSession();
if ($session->isStarted()) {
$session->reset();
}
$this->userManager->setCurrentUser(false);
} | php | public function fastLogout()
{
$session = $this->getSession();
if ($session->isStarted()) {
$session->reset();
}
$this->userManager->setCurrentUser(false);
} | [
"public",
"function",
"fastLogout",
"(",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"session",
"->",
"isStarted",
"(",
")",
")",
"{",
"$",
"session",
"->",
"reset",
"(",
")",
";",
"}",
"$",
"thi... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalAuthenticationManager.php#L132-L139 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.alterNodeParameters | public static function alterNodeParameters(BeforeNodeCreateScope $scope)
{
$node = $scope->getEntity();
// Get the Drupal API version if available. This is not available when
// using e.g. the BlackBoxDriver or DrushDriver.
$api_version = null;
$driver = $scope->getContext()... | php | public static function alterNodeParameters(BeforeNodeCreateScope $scope)
{
$node = $scope->getEntity();
// Get the Drupal API version if available. This is not available when
// using e.g. the BlackBoxDriver or DrushDriver.
$api_version = null;
$driver = $scope->getContext()... | [
"public",
"static",
"function",
"alterNodeParameters",
"(",
"BeforeNodeCreateScope",
"$",
"scope",
")",
"{",
"$",
"node",
"=",
"$",
"scope",
"->",
"getEntity",
"(",
")",
";",
"// Get the Drupal API version if available. This is not available when",
"// using e.g. the BlackB... | Massage node values to match the expectations on different Drupal versions.
@beforeNodeCreate | [
"Massage",
"node",
"values",
"to",
"match",
"the",
"expectations",
"on",
"different",
"Drupal",
"versions",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L217-L239 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.cleanNodes | public function cleanNodes()
{
// Remove any nodes that were created.
foreach ($this->nodes as $node) {
$this->getDriver()->nodeDelete($node);
}
$this->nodes = array();
} | php | public function cleanNodes()
{
// Remove any nodes that were created.
foreach ($this->nodes as $node) {
$this->getDriver()->nodeDelete($node);
}
$this->nodes = array();
} | [
"public",
"function",
"cleanNodes",
"(",
")",
"{",
"// Remove any nodes that were created.",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"nodeDelete",
"(",
"$",
"node",
")",
";",
... | Remove any created nodes.
@AfterScenario | [
"Remove",
"any",
"created",
"nodes",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L246-L253 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.cleanUsers | public function cleanUsers()
{
// Remove any users that were created.
if ($this->userManager->hasUsers()) {
foreach ($this->userManager->getUsers() as $user) {
$this->getDriver()->userDelete($user);
}
$this->getDriver()->processBatch();
... | php | public function cleanUsers()
{
// Remove any users that were created.
if ($this->userManager->hasUsers()) {
foreach ($this->userManager->getUsers() as $user) {
$this->getDriver()->userDelete($user);
}
$this->getDriver()->processBatch();
... | [
"public",
"function",
"cleanUsers",
"(",
")",
"{",
"// Remove any users that were created.",
"if",
"(",
"$",
"this",
"->",
"userManager",
"->",
"hasUsers",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"userManager",
"->",
"getUsers",
"(",
")",
"as"... | Remove any created users.
@AfterScenario | [
"Remove",
"any",
"created",
"users",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L260-L276 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.cleanTerms | public function cleanTerms()
{
// Remove any terms that were created.
foreach ($this->terms as $term) {
$this->getDriver()->termDelete($term);
}
$this->terms = array();
} | php | public function cleanTerms()
{
// Remove any terms that were created.
foreach ($this->terms as $term) {
$this->getDriver()->termDelete($term);
}
$this->terms = array();
} | [
"public",
"function",
"cleanTerms",
"(",
")",
"{",
"// Remove any terms that were created.",
"foreach",
"(",
"$",
"this",
"->",
"terms",
"as",
"$",
"term",
")",
"{",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"termDelete",
"(",
"$",
"term",
")",
";",
... | Remove any created terms.
@AfterScenario | [
"Remove",
"any",
"created",
"terms",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L283-L290 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.cleanRoles | public function cleanRoles()
{
// Remove any roles that were created.
foreach ($this->roles as $rid) {
$this->getDriver()->roleDelete($rid);
}
$this->roles = array();
} | php | public function cleanRoles()
{
// Remove any roles that were created.
foreach ($this->roles as $rid) {
$this->getDriver()->roleDelete($rid);
}
$this->roles = array();
} | [
"public",
"function",
"cleanRoles",
"(",
")",
"{",
"// Remove any roles that were created.",
"foreach",
"(",
"$",
"this",
"->",
"roles",
"as",
"$",
"rid",
")",
"{",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"roleDelete",
"(",
"$",
"rid",
")",
";",
... | Remove any created roles.
@AfterScenario | [
"Remove",
"any",
"created",
"roles",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L297-L304 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.cleanLanguages | public function cleanLanguages()
{
// Delete any languages that were created.
foreach ($this->languages as $language) {
$this->getDriver()->languageDelete($language);
unset($this->languages[$language->langcode]);
}
} | php | public function cleanLanguages()
{
// Delete any languages that were created.
foreach ($this->languages as $language) {
$this->getDriver()->languageDelete($language);
unset($this->languages[$language->langcode]);
}
} | [
"public",
"function",
"cleanLanguages",
"(",
")",
"{",
"// Delete any languages that were created.",
"foreach",
"(",
"$",
"this",
"->",
"languages",
"as",
"$",
"language",
")",
"{",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"languageDelete",
"(",
"$",
"l... | Remove any created languages.
@AfterScenario | [
"Remove",
"any",
"created",
"languages",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L311-L318 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.dispatchHooks | protected function dispatchHooks($scopeType, \stdClass $entity)
{
$fullScopeClass = 'Drupal\\DrupalExtension\\Hook\\Scope\\' . $scopeType;
$scope = new $fullScopeClass($this->getDrupal()->getEnvironment(), $this, $entity);
$callResults = $this->dispatcher->dispatchScopeHooks($scope);
... | php | protected function dispatchHooks($scopeType, \stdClass $entity)
{
$fullScopeClass = 'Drupal\\DrupalExtension\\Hook\\Scope\\' . $scopeType;
$scope = new $fullScopeClass($this->getDrupal()->getEnvironment(), $this, $entity);
$callResults = $this->dispatcher->dispatchScopeHooks($scope);
... | [
"protected",
"function",
"dispatchHooks",
"(",
"$",
"scopeType",
",",
"\\",
"stdClass",
"$",
"entity",
")",
"{",
"$",
"fullScopeClass",
"=",
"'Drupal\\\\DrupalExtension\\\\Hook\\\\Scope\\\\'",
".",
"$",
"scopeType",
";",
"$",
"scope",
"=",
"new",
"$",
"fullScopeCl... | Dispatch scope hooks.
@param string $scope
The entity scope to dispatch.
@param \stdClass $entity
The entity. | [
"Dispatch",
"scope",
"hooks",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L338-L351 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.nodeCreate | public function nodeCreate($node)
{
$this->dispatchHooks('BeforeNodeCreateScope', $node);
$this->parseEntityFields('node', $node);
$saved = $this->getDriver()->createNode($node);
$this->dispatchHooks('AfterNodeCreateScope', $saved);
$this->nodes[] = $saved;
return $sa... | php | public function nodeCreate($node)
{
$this->dispatchHooks('BeforeNodeCreateScope', $node);
$this->parseEntityFields('node', $node);
$saved = $this->getDriver()->createNode($node);
$this->dispatchHooks('AfterNodeCreateScope', $saved);
$this->nodes[] = $saved;
return $sa... | [
"public",
"function",
"nodeCreate",
"(",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"dispatchHooks",
"(",
"'BeforeNodeCreateScope'",
",",
"$",
"node",
")",
";",
"$",
"this",
"->",
"parseEntityFields",
"(",
"'node'",
",",
"$",
"node",
")",
";",
"$",
"saved... | Create a node.
@return object
The created node. | [
"Create",
"a",
"node",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L359-L367 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.parseEntityFields | public function parseEntityFields($entity_type, \stdClass $entity)
{
$multicolumn_field = '';
$multicolumn_fields = array();
foreach (clone $entity as $field => $field_value) {
// Reset the multicolumn field if the field name does not contain a column.
if (strpos($fi... | php | public function parseEntityFields($entity_type, \stdClass $entity)
{
$multicolumn_field = '';
$multicolumn_fields = array();
foreach (clone $entity as $field => $field_value) {
// Reset the multicolumn field if the field name does not contain a column.
if (strpos($fi... | [
"public",
"function",
"parseEntityFields",
"(",
"$",
"entity_type",
",",
"\\",
"stdClass",
"$",
"entity",
")",
"{",
"$",
"multicolumn_field",
"=",
"''",
";",
"$",
"multicolumn_fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"clone",
"$",
"entity",
"a... | Parses the field values and turns them into the format expected by Drupal.
Multiple values in a single field must be separated by commas. Wrap the
field value in double quotes in case it should contain a comma.
Compound field properties are identified using a ':' operator, either in
the column heading or in the cell.... | [
"Parses",
"the",
"field",
"values",
"and",
"turns",
"them",
"into",
"the",
"format",
"expected",
"by",
"Drupal",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L398-L470 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.userCreate | public function userCreate($user)
{
$this->dispatchHooks('BeforeUserCreateScope', $user);
$this->parseEntityFields('user', $user);
$this->getDriver()->userCreate($user);
$this->dispatchHooks('AfterUserCreateScope', $user);
$this->userManager->addUser($user);
return $u... | php | public function userCreate($user)
{
$this->dispatchHooks('BeforeUserCreateScope', $user);
$this->parseEntityFields('user', $user);
$this->getDriver()->userCreate($user);
$this->dispatchHooks('AfterUserCreateScope', $user);
$this->userManager->addUser($user);
return $u... | [
"public",
"function",
"userCreate",
"(",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"dispatchHooks",
"(",
"'BeforeUserCreateScope'",
",",
"$",
"user",
")",
";",
"$",
"this",
"->",
"parseEntityFields",
"(",
"'user'",
",",
"$",
"user",
")",
";",
"$",
"this"... | Create a user.
@return object
The created user. | [
"Create",
"a",
"user",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L478-L486 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.termCreate | public function termCreate($term)
{
$this->dispatchHooks('BeforeTermCreateScope', $term);
$this->parseEntityFields('taxonomy_term', $term);
$saved = $this->getDriver()->createTerm($term);
$this->dispatchHooks('AfterTermCreateScope', $saved);
$this->terms[] = $saved;
r... | php | public function termCreate($term)
{
$this->dispatchHooks('BeforeTermCreateScope', $term);
$this->parseEntityFields('taxonomy_term', $term);
$saved = $this->getDriver()->createTerm($term);
$this->dispatchHooks('AfterTermCreateScope', $saved);
$this->terms[] = $saved;
r... | [
"public",
"function",
"termCreate",
"(",
"$",
"term",
")",
"{",
"$",
"this",
"->",
"dispatchHooks",
"(",
"'BeforeTermCreateScope'",
",",
"$",
"term",
")",
";",
"$",
"this",
"->",
"parseEntityFields",
"(",
"'taxonomy_term'",
",",
"$",
"term",
")",
";",
"$",... | Create a term.
@return object
The created term. | [
"Create",
"a",
"term",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L494-L502 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.languageCreate | public function languageCreate(\stdClass $language)
{
$this->dispatchHooks('BeforeLanguageCreateScope', $language);
$language = $this->getDriver()->languageCreate($language);
if ($language) {
$this->dispatchHooks('AfterLanguageCreateScope', $language);
$this->language... | php | public function languageCreate(\stdClass $language)
{
$this->dispatchHooks('BeforeLanguageCreateScope', $language);
$language = $this->getDriver()->languageCreate($language);
if ($language) {
$this->dispatchHooks('AfterLanguageCreateScope', $language);
$this->language... | [
"public",
"function",
"languageCreate",
"(",
"\\",
"stdClass",
"$",
"language",
")",
"{",
"$",
"this",
"->",
"dispatchHooks",
"(",
"'BeforeLanguageCreateScope'",
",",
"$",
"language",
")",
";",
"$",
"language",
"=",
"$",
"this",
"->",
"getDriver",
"(",
")",
... | Creates a language.
@param \stdClass $language
An object with the following properties:
- langcode: the langcode of the language to create.
@return object|FALSE
The created language, or FALSE if the language was already created. | [
"Creates",
"a",
"language",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L514-L523 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.logout | public function logout($fast = false)
{
if ($fast && $this->getAuthenticationManager() instanceof FastLogoutInterface) {
$this->getAuthenticationManager()->fastLogout();
} else {
$this->getAuthenticationManager()->logOut();
}
} | php | public function logout($fast = false)
{
if ($fast && $this->getAuthenticationManager() instanceof FastLogoutInterface) {
$this->getAuthenticationManager()->fastLogout();
} else {
$this->getAuthenticationManager()->logOut();
}
} | [
"public",
"function",
"logout",
"(",
"$",
"fast",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fast",
"&&",
"$",
"this",
"->",
"getAuthenticationManager",
"(",
")",
"instanceof",
"FastLogoutInterface",
")",
"{",
"$",
"this",
"->",
"getAuthenticationManager",
"("... | Logs the current user out.
@param bool $fast
Utilize direct logout by session if available. | [
"Logs",
"the",
"current",
"user",
"out",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L542-L549 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawDrupalContext.php | RawDrupalContext.getContext | protected function getContext($class)
{
/** @var InitializedContextEnvironment $environment */
$environment = $this->drupal->getEnvironment();
// Throw an exception if the environment is not yet initialized. To make
// sure state doesn't leak between test scenarios, the environment i... | php | protected function getContext($class)
{
/** @var InitializedContextEnvironment $environment */
$environment = $this->drupal->getEnvironment();
// Throw an exception if the environment is not yet initialized. To make
// sure state doesn't leak between test scenarios, the environment i... | [
"protected",
"function",
"getContext",
"(",
"$",
"class",
")",
"{",
"/** @var InitializedContextEnvironment $environment */",
"$",
"environment",
"=",
"$",
"this",
"->",
"drupal",
"->",
"getEnvironment",
"(",
")",
";",
"// Throw an exception if the environment is not yet in... | Returns the Behat context that corresponds with the given class name.
This is inspired by InitializedContextEnvironment::getContext() but also
returns subclasses of the given class name. This allows us to retrieve for
example DrupalContext even if it is overridden in a project.
@param string $class
A fully namespaced... | [
"Returns",
"the",
"Behat",
"context",
"that",
"corresponds",
"with",
"the",
"given",
"class",
"name",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php#L593-L612 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php | Reader.readEnvironmentCallees | public function readEnvironmentCallees(Environment $environment)
{
if (!$environment instanceof ContextEnvironment) {
throw new EnvironmentReadException(sprintf(
'ContextEnvironmentReader does not support `%s` environment.',
get_class($environment)
),... | php | public function readEnvironmentCallees(Environment $environment)
{
if (!$environment instanceof ContextEnvironment) {
throw new EnvironmentReadException(sprintf(
'ContextEnvironmentReader does not support `%s` environment.',
get_class($environment)
),... | [
"public",
"function",
"readEnvironmentCallees",
"(",
"Environment",
"$",
"environment",
")",
"{",
"if",
"(",
"!",
"$",
"environment",
"instanceof",
"ContextEnvironment",
")",
"{",
"throw",
"new",
"EnvironmentReadException",
"(",
"sprintf",
"(",
"'ContextEnvironmentRea... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php#L80-L118 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php | Reader.findSubContextClasses | private function findSubContextClasses()
{
$class_names = array();
// Initialize any available sub-contexts.
if (isset($this->parameters['subcontexts'])) {
$paths = array();
// Drivers may specify paths to subcontexts.
if ($this->parameters['subcontexts']... | php | private function findSubContextClasses()
{
$class_names = array();
// Initialize any available sub-contexts.
if (isset($this->parameters['subcontexts'])) {
$paths = array();
// Drivers may specify paths to subcontexts.
if ($this->parameters['subcontexts']... | [
"private",
"function",
"findSubContextClasses",
"(",
")",
"{",
"$",
"class_names",
"=",
"array",
"(",
")",
";",
"// Initialize any available sub-contexts.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"parameters",
"[",
"'subcontexts'",
"]",
")",
")",
"{",
"$"... | Finds and loads available subcontext classes. | [
"Finds",
"and",
"loads",
"available",
"subcontext",
"classes",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php#L144-L183 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php | Reader.findAvailableSubContexts | private function findAvailableSubContexts($path, $pattern = '/^.+\.behat\.inc/i')
{
if (isset(static::$subContexts[$pattern][$path])) {
return static::$subContexts[$pattern][$path];
}
static::$subContexts[$pattern][$path] = array();
$fileIterator = new RegexIterator(
... | php | private function findAvailableSubContexts($path, $pattern = '/^.+\.behat\.inc/i')
{
if (isset(static::$subContexts[$pattern][$path])) {
return static::$subContexts[$pattern][$path];
}
static::$subContexts[$pattern][$path] = array();
$fileIterator = new RegexIterator(
... | [
"private",
"function",
"findAvailableSubContexts",
"(",
"$",
"path",
",",
"$",
"pattern",
"=",
"'/^.+\\.behat\\.inc/i'",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"subContexts",
"[",
"$",
"pattern",
"]",
"[",
"$",
"path",
"]",
")",
")",
"{"... | Find Sub-contexts matching a given pattern located at the passed path.
@param string $path
Absolute path to the directory to search for sub-contexts.
@param string $pattern
File pattern to match. Defaults to `/^.+\.behat\.inc/i`.
@return array
An array of paths. | [
"Find",
"Sub",
"-",
"contexts",
"matching",
"a",
"given",
"pattern",
"located",
"at",
"the",
"passed",
"path",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php#L196-L217 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php | Reader.loadSubContexts | private function loadSubContexts($subcontexts)
{
foreach ($subcontexts as $path => $subcontext) {
if (!file_exists($path)) {
throw new \RuntimeException(sprintf('Subcontext path %s path does not exist.', $path));
}
// Load file.
require_once $... | php | private function loadSubContexts($subcontexts)
{
foreach ($subcontexts as $path => $subcontext) {
if (!file_exists($path)) {
throw new \RuntimeException(sprintf('Subcontext path %s path does not exist.', $path));
}
// Load file.
require_once $... | [
"private",
"function",
"loadSubContexts",
"(",
"$",
"subcontexts",
")",
"{",
"foreach",
"(",
"$",
"subcontexts",
"as",
"$",
"path",
"=>",
"$",
"subcontext",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",... | Load each subcontext file.
@param array $subcontexts
An array of files to include. | [
"Load",
"each",
"subcontext",
"file",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/Environment/Reader/Reader.php#L225-L235 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.alterNodeParameters | public static function alterNodeParameters(BeforeNodeCreateScope $scope) {
call_user_func('parent::alterNodeParameters', $scope);
// @see `features/api.feature`
// Change 'published on' to the expected 'created'.
$node = $scope->getEntity();
if (isset($node->{"published on"})) {
$node->created... | php | public static function alterNodeParameters(BeforeNodeCreateScope $scope) {
call_user_func('parent::alterNodeParameters', $scope);
// @see `features/api.feature`
// Change 'published on' to the expected 'created'.
$node = $scope->getEntity();
if (isset($node->{"published on"})) {
$node->created... | [
"public",
"static",
"function",
"alterNodeParameters",
"(",
"BeforeNodeCreateScope",
"$",
"scope",
")",
"{",
"call_user_func",
"(",
"'parent::alterNodeParameters'",
",",
"$",
"scope",
")",
";",
"// @see `features/api.feature`",
"// Change 'published on' to the expected 'created... | Hook into node creation to test `@beforeNodeCreate`
@beforeNodeCreate | [
"Hook",
"into",
"node",
"creation",
"to",
"test",
"@beforeNodeCreate"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L28-L37 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.alterTermParameters | public static function alterTermParameters(EntityScope $scope) {
// @see `features/api.feature`
// Change 'Label' to expected 'name'.
$term = $scope->getEntity();
if (isset($term->{'Label'})) {
$term->name = $term->{'Label'};
unset($term->{'Label'});
}
} | php | public static function alterTermParameters(EntityScope $scope) {
// @see `features/api.feature`
// Change 'Label' to expected 'name'.
$term = $scope->getEntity();
if (isset($term->{'Label'})) {
$term->name = $term->{'Label'};
unset($term->{'Label'});
}
} | [
"public",
"static",
"function",
"alterTermParameters",
"(",
"EntityScope",
"$",
"scope",
")",
"{",
"// @see `features/api.feature`",
"// Change 'Label' to expected 'name'.",
"$",
"term",
"=",
"$",
"scope",
"->",
"getEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
... | Hook into term creation to test `@beforeTermCreate`
@beforeTermCreate | [
"Hook",
"into",
"term",
"creation",
"to",
"test",
"@beforeTermCreate"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L44-L52 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.alterUserParameters | public static function alterUserParameters(EntityScope $scope) {
// @see `features/api.feature`
// Concatenate 'First name' and 'Last name' to form user name.
$user = $scope->getEntity();
if (isset($user->{"First name"}) && isset($user->{"Last name"})) {
$user->name = $user->{"First name"} . ' ' .... | php | public static function alterUserParameters(EntityScope $scope) {
// @see `features/api.feature`
// Concatenate 'First name' and 'Last name' to form user name.
$user = $scope->getEntity();
if (isset($user->{"First name"}) && isset($user->{"Last name"})) {
$user->name = $user->{"First name"} . ' ' .... | [
"public",
"static",
"function",
"alterUserParameters",
"(",
"EntityScope",
"$",
"scope",
")",
"{",
"// @see `features/api.feature`",
"// Concatenate 'First name' and 'Last name' to form user name.",
"$",
"user",
"=",
"$",
"scope",
"->",
"getEntity",
"(",
")",
";",
"if",
... | Hook into user creation to test `@beforeUserCreate`
@beforeUserCreate | [
"Hook",
"into",
"user",
"creation",
"to",
"test",
"@beforeUserCreate"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L59-L72 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.castUsersTable | public function castUsersTable(TableNode $user_table) {
$aliases = array(
'country' => 'field_post_address:country',
'city' => 'field_post_address:locality',
'street' => 'field_post_address:thoroughfare',
'postcode' => 'field_post_address:postal_code',
);
// The first row of the tab... | php | public function castUsersTable(TableNode $user_table) {
$aliases = array(
'country' => 'field_post_address:country',
'city' => 'field_post_address:locality',
'street' => 'field_post_address:thoroughfare',
'postcode' => 'field_post_address:postal_code',
);
// The first row of the tab... | [
"public",
"function",
"castUsersTable",
"(",
"TableNode",
"$",
"user_table",
")",
"{",
"$",
"aliases",
"=",
"array",
"(",
"'country'",
"=>",
"'field_post_address:country'",
",",
"'city'",
"=>",
"'field_post_address:locality'",
",",
"'street'",
"=>",
"'field_post_addre... | Transforms long address field columns into shorter aliases.
This is used in field_handlers.feature for testing if lengthy field:column
combinations can be shortened to more human friendly aliases.
@Transform table:name,mail,street,city,postcode,country | [
"Transforms",
"long",
"address",
"field",
"columns",
"into",
"shorter",
"aliases",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L115-L136 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.transformPostContentTable | public function transformPostContentTable(TableNode $post_table) {
$aliases = array(
'reference' => 'field_post_reference',
'date' => 'field_post_date',
'links' => 'field_post_links',
'select' => 'field_post_select',
'address' => 'field_post_address',
);
$table = $post_table->... | php | public function transformPostContentTable(TableNode $post_table) {
$aliases = array(
'reference' => 'field_post_reference',
'date' => 'field_post_date',
'links' => 'field_post_links',
'select' => 'field_post_select',
'address' => 'field_post_address',
);
$table = $post_table->... | [
"public",
"function",
"transformPostContentTable",
"(",
"TableNode",
"$",
"post_table",
")",
"{",
"$",
"aliases",
"=",
"array",
"(",
"'reference'",
"=>",
"'field_post_reference'",
",",
"'date'",
"=>",
"'field_post_date'",
",",
"'links'",
"=>",
"'field_post_links'",
... | Transforms human readable field names into machine names.
This is used in field_handlers.feature for testing if human readable names
can be used instead of machine names in tests.
@param TableNode $post_table
The original table.
@return TableNode
The transformed table.
@Transform rowtable:title,body,reference,date,... | [
"Transforms",
"human",
"readable",
"field",
"names",
"into",
"machine",
"names",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L152-L171 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.assertAuthenticatedByUsernameAndPassword | public function assertAuthenticatedByUsernameAndPassword($name, $password) {
$user = (object) [
'name' => $name,
'pass' => $password,
];
$this->userCreate($user);
$this->login($user);
} | php | public function assertAuthenticatedByUsernameAndPassword($name, $password) {
$user = (object) [
'name' => $name,
'pass' => $password,
];
$this->userCreate($user);
$this->login($user);
} | [
"public",
"function",
"assertAuthenticatedByUsernameAndPassword",
"(",
"$",
"name",
",",
"$",
"password",
")",
"{",
"$",
"user",
"=",
"(",
"object",
")",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'pass'",
"=>",
"$",
"password",
",",
"]",
";",
"$",
"this",
... | Creates and authenticates a user with the given username and password.
In Drupal 8 it is possible to register a user without an e-mail address,
using only a username and password.
This step definition is intended to test if users that are registered in
one context (in this case FeatureContext) can be accessed in othe... | [
"Creates",
"and",
"authenticates",
"a",
"user",
"with",
"the",
"given",
"username",
"and",
"password",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L188-L195 |
jhedstrom/drupalextension | features/bootstrap/FeatureContext.php | FeatureContext.fileShouldContain | public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
... | php | public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
... | [
"public",
"function",
"fileShouldContain",
"(",
"$",
"path",
",",
"PyStringNode",
"$",
"text",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"workingDir",
".",
"'/'",
".",
"$",
"path",
";",
"PHPUnit_Framework_Assert",
"::",
"assertFileExists",
"(",
"$",
"... | Checks whether specified file exists and contains specified string.
@Then /^"([^"]*)" file should contain:$/
@param string $path file path
@param PyStringNode $text file content | [
"Checks",
"whether",
"specified",
"file",
"exists",
"and",
"contains",
"specified",
"string",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/features/bootstrap/FeatureContext.php#L350-L362 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.load | public function load(ContainerBuilder $container, array $config)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/config'));
$loader->load('services.yml');
$container->setParameter('drupal.drupal.default_driver', $config['default_driver']);
$this->loadParameter... | php | public function load(ContainerBuilder $container, array $config)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/config'));
$loader->load('services.yml');
$container->setParameter('drupal.drupal.default_driver', $config['default_driver']);
$this->loadParameter... | [
"public",
"function",
"load",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"$",
"loader",
"=",
"new",
"YamlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/config'",
")",
")",
";",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L64-L76 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.process | public function process(ContainerBuilder $container)
{
$this->processDriverPass($container);
$this->processEventSubscriberPass($container);
$this->processEnvironmentReaderPass($container);
$this->processClassGenerator($container);
} | php | public function process(ContainerBuilder $container)
{
$this->processDriverPass($container);
$this->processEventSubscriberPass($container);
$this->processEnvironmentReaderPass($container);
$this->processClassGenerator($container);
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"processDriverPass",
"(",
"$",
"container",
")",
";",
"$",
"this",
"->",
"processEventSubscriberPass",
"(",
"$",
"container",
")",
";",
"$",
"this",
"->"... | {@inheritDoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L81-L87 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.configure | public function configure(ArrayNodeDefinition $builder)
{
$builder->
children()->
scalarNode('default_driver')->
defaultValue('blackbox')->
info('Use "blackbox" to test remote site. See "api_driver" for easier integration.')->
end()->
scalarNode('api_drive... | php | public function configure(ArrayNodeDefinition $builder)
{
$builder->
children()->
scalarNode('default_driver')->
defaultValue('blackbox')->
info('Use "blackbox" to test remote site. See "api_driver" for easier integration.')->
end()->
scalarNode('api_drive... | [
"public",
"function",
"configure",
"(",
"ArrayNodeDefinition",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'default_driver'",
")",
"->",
"defaultValue",
"(",
"'blackbox'",
")",
"->",
"info",
"(",
"'Use \"blac... | {@inheritDoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L92-L204 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.loadParameters | private function loadParameters(ContainerBuilder $container, array $config)
{
// Store config in parameters array to be passed into the DrupalContext.
$drupal_parameters = array();
foreach ($config as $key => $value) {
$drupal_parameters[$key] = $value;
}
$contain... | php | private function loadParameters(ContainerBuilder $container, array $config)
{
// Store config in parameters array to be passed into the DrupalContext.
$drupal_parameters = array();
foreach ($config as $key => $value) {
$drupal_parameters[$key] = $value;
}
$contain... | [
"private",
"function",
"loadParameters",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"// Store config in parameters array to be passed into the DrupalContext.",
"$",
"drupal_parameters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
... | Load test parameters. | [
"Load",
"test",
"parameters",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L209-L219 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.loadDrupal | private function loadDrupal(FileLoader $loader, ContainerBuilder $container, array $config)
{
if (isset($config['drupal'])) {
$loader->load('drivers/drupal.yml');
$container->setParameter('drupal.driver.drupal.drupal_root', $config['drupal']['drupal_root']);
}
} | php | private function loadDrupal(FileLoader $loader, ContainerBuilder $container, array $config)
{
if (isset($config['drupal'])) {
$loader->load('drivers/drupal.yml');
$container->setParameter('drupal.driver.drupal.drupal_root', $config['drupal']['drupal_root']);
}
} | [
"private",
"function",
"loadDrupal",
"(",
"FileLoader",
"$",
"loader",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'drupal'",
"]",
")",
")",
"{",
"$",
"loader",
"->",
"... | Load the Drupal driver. | [
"Load",
"the",
"Drupal",
"driver",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L233-L239 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.loadDrush | private function loadDrush(FileLoader $loader, ContainerBuilder $container, array $config)
{
if (isset($config['drush'])) {
$loader->load('drivers/drush.yml');
if (!isset($config['drush']['alias']) && !isset($config['drush']['root'])) {
throw new \RuntimeException('Dr... | php | private function loadDrush(FileLoader $loader, ContainerBuilder $container, array $config)
{
if (isset($config['drush'])) {
$loader->load('drivers/drush.yml');
if (!isset($config['drush']['alias']) && !isset($config['drush']['root'])) {
throw new \RuntimeException('Dr... | [
"private",
"function",
"loadDrush",
"(",
"FileLoader",
"$",
"loader",
",",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'drush'",
"]",
")",
")",
"{",
"$",
"loader",
"->",
"lo... | Load the Drush driver. | [
"Load",
"the",
"Drush",
"driver",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L244-L263 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.setDrushOptions | private function setDrushOptions(ContainerBuilder $container, array $config)
{
if (isset($config['drush']['global_options'])) {
$definition = $container->getDefinition('drupal.driver.drush');
$definition->addMethodCall('setArguments', array($config['drush']['global_options']));
... | php | private function setDrushOptions(ContainerBuilder $container, array $config)
{
if (isset($config['drush']['global_options'])) {
$definition = $container->getDefinition('drupal.driver.drush');
$definition->addMethodCall('setArguments', array($config['drush']['global_options']));
... | [
"private",
"function",
"setDrushOptions",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'drush'",
"]",
"[",
"'global_options'",
"]",
")",
")",
"{",
"$",
"definition",
"=",
... | Set global drush arguments. | [
"Set",
"global",
"drush",
"arguments",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L268-L274 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.processEnvironmentReaderPass | private function processEnvironmentReaderPass(ContainerBuilder $container)
{
// Register Behat context readers.
$references = $this->processor->findAndSortTaggedServices($container, ContextExtension::READER_TAG);
$definition = $container->getDefinition('drupal.context.environment.reader');
... | php | private function processEnvironmentReaderPass(ContainerBuilder $container)
{
// Register Behat context readers.
$references = $this->processor->findAndSortTaggedServices($container, ContextExtension::READER_TAG);
$definition = $container->getDefinition('drupal.context.environment.reader');
... | [
"private",
"function",
"processEnvironmentReaderPass",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// Register Behat context readers.",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"Cont... | Process the Environment Reader pass. | [
"Process",
"the",
"Environment",
"Reader",
"pass",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L297-L306 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php | DrupalExtension.processClassGenerator | private function processClassGenerator(ContainerBuilder $container)
{
$definition = new Definition('Drupal\DrupalExtension\Context\ContextClass\ClassGenerator');
$container->setDefinition(ContextExtension::CLASS_GENERATOR_TAG . '.simple', $definition);
} | php | private function processClassGenerator(ContainerBuilder $container)
{
$definition = new Definition('Drupal\DrupalExtension\Context\ContextClass\ClassGenerator');
$container->setDefinition(ContextExtension::CLASS_GENERATOR_TAG . '.simple', $definition);
} | [
"private",
"function",
"processClassGenerator",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Drupal\\DrupalExtension\\Context\\ContextClass\\ClassGenerator'",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(... | Switch to custom class generator. | [
"Switch",
"to",
"custom",
"class",
"generator",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php#L311-L315 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.assertAuthenticatedByRole | public function assertAuthenticatedByRole($role)
{
// Check if a user with this role is already logged in.
if (!$this->loggedInWithRole($role)) {
// Create user (and project)
$user = (object) array(
'name' => $this->getRandom()->name(8),
'pass' => $thi... | php | public function assertAuthenticatedByRole($role)
{
// Check if a user with this role is already logged in.
if (!$this->loggedInWithRole($role)) {
// Create user (and project)
$user = (object) array(
'name' => $this->getRandom()->name(8),
'pass' => $thi... | [
"public",
"function",
"assertAuthenticatedByRole",
"(",
"$",
"role",
")",
"{",
"// Check if a user with this role is already logged in.",
"if",
"(",
"!",
"$",
"this",
"->",
"loggedInWithRole",
"(",
"$",
"role",
")",
")",
"{",
"// Create user (and project)",
"$",
"user... | Creates and authenticates a user with the given role(s).
@Given I am logged in as a user with the :role role(s)
@Given I am logged in as a/an :role | [
"Creates",
"and",
"authenticates",
"a",
"user",
"with",
"the",
"given",
"role",
"(",
"s",
")",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L43-L69 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.assertAuthenticatedByRoleWithGivenFields | public function assertAuthenticatedByRoleWithGivenFields($role, TableNode $fields)
{
// Check if a user with this role is already logged in.
if (!$this->loggedInWithRole($role)) {
// Create user (and project)
$user = (object) array(
'name' => $this->getRandom()->n... | php | public function assertAuthenticatedByRoleWithGivenFields($role, TableNode $fields)
{
// Check if a user with this role is already logged in.
if (!$this->loggedInWithRole($role)) {
// Create user (and project)
$user = (object) array(
'name' => $this->getRandom()->n... | [
"public",
"function",
"assertAuthenticatedByRoleWithGivenFields",
"(",
"$",
"role",
",",
"TableNode",
"$",
"fields",
")",
"{",
"// Check if a user with this role is already logged in.",
"if",
"(",
"!",
"$",
"this",
"->",
"loggedInWithRole",
"(",
"$",
"role",
")",
")",... | Creates and authenticates a user with the given role(s) and given fields.
| field_user_name | John |
| field_user_surname | Smith |
| ... | ... |
@Given I am logged in as a user with the :role role(s) and I have the following fields: | [
"Creates",
"and",
"authenticates",
"a",
"user",
"with",
"the",
"given",
"role",
"(",
"s",
")",
"and",
"given",
"fields",
".",
"|",
"field_user_name",
"|",
"John",
"|",
"|",
"field_user_surname",
"|",
"Smith",
"|",
"|",
"...",
"|",
"...",
"|"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L79-L110 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.getTableRow | public function getTableRow(Element $element, $search)
{
$rows = $element->findAll('css', 'tr');
if (empty($rows)) {
throw new \Exception(sprintf('No rows found on the page %s', $this->getSession()->getCurrentUrl()));
}
foreach ($rows as $row) {
if (strpos($ro... | php | public function getTableRow(Element $element, $search)
{
$rows = $element->findAll('css', 'tr');
if (empty($rows)) {
throw new \Exception(sprintf('No rows found on the page %s', $this->getSession()->getCurrentUrl()));
}
foreach ($rows as $row) {
if (strpos($ro... | [
"public",
"function",
"getTableRow",
"(",
"Element",
"$",
"element",
",",
"$",
"search",
")",
"{",
"$",
"rows",
"=",
"$",
"element",
"->",
"findAll",
"(",
"'css'",
",",
"'tr'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"rows",
")",
")",
"{",
"throw",... | Retrieve a table row containing specified text from a given element.
@param \Behat\Mink\Element\Element
@param string
The text to search for in the table row.
@return \Behat\Mink\Element\NodeElement
@throws \Exception | [
"Retrieve",
"a",
"table",
"row",
"containing",
"specified",
"text",
"from",
"a",
"given",
"element",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L164-L176 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.assertTextInTableRow | public function assertTextInTableRow($text, $rowText)
{
$row = $this->getTableRow($this->getSession()->getPage(), $rowText);
if (strpos($row->getText(), $text) === false) {
throw new \Exception(sprintf('Found a row containing "%s", but it did not contain the text "%s".', $rowText, $text)... | php | public function assertTextInTableRow($text, $rowText)
{
$row = $this->getTableRow($this->getSession()->getPage(), $rowText);
if (strpos($row->getText(), $text) === false) {
throw new \Exception(sprintf('Found a row containing "%s", but it did not contain the text "%s".', $rowText, $text)... | [
"public",
"function",
"assertTextInTableRow",
"(",
"$",
"text",
",",
"$",
"rowText",
")",
"{",
"$",
"row",
"=",
"$",
"this",
"->",
"getTableRow",
"(",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getPage",
"(",
")",
",",
"$",
"rowText",
")",
";"... | Find text in a table row containing given text.
@Then I should see (the text ):text in the :rowText row | [
"Find",
"text",
"in",
"a",
"table",
"row",
"containing",
"given",
"text",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L183-L189 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createNode | public function createNode($type, $title)
{
// @todo make this easily extensible.
$node = (object) array(
'title' => $title,
'type' => $type,
);
$saved = $this->nodeCreate($node);
// Set internal page on the new node.
$this->getSession()->visit($this->... | php | public function createNode($type, $title)
{
// @todo make this easily extensible.
$node = (object) array(
'title' => $title,
'type' => $type,
);
$saved = $this->nodeCreate($node);
// Set internal page on the new node.
$this->getSession()->visit($this->... | [
"public",
"function",
"createNode",
"(",
"$",
"type",
",",
"$",
"title",
")",
"{",
"// @todo make this easily extensible.",
"$",
"node",
"=",
"(",
"object",
")",
"array",
"(",
"'title'",
"=>",
"$",
"title",
",",
"'type'",
"=>",
"$",
"type",
",",
")",
";"... | Creates content of the given type.
@Given I am viewing a/an :type (content )with the title :title
@Given a/an :type (content )with the title :title | [
"Creates",
"content",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L245-L255 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createMyNode | public function createMyNode($type, $title)
{
if ($this->getUserManager()->currentUserIsAnonymous()) {
throw new \Exception(sprintf('There is no current logged in user to create a node for.'));
}
$node = (object) array(
'title' => $title,
'type' => $type,
... | php | public function createMyNode($type, $title)
{
if ($this->getUserManager()->currentUserIsAnonymous()) {
throw new \Exception(sprintf('There is no current logged in user to create a node for.'));
}
$node = (object) array(
'title' => $title,
'type' => $type,
... | [
"public",
"function",
"createMyNode",
"(",
"$",
"type",
",",
"$",
"title",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"currentUserIsAnonymous",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"... | Creates content authored by the current user.
@Given I am viewing my :type (content )with the title :title | [
"Creates",
"content",
"authored",
"by",
"the",
"current",
"user",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L262-L278 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createNodes | public function createNodes($type, TableNode $nodesTable)
{
foreach ($nodesTable->getHash() as $nodeHash) {
$node = (object) $nodeHash;
$node->type = $type;
$this->nodeCreate($node);
}
} | php | public function createNodes($type, TableNode $nodesTable)
{
foreach ($nodesTable->getHash() as $nodeHash) {
$node = (object) $nodeHash;
$node->type = $type;
$this->nodeCreate($node);
}
} | [
"public",
"function",
"createNodes",
"(",
"$",
"type",
",",
"TableNode",
"$",
"nodesTable",
")",
"{",
"foreach",
"(",
"$",
"nodesTable",
"->",
"getHash",
"(",
")",
"as",
"$",
"nodeHash",
")",
"{",
"$",
"node",
"=",
"(",
"object",
")",
"$",
"nodeHash",
... | Creates content of a given type provided in the form:
| title | author | status | created |
| My title | Joe Editor | 1 | 2014-10-17 8:00am |
| ... | ... | ... | ... |
@Given :type content: | [
"Creates",
"content",
"of",
"a",
"given",
"type",
"provided",
"in",
"the",
"form",
":",
"|",
"title",
"|",
"author",
"|",
"status",
"|",
"created",
"|",
"|",
"My",
"title",
"|",
"Joe",
"Editor",
"|",
"1",
"|",
"2014",
"-",
"10",
"-",
"17",
"8",
"... | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L288-L295 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.assertViewingNode | public function assertViewingNode($type, TableNode $fields)
{
$node = (object) array(
'type' => $type,
);
foreach ($fields->getRowsHash() as $field => $value) {
$node->{$field} = $value;
}
$saved = $this->nodeCreate($node);
// Set internal browse... | php | public function assertViewingNode($type, TableNode $fields)
{
$node = (object) array(
'type' => $type,
);
foreach ($fields->getRowsHash() as $field => $value) {
$node->{$field} = $value;
}
$saved = $this->nodeCreate($node);
// Set internal browse... | [
"public",
"function",
"assertViewingNode",
"(",
"$",
"type",
",",
"TableNode",
"$",
"fields",
")",
"{",
"$",
"node",
"=",
"(",
"object",
")",
"array",
"(",
"'type'",
"=>",
"$",
"type",
",",
")",
";",
"foreach",
"(",
"$",
"fields",
"->",
"getRowsHash",
... | Creates content of the given type, provided in the form:
| title | My node |
| Field One | My field value |
| author | Joe Editor |
| status | 1 |
| ... | ... |
@Given I am viewing a/an :type( content): | [
"Creates",
"content",
"of",
"the",
"given",
"type",
"provided",
"in",
"the",
"form",
":",
"|",
"title",
"|",
"My",
"node",
"|",
"|",
"Field",
"One",
"|",
"My",
"field",
"value",
"|",
"|",
"author",
"|",
"Joe",
"Editor",
"|",
"|",
"status",
"|",
"1"... | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L307-L320 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.assertEditNodeOfType | public function assertEditNodeOfType($type)
{
$node = (object) array(
'type' => $type,
'title' => "Test $type",
);
$saved = $this->nodeCreate($node);
// Set internal browser on the node edit page.
$this->getSession()->visit($this->locatePath('/node/' . $saved... | php | public function assertEditNodeOfType($type)
{
$node = (object) array(
'type' => $type,
'title' => "Test $type",
);
$saved = $this->nodeCreate($node);
// Set internal browser on the node edit page.
$this->getSession()->visit($this->locatePath('/node/' . $saved... | [
"public",
"function",
"assertEditNodeOfType",
"(",
"$",
"type",
")",
"{",
"$",
"node",
"=",
"(",
"object",
")",
"array",
"(",
"'type'",
"=>",
"$",
"type",
",",
"'title'",
"=>",
"\"Test $type\"",
",",
")",
";",
"$",
"saved",
"=",
"$",
"this",
"->",
"n... | Asserts that a given content type is editable.
@Then I should be able to edit a/an :type( content) | [
"Asserts",
"that",
"a",
"given",
"content",
"type",
"is",
"editable",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L327-L340 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createTerm | public function createTerm($vocabulary, $name)
{
// @todo make this easily extensible.
$term = (object) array(
'name' => $name,
'vocabulary_machine_name' => $vocabulary,
'description' => $this->getRandom()->name(255),
);
$saved = $this->termCreate($term);
... | php | public function createTerm($vocabulary, $name)
{
// @todo make this easily extensible.
$term = (object) array(
'name' => $name,
'vocabulary_machine_name' => $vocabulary,
'description' => $this->getRandom()->name(255),
);
$saved = $this->termCreate($term);
... | [
"public",
"function",
"createTerm",
"(",
"$",
"vocabulary",
",",
"$",
"name",
")",
"{",
"// @todo make this easily extensible.",
"$",
"term",
"=",
"(",
"object",
")",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'vocabulary_machine_name'",
"=>",
"$",
"voca... | Creates a term on an existing vocabulary.
@Given I am viewing a/an :vocabulary term with the name :name
@Given a/an :vocabulary term with the name :name | [
"Creates",
"a",
"term",
"on",
"an",
"existing",
"vocabulary",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L349-L361 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createUsers | public function createUsers(TableNode $usersTable)
{
foreach ($usersTable->getHash() as $userHash) {
// Split out roles to process after user is created.
$roles = array();
if (isset($userHash['roles'])) {
$roles = explode(',', $userHash['roles']);
... | php | public function createUsers(TableNode $usersTable)
{
foreach ($usersTable->getHash() as $userHash) {
// Split out roles to process after user is created.
$roles = array();
if (isset($userHash['roles'])) {
$roles = explode(',', $userHash['roles']);
... | [
"public",
"function",
"createUsers",
"(",
"TableNode",
"$",
"usersTable",
")",
"{",
"foreach",
"(",
"$",
"usersTable",
"->",
"getHash",
"(",
")",
"as",
"$",
"userHash",
")",
"{",
"// Split out roles to process after user is created.",
"$",
"roles",
"=",
"array",
... | Creates multiple users.
Provide user data in the following format:
| name | mail | roles |
| user foo | foo@bar.com | role1, role2 |
@Given users: | [
"Creates",
"multiple",
"users",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L373-L396 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createTerms | public function createTerms($vocabulary, TableNode $termsTable)
{
foreach ($termsTable->getHash() as $termsHash) {
$term = (object) $termsHash;
$term->vocabulary_machine_name = $vocabulary;
$this->termCreate($term);
}
} | php | public function createTerms($vocabulary, TableNode $termsTable)
{
foreach ($termsTable->getHash() as $termsHash) {
$term = (object) $termsHash;
$term->vocabulary_machine_name = $vocabulary;
$this->termCreate($term);
}
} | [
"public",
"function",
"createTerms",
"(",
"$",
"vocabulary",
",",
"TableNode",
"$",
"termsTable",
")",
"{",
"foreach",
"(",
"$",
"termsTable",
"->",
"getHash",
"(",
")",
"as",
"$",
"termsHash",
")",
"{",
"$",
"term",
"=",
"(",
"object",
")",
"$",
"term... | Creates one or more terms on an existing vocabulary.
Provide term data in the following format:
| name | parent | description | weight | taxonomy_field_image |
| Snook | Fish | Marine fish | 10 | snook-123.jpg |
| ... | ... | ... | ... | ... |
Only the 'name' field is r... | [
"Creates",
"one",
"or",
"more",
"terms",
"on",
"an",
"existing",
"vocabulary",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L411-L418 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.createLanguages | public function createLanguages(TableNode $langcodesTable)
{
foreach ($langcodesTable->getHash() as $row) {
$language = (object) array(
'langcode' => $row['languages'],
);
$this->languageCreate($language);
}
} | php | public function createLanguages(TableNode $langcodesTable)
{
foreach ($langcodesTable->getHash() as $row) {
$language = (object) array(
'langcode' => $row['languages'],
);
$this->languageCreate($language);
}
} | [
"public",
"function",
"createLanguages",
"(",
"TableNode",
"$",
"langcodesTable",
")",
"{",
"foreach",
"(",
"$",
"langcodesTable",
"->",
"getHash",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"language",
"=",
"(",
"object",
")",
"array",
"(",
"'langcode'",
... | Creates one or more languages.
@Given the/these (following )languages are available:
Provide language data in the following format:
| langcode |
| en |
| fr |
@param TableNode $langcodesTable
The table listing languages by their ISO code. | [
"Creates",
"one",
"or",
"more",
"languages",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L434-L442 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/DrupalContext.php | DrupalContext.iPutABreakpoint | public function iPutABreakpoint()
{
fwrite(STDOUT, "\033[s \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue, or 'q' to quit...\033[0m");
do {
$line = trim(fgets(STDIN, 1024));
//Note: this assumes ASCII encoding. Should probably be revamped to
... | php | public function iPutABreakpoint()
{
fwrite(STDOUT, "\033[s \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue, or 'q' to quit...\033[0m");
do {
$line = trim(fgets(STDIN, 1024));
//Note: this assumes ASCII encoding. Should probably be revamped to
... | [
"public",
"function",
"iPutABreakpoint",
"(",
")",
"{",
"fwrite",
"(",
"STDOUT",
",",
"\"\\033[s \\033[93m[Breakpoint] Press \\033[1;93m[RETURN]\\033[0;93m to continue, or 'q' to quit...\\033[0m\"",
")",
";",
"do",
"{",
"$",
"line",
"=",
"trim",
"(",
"fgets",
"(",
"STDIN"... | Pauses the scenario until the user presses a key. Useful when debugging a scenario.
@Then (I )break | [
"Pauses",
"the",
"scenario",
"until",
"the",
"user",
"presses",
"a",
"key",
".",
"Useful",
"when",
"debugging",
"a",
"scenario",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/DrupalContext.php#L449-L473 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/TagTrait.php | TagTrait.getTags | protected function getTags()
{
$featureTags = $this->getFeature()->getTags();
$scenarioTags = $this->getScenario()->getTags();
return array_unique(array_merge($featureTags, $scenarioTags));
} | php | protected function getTags()
{
$featureTags = $this->getFeature()->getTags();
$scenarioTags = $this->getScenario()->getTags();
return array_unique(array_merge($featureTags, $scenarioTags));
} | [
"protected",
"function",
"getTags",
"(",
")",
"{",
"$",
"featureTags",
"=",
"$",
"this",
"->",
"getFeature",
"(",
")",
"->",
"getTags",
"(",
")",
";",
"$",
"scenarioTags",
"=",
"$",
"this",
"->",
"getScenario",
"(",
")",
"->",
"getTags",
"(",
")",
";... | Returns all tags for the current scenario and feature.
@return string[] | [
"Returns",
"all",
"tags",
"for",
"the",
"current",
"scenario",
"and",
"feature",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/TagTrait.php#L17-L22 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalUserManager.php | DrupalUserManager.getUser | public function getUser($userName)
{
if (!isset($this->users[$userName])) {
throw new \Exception(sprintf('No user with %s name is registered with the driver.', $userName));
}
return $this->users[$userName];
} | php | public function getUser($userName)
{
if (!isset($this->users[$userName])) {
throw new \Exception(sprintf('No user with %s name is registered with the driver.', $userName));
}
return $this->users[$userName];
} | [
"public",
"function",
"getUser",
"(",
"$",
"userName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"users",
"[",
"$",
"userName",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'No user with %s name is registe... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalUserManager.php#L60-L66 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Manager/DrupalUserManager.php | DrupalUserManager.currentUserHasRole | public function currentUserHasRole($role)
{
return !$this->currentUserIsAnonymous() && !empty($this->user->role) && $this->user->role == $role;
} | php | public function currentUserHasRole($role)
{
return !$this->currentUserIsAnonymous() && !empty($this->user->role) && $this->user->role == $role;
} | [
"public",
"function",
"currentUserHasRole",
"(",
"$",
"role",
")",
"{",
"return",
"!",
"$",
"this",
"->",
"currentUserIsAnonymous",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"user",
"->",
"role",
")",
"&&",
"$",
"this",
"->",
"user",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Manager/DrupalUserManager.php#L104-L107 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.disableMail | public function disableMail($event)
{
$tags = array_merge($event->getFeature()->getTags(), $event->getScenario()->getTags());
if (!in_array('sendmail', $tags) && !in_array('sendemail', $tags)) {
$this->getMailManager()->disableMail();
// Always reset mail count, in case the d... | php | public function disableMail($event)
{
$tags = array_merge($event->getFeature()->getTags(), $event->getScenario()->getTags());
if (!in_array('sendmail', $tags) && !in_array('sendemail', $tags)) {
$this->getMailManager()->disableMail();
// Always reset mail count, in case the d... | [
"public",
"function",
"disableMail",
"(",
"$",
"event",
")",
"{",
"$",
"tags",
"=",
"array_merge",
"(",
"$",
"event",
"->",
"getFeature",
"(",
")",
"->",
"getTags",
"(",
")",
",",
"$",
"event",
"->",
"getScenario",
"(",
")",
"->",
"getTags",
"(",
")"... | By default, prevent mail from being actually sent out during tests.
@BeforeScenario | [
"By",
"default",
"prevent",
"mail",
"from",
"being",
"actually",
"sent",
"out",
"during",
"tests",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L18-L28 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.enableMail | public function enableMail($event)
{
$tags = array_merge($event->getFeature()->getTags(), $event->getScenario()->getTags());
if (!in_array('sendmail', $tags) && !in_array('sendemail', $tags)) {
$this->getMailManager()->enableMail();
}
} | php | public function enableMail($event)
{
$tags = array_merge($event->getFeature()->getTags(), $event->getScenario()->getTags());
if (!in_array('sendmail', $tags) && !in_array('sendemail', $tags)) {
$this->getMailManager()->enableMail();
}
} | [
"public",
"function",
"enableMail",
"(",
"$",
"event",
")",
"{",
"$",
"tags",
"=",
"array_merge",
"(",
"$",
"event",
"->",
"getFeature",
"(",
")",
"->",
"getTags",
"(",
")",
",",
"$",
"event",
"->",
"getScenario",
"(",
")",
"->",
"getTags",
"(",
")",... | Restore mail sending.
@AfterScenario | [
"Restore",
"mail",
"sending",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L35-L41 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.drupalSendsMail | public function drupalSendsMail(TableNode $fields)
{
$mail = [
'body' => $this->getRandom()->name(255),
'subject' => $this->getRandom()->name(20),
'to' => $this->getRandom()->name(10) . '@anonexample.com',
'langcode' => '',
];
foreach ($fields->getRowsHash() a... | php | public function drupalSendsMail(TableNode $fields)
{
$mail = [
'body' => $this->getRandom()->name(255),
'subject' => $this->getRandom()->name(20),
'to' => $this->getRandom()->name(10) . '@anonexample.com',
'langcode' => '',
];
foreach ($fields->getRowsHash() a... | [
"public",
"function",
"drupalSendsMail",
"(",
"TableNode",
"$",
"fields",
")",
"{",
"$",
"mail",
"=",
"[",
"'body'",
"=>",
"$",
"this",
"->",
"getRandom",
"(",
")",
"->",
"name",
"(",
"255",
")",
",",
"'subject'",
"=>",
"$",
"this",
"->",
"getRandom",
... | This is mainly useful for testing this context.
@When Drupal sends a/an (e)mail: | [
"This",
"is",
"mainly",
"useful",
"for",
"testing",
"this",
"context",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L69-L81 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.mailHasBeenSent | public function mailHasBeenSent(TableNode $expectedMailTable, $to = '', $subject = '')
{
$expectedMail = $expectedMailTable->getHash();
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], false);
$this->compareMail($actualMail, $expectedMail);
} | php | public function mailHasBeenSent(TableNode $expectedMailTable, $to = '', $subject = '')
{
$expectedMail = $expectedMailTable->getHash();
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], false);
$this->compareMail($actualMail, $expectedMail);
} | [
"public",
"function",
"mailHasBeenSent",
"(",
"TableNode",
"$",
"expectedMailTable",
",",
"$",
"to",
"=",
"''",
",",
"$",
"subject",
"=",
"''",
")",
"{",
"$",
"expectedMail",
"=",
"$",
"expectedMailTable",
"->",
"getHash",
"(",
")",
";",
"$",
"actualMail",... | Check all mail sent during the scenario.
@Then (a )(an )(e)mail(s) has/have been sent:
@Then (a )(an )(e)mail(s) has/have been sent to :to:
@Then (a )(an )(e)mail(s) has/have been sent with the subject :subject:
@Then (a )(an )(e)mail(s) has/have been sent to :to with the subject :subject: | [
"Check",
"all",
"mail",
"sent",
"during",
"the",
"scenario",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L91-L96 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.newMailIsSent | public function newMailIsSent(TableNode $expectedMailTable, $to = '', $subject = '')
{
$expectedMail = $expectedMailTable->getHash();
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], true);
$this->compareMail($actualMail, $expectedMail);
} | php | public function newMailIsSent(TableNode $expectedMailTable, $to = '', $subject = '')
{
$expectedMail = $expectedMailTable->getHash();
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], true);
$this->compareMail($actualMail, $expectedMail);
} | [
"public",
"function",
"newMailIsSent",
"(",
"TableNode",
"$",
"expectedMailTable",
",",
"$",
"to",
"=",
"''",
",",
"$",
"subject",
"=",
"''",
")",
"{",
"$",
"expectedMail",
"=",
"$",
"expectedMailTable",
"->",
"getHash",
"(",
")",
";",
"$",
"actualMail",
... | Check mail sent since the last step that checked mail.
@Then (a )(an )new (e)mail(s) is/are sent:
@Then (a )(an )new (e)mail(s) is/are sent to :to:
@Then (a )(an )new (e)mail(s) is/are sent with the subject :subject:
@Then (a )(an )new (e)mail(s) is/are sent to :to with the subject :subject: | [
"Check",
"mail",
"sent",
"since",
"the",
"last",
"step",
"that",
"checked",
"mail",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L106-L111 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.noMailHasBeenSent | public function noMailHasBeenSent($count, $to = '', $subject = '')
{
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], false);
$count = $count === 'no' ? 0 : $count;
$count = $count === 'a' ? null : $count;
$count = $count === 'an' ? null : $count;
$this->ass... | php | public function noMailHasBeenSent($count, $to = '', $subject = '')
{
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], false);
$count = $count === 'no' ? 0 : $count;
$count = $count === 'a' ? null : $count;
$count = $count === 'an' ? null : $count;
$this->ass... | [
"public",
"function",
"noMailHasBeenSent",
"(",
"$",
"count",
",",
"$",
"to",
"=",
"''",
",",
"$",
"subject",
"=",
"''",
")",
"{",
"$",
"actualMail",
"=",
"$",
"this",
"->",
"getMail",
"(",
"[",
"'to'",
"=>",
"$",
"to",
",",
"'subject'",
"=>",
"$",... | Check all mail sent during the scenario.
@Then :count (e)mail(s) has/have been sent
@Then :count (e)mail(s) has/have been sent to :to
@Then :count (e)mail(s) has/have been sent with the subject :subject
@Then :count (e)mail(s) has/have been sent to :to with the subject :subject | [
"Check",
"all",
"mail",
"sent",
"during",
"the",
"scenario",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L121-L128 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MailContext.php | MailContext.noNewMailIsSent | public function noNewMailIsSent($count, $to = '', $subject = '')
{
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], true);
$count = $count === 'no' ? 0 : $count;
$count = $count === 'a' ? 1 : $count;
$count = $count === 'an' ? 1 : $count;
$this->assertMailCo... | php | public function noNewMailIsSent($count, $to = '', $subject = '')
{
$actualMail = $this->getMail(['to' => $to, 'subject' => $subject], true);
$count = $count === 'no' ? 0 : $count;
$count = $count === 'a' ? 1 : $count;
$count = $count === 'an' ? 1 : $count;
$this->assertMailCo... | [
"public",
"function",
"noNewMailIsSent",
"(",
"$",
"count",
",",
"$",
"to",
"=",
"''",
",",
"$",
"subject",
"=",
"''",
")",
"{",
"$",
"actualMail",
"=",
"$",
"this",
"->",
"getMail",
"(",
"[",
"'to'",
"=>",
"$",
"to",
",",
"'subject'",
"=>",
"$",
... | Check mail sent since the last step that checked mail.
@Then :count new (e)mail(s) is/are sent
@Then :count new (e)mail(s) is/are sent to :to
@Then :count new (e)mail(s) is/are sent with the subject :subject
@Then :count new (e)mail(s) is/are sent to :to with the subject :subject | [
"Check",
"mail",
"sent",
"since",
"the",
"last",
"step",
"that",
"checked",
"mail",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MailContext.php#L138-L145 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.getMailManager | protected function getMailManager()
{
// Persist the mail manager between invocations. This is necessary for
// remembering and reinstating the original mail backend.
if (is_null($this->mailManager)) {
$this->mailManager = new DrupalMailManager($this->getDriver());
}
... | php | protected function getMailManager()
{
// Persist the mail manager between invocations. This is necessary for
// remembering and reinstating the original mail backend.
if (is_null($this->mailManager)) {
$this->mailManager = new DrupalMailManager($this->getDriver());
}
... | [
"protected",
"function",
"getMailManager",
"(",
")",
"{",
"// Persist the mail manager between invocations. This is necessary for",
"// remembering and reinstating the original mail backend.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"mailManager",
")",
")",
"{",
"$",
"t... | Get the mail manager service that handles stored test mail.
@return \Drupal\DrupalMailManagerInterface
The mail manager service. | [
"Get",
"the",
"mail",
"manager",
"service",
"that",
"handles",
"stored",
"test",
"mail",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L33-L41 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.getMail | protected function getMail($matches = [], $new = false, $index = null, $store = 'default')
{
$mail = $this->getMailManager()->getMail($store);
$previousMailCount = $this->getMailCount($store);
$this->mailCount[$store] = count($mail);
// Ignore previously seen mail.
if ($new)... | php | protected function getMail($matches = [], $new = false, $index = null, $store = 'default')
{
$mail = $this->getMailManager()->getMail($store);
$previousMailCount = $this->getMailCount($store);
$this->mailCount[$store] = count($mail);
// Ignore previously seen mail.
if ($new)... | [
"protected",
"function",
"getMail",
"(",
"$",
"matches",
"=",
"[",
"]",
",",
"$",
"new",
"=",
"false",
",",
"$",
"index",
"=",
"null",
",",
"$",
"store",
"=",
"'default'",
")",
"{",
"$",
"mail",
"=",
"$",
"this",
"->",
"getMailManager",
"(",
")",
... | Get collected mail, matching certain specifications.
@param array $matches
Associative array of mail fields and the values to filter by.
@param bool $new
Whether to ignore previously seen mail.
@param null|int $index
A particular mail to return, e.g. 0 for first or -1 for last.
@param string $store
The name of the mai... | [
"Get",
"collected",
"mail",
"matching",
"certain",
"specifications",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L59-L82 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.getMailCount | protected function getMailCount($store)
{
if (array_key_exists($store, $this->mailCount)) {
$count = $this->mailCount[$store];
} else {
$count = 0;
}
return $count;
} | php | protected function getMailCount($store)
{
if (array_key_exists($store, $this->mailCount)) {
$count = $this->mailCount[$store];
} else {
$count = 0;
}
return $count;
} | [
"protected",
"function",
"getMailCount",
"(",
"$",
"store",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"store",
",",
"$",
"this",
"->",
"mailCount",
")",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"mailCount",
"[",
"$",
"store",
"]",
";"... | Get the number of mails received in a particular mail store.
@return int
The number of mails received during this scenario. | [
"Get",
"the",
"number",
"of",
"mails",
"received",
"in",
"a",
"particular",
"mail",
"store",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L90-L98 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.matchesMail | protected function matchesMail($mail = [], $matches = [])
{
// Discard criteria that are just zero-length strings.
$matches = array_filter($matches, 'strlen');
// For each criteria, check the specified mail field contains the value.
foreach ($matches as $field => $value) {
... | php | protected function matchesMail($mail = [], $matches = [])
{
// Discard criteria that are just zero-length strings.
$matches = array_filter($matches, 'strlen');
// For each criteria, check the specified mail field contains the value.
foreach ($matches as $field => $value) {
... | [
"protected",
"function",
"matchesMail",
"(",
"$",
"mail",
"=",
"[",
"]",
",",
"$",
"matches",
"=",
"[",
"]",
")",
"{",
"// Discard criteria that are just zero-length strings.",
"$",
"matches",
"=",
"array_filter",
"(",
"$",
"matches",
",",
"'strlen'",
")",
";"... | Determine if a mail meets criteria.
@param array $mail
The mail, as an array of mail fields.
@param array $matches
The criteria: an associative array of mail fields and desired values.
@return bool
Whether the mail matches the criteria. | [
"Determine",
"if",
"a",
"mail",
"meets",
"criteria",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L111-L123 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.compareMail | protected function compareMail($actualMail, $expectedMail)
{
// Make sure there is the same number of actual and expected.
$expectedCount = count($expectedMail);
$this->assertMailCount($actualMail, $expectedCount);
// For each row of expected mail, check the corresponding actual mai... | php | protected function compareMail($actualMail, $expectedMail)
{
// Make sure there is the same number of actual and expected.
$expectedCount = count($expectedMail);
$this->assertMailCount($actualMail, $expectedCount);
// For each row of expected mail, check the corresponding actual mai... | [
"protected",
"function",
"compareMail",
"(",
"$",
"actualMail",
",",
"$",
"expectedMail",
")",
"{",
"// Make sure there is the same number of actual and expected.",
"$",
"expectedCount",
"=",
"count",
"(",
"$",
"expectedMail",
")",
";",
"$",
"this",
"->",
"assertMailC... | Compare actual mail with expected mail.
@param array $actualMail
An array of actual mail.
@param array $expectedMail
An array of expected mail. | [
"Compare",
"actual",
"mail",
"with",
"expected",
"mail",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L133-L153 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.assertMailCount | protected function assertMailCount($actualMail, $expectedCount = null)
{
$actualCount = count($actualMail);
if (is_null($expectedCount)) {
// If number to expect is not specified, expect more than zero.
if ($actualCount === 0) {
throw new \Exception("Expected ... | php | protected function assertMailCount($actualMail, $expectedCount = null)
{
$actualCount = count($actualMail);
if (is_null($expectedCount)) {
// If number to expect is not specified, expect more than zero.
if ($actualCount === 0) {
throw new \Exception("Expected ... | [
"protected",
"function",
"assertMailCount",
"(",
"$",
"actualMail",
",",
"$",
"expectedCount",
"=",
"null",
")",
"{",
"$",
"actualCount",
"=",
"count",
"(",
"$",
"actualMail",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"expectedCount",
")",
")",
"{",
"// ... | Assert there is the expected number of mails, or that there are some mails
if the exact number expected is not specified.
@param array $actualMail
An array of actual mail.
@param int $expectedCount
Optional. The number of mails expected. | [
"Assert",
"there",
"is",
"the",
"expected",
"number",
"of",
"mails",
"or",
"that",
"there",
"are",
"some",
"mails",
"if",
"the",
"exact",
"number",
"expected",
"is",
"not",
"specified",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L164-L185 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RawMailContext.php | RawMailContext.sortMail | protected function sortMail($mail)
{
// Can't sort an empty array.
if (count($mail) === 0) {
return [];
}
// To, subject and body keys must be present.
// Empty strings are ignored when matching so adding them is harmless.
foreach ($mail as $key => $row) ... | php | protected function sortMail($mail)
{
// Can't sort an empty array.
if (count($mail) === 0) {
return [];
}
// To, subject and body keys must be present.
// Empty strings are ignored when matching so adding them is harmless.
foreach ($mail as $key => $row) ... | [
"protected",
"function",
"sortMail",
"(",
"$",
"mail",
")",
"{",
"// Can't sort an empty array.",
"if",
"(",
"count",
"(",
"$",
"mail",
")",
"===",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// To, subject and body keys must be present.",
"// Empty strings are ... | Sort mail by to, subject and body.
@param array $mail
An array of mail to sort.
@return array
The same mail, but sorted. | [
"Sort",
"mail",
"by",
"to",
"subject",
"and",
"body",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RawMailContext.php#L196-L233 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Compiler/DriverPass.php | DriverPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('drupal.drupal')) {
return;
}
$drupalDefinition = $container->getDefinition('drupal.drupal');
foreach ($container->findTaggedServiceIds('drupal.driver') as $id => $attributes) {
... | php | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('drupal.drupal')) {
return;
}
$drupalDefinition = $container->getDefinition('drupal.drupal');
foreach ($container->findTaggedServiceIds('drupal.driver') as $id => $attributes) {
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"'drupal.drupal'",
")",
")",
"{",
"return",
";",
"}",
"$",
"drupalDefinition",
"=",
"$",
"container",
"->",
... | Register Drupal drivers. | [
"Register",
"Drupal",
"drivers",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Compiler/DriverPass.php#L17-L57 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Compiler/EventSubscriberPass.php | EventSubscriberPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('drupal.event_dispatcher')) {
return;
}
$dispatcherDefinition = $container->getDefinition('drupal.event_dispatcher');
foreach ($container->findTaggedServiceIds('drupal.event_subscriber'... | php | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('drupal.event_dispatcher')) {
return;
}
$dispatcherDefinition = $container->getDefinition('drupal.event_dispatcher');
foreach ($container->findTaggedServiceIds('drupal.event_subscriber'... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"'drupal.event_dispatcher'",
")",
")",
"{",
"return",
";",
"}",
"$",
"dispatcherDefinition",
"=",
"$",
"containe... | Processes container.
@param ContainerBuilder $container | [
"Processes",
"container",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Compiler/EventSubscriberPass.php#L19-L35 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RandomContext.php | RandomContext.transformVariables | public function transformVariables($message)
{
$patterns = [];
$replacements = [];
preg_match_all(static::VARIABLE_REGEX, $message, $matches);
foreach ($matches[0] as $variable) {
$replacements[] = $this->values[$variable];
$patterns[] = '#' . preg_quote($var... | php | public function transformVariables($message)
{
$patterns = [];
$replacements = [];
preg_match_all(static::VARIABLE_REGEX, $message, $matches);
foreach ($matches[0] as $variable) {
$replacements[] = $this->values[$variable];
$patterns[] = '#' . preg_quote($var... | [
"public",
"function",
"transformVariables",
"(",
"$",
"message",
")",
"{",
"$",
"patterns",
"=",
"[",
"]",
";",
"$",
"replacements",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"static",
"::",
"VARIABLE_REGEX",
",",
"$",
"message",
",",
"$",
"matches",
")... | Transform random variables.
@Transform #([^<]*\<\?.*\>[^>]*)# | [
"Transform",
"random",
"variables",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RandomContext.php#L35-L48 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/RandomContext.php | RandomContext.beforeScenarioSetVariables | public function beforeScenarioSetVariables(BeforeScenarioScope $scope)
{
$steps = [];
if ($scope->getFeature()->hasBackground()) {
$steps = $scope->getFeature()->getBackground()->getSteps();
}
$steps = array_merge($steps, $scope->getScenario()->getSteps());
foreac... | php | public function beforeScenarioSetVariables(BeforeScenarioScope $scope)
{
$steps = [];
if ($scope->getFeature()->hasBackground()) {
$steps = $scope->getFeature()->getBackground()->getSteps();
}
$steps = array_merge($steps, $scope->getScenario()->getSteps());
foreac... | [
"public",
"function",
"beforeScenarioSetVariables",
"(",
"BeforeScenarioScope",
"$",
"scope",
")",
"{",
"$",
"steps",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"scope",
"->",
"getFeature",
"(",
")",
"->",
"hasBackground",
"(",
")",
")",
"{",
"$",
"steps",
"=",... | Set values for each random variable found in the current scenario.
@BeforeScenario | [
"Set",
"values",
"for",
"each",
"random",
"variable",
"found",
"in",
"the",
"current",
"scenario",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/RandomContext.php#L55-L79 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/ScenarioTagTrait.php | ScenarioTagTrait.getCurrentScenarioTags | protected function getCurrentScenarioTags(StepScope $scope)
{
$featureTags = $scope->getFeature()->getTags();
$scenarioTags = $this->getScenario()->getTags();
return array_merge($featureTags, $scenarioTags);
} | php | protected function getCurrentScenarioTags(StepScope $scope)
{
$featureTags = $scope->getFeature()->getTags();
$scenarioTags = $this->getScenario()->getTags();
return array_merge($featureTags, $scenarioTags);
} | [
"protected",
"function",
"getCurrentScenarioTags",
"(",
"StepScope",
"$",
"scope",
")",
"{",
"$",
"featureTags",
"=",
"$",
"scope",
"->",
"getFeature",
"(",
")",
"->",
"getTags",
"(",
")",
";",
"$",
"scenarioTags",
"=",
"$",
"this",
"->",
"getScenario",
"(... | Get all tags for the current scenario.
@param StepScope $scope
@return string[] | [
"Get",
"all",
"tags",
"for",
"the",
"current",
"scenario",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/ScenarioTagTrait.php#L55-L60 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php | DrupalAwareInitializer.initializeContext | public function initializeContext(Context $context)
{
// All contexts are passed here, only DrupalAwareInterface is allowed.
if (!$context instanceof DrupalAwareInterface) {
return;
}
// Set Drupal driver manager.
$context->setDrupal($this->drupal);
// ... | php | public function initializeContext(Context $context)
{
// All contexts are passed here, only DrupalAwareInterface is allowed.
if (!$context instanceof DrupalAwareInterface) {
return;
}
// Set Drupal driver manager.
$context->setDrupal($this->drupal);
// ... | [
"public",
"function",
"initializeContext",
"(",
"Context",
"$",
"context",
")",
"{",
"// All contexts are passed here, only DrupalAwareInterface is allowed.",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"DrupalAwareInterface",
")",
"{",
"return",
";",
"}",
"// Set Drupa... | {@inheritdocs} | [
"{"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php#L53-L75 |
jhedstrom/drupalextension | src/Drupal/DrupalDriverManager.php | DrupalDriverManager.registerDriver | public function registerDriver($name, DriverInterface $driver)
{
$name = strtolower($name);
$this->drivers[$name] = $driver;
} | php | public function registerDriver($name, DriverInterface $driver)
{
$name = strtolower($name);
$this->drivers[$name] = $driver;
} | [
"public",
"function",
"registerDriver",
"(",
"$",
"name",
",",
"DriverInterface",
"$",
"driver",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"drivers",
"[",
"$",
"name",
"]",
"=",
"$",
"driver",
";",
"}"
] | Register a new driver.
@param string $name
Driver name.
@param \Drupal\Driver\DriverInterface $driver
An instance of a DriverInterface. | [
"Register",
"a",
"new",
"driver",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalDriverManager.php#L61-L65 |
jhedstrom/drupalextension | src/Drupal/DrupalDriverManager.php | DrupalDriverManager.getDriver | public function getDriver($name = null)
{
$name = strtolower($name) ?: $this->defaultDriverName;
if (null === $name) {
throw new \InvalidArgumentException('Specify a Drupal driver to get.');
}
if (!isset($this->drivers[$name])) {
throw new \InvalidArgumentEx... | php | public function getDriver($name = null)
{
$name = strtolower($name) ?: $this->defaultDriverName;
if (null === $name) {
throw new \InvalidArgumentException('Specify a Drupal driver to get.');
}
if (!isset($this->drivers[$name])) {
throw new \InvalidArgumentEx... | [
"public",
"function",
"getDriver",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
"?",
":",
"$",
"this",
"->",
"defaultDriverName",
";",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"throw",
"new... | Return a registered driver by name, or the default driver.
@param string $name
The name of the driver to return. If omitted the default driver is
returned.
@return \Drupal\Driver\DriverInterface
The requested driver.
@throws \InvalidArgumentException
Thrown when the requested driver is not registered. | [
"Return",
"a",
"registered",
"driver",
"by",
"name",
"or",
"the",
"default",
"driver",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalDriverManager.php#L80-L100 |
jhedstrom/drupalextension | src/Drupal/DrupalDriverManager.php | DrupalDriverManager.setDefaultDriverName | public function setDefaultDriverName($name)
{
$name = strtolower($name);
if (!isset($this->drivers[$name])) {
throw new \InvalidArgumentException(sprintf('Driver "%s" is not registered.', $name));
}
$this->defaultDriverName = $name;
} | php | public function setDefaultDriverName($name)
{
$name = strtolower($name);
if (!isset($this->drivers[$name])) {
throw new \InvalidArgumentException(sprintf('Driver "%s" is not registered.', $name));
}
$this->defaultDriverName = $name;
} | [
"public",
"function",
"setDefaultDriverName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"drivers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
... | Set the default driver name.
@param string $name
Default driver name to set.
@throws \InvalidArgumentException
Thrown when the driver is not registered. | [
"Set",
"the",
"default",
"driver",
"name",
"."
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalDriverManager.php#L111-L120 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertMultipleErrors | public function assertMultipleErrors(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'error messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['error messages']);
$this->as... | php | public function assertMultipleErrors(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'error messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['error messages']);
$this->as... | [
"public",
"function",
"assertMultipleErrors",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'error messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
")",
"as",
... | Checks if the current page contains the given set of error messages
@param array $messages
An array of texts to be checked. The first row should consist of the
string "Error messages".
@Then I should see the following error message(s): | [
"Checks",
"if",
"the",
"current",
"page",
"contains",
"the",
"given",
"set",
"of",
"error",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L50-L58 |
jhedstrom/drupalextension | src/Drupal/DrupalExtension/Context/MessageContext.php | MessageContext.assertNotMultipleErrors | public function assertNotMultipleErrors(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'error messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['error messages']);
$this-... | php | public function assertNotMultipleErrors(TableNode $messages)
{
$this->assertValidMessageTable($messages, 'error messages');
foreach ($messages->getHash() as $key => $value) {
$value = array_change_key_case($value);
$message = trim($value['error messages']);
$this-... | [
"public",
"function",
"assertNotMultipleErrors",
"(",
"TableNode",
"$",
"messages",
")",
"{",
"$",
"this",
"->",
"assertValidMessageTable",
"(",
"$",
"messages",
",",
"'error messages'",
")",
";",
"foreach",
"(",
"$",
"messages",
"->",
"getHash",
"(",
")",
"as... | Checks if the current page does not contain the given set error messages
@param array $messages
An array of texts to be checked. The first row should consist of the
string "Error messages".
@Then I should not see the following error messages: | [
"Checks",
"if",
"the",
"current",
"page",
"does",
"not",
"contain",
"the",
"given",
"set",
"error",
"messages"
] | train | https://github.com/jhedstrom/drupalextension/blob/d117c1a23b83c0e88b6224ed5d1d3458ce255b5a/src/Drupal/DrupalExtension/Context/MessageContext.php#L86-L94 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.