Skip to content

Instantly share code, notes, and snippets.

@discipolo
Created April 24, 2016 20:32
Show Gist options
  • Save discipolo/ac82645632e427d3fb78c8578bfb865a to your computer and use it in GitHub Desktop.
Save discipolo/ac82645632e427d3fb78c8578bfb865a to your computer and use it in GitHub Desktop.
<?php
/**
* @Then /^(?:|I )should see the following in the repeated "(?P<element>[^"]*)" element within the context of the "(?P<parentElement>[^"]*)" element
*/
public function assertRepeatedElementContainsText(TableNode $table, $element, $parentElement)
{
$parent = $this->getSession()->getPage()->findAll('css', $parentElement);
foreach ($table->getHash() as $n => $repeatedElement) {
$child = $parent[$n];
\PHPUnit_Framework_Assert::assertEquals(
$child->find('css', $element)->getText(),
$repeatedElement['text']
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment