mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Added FunctionalTest::findAttribute() as a helper for getting an attribute from a SimpleXMLElement object by it's name
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@94381 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f2fd76f770
commit
3d8918fdeb
@ -122,6 +122,22 @@ class FunctionalTest extends SapphireTest {
|
||||
return $this->mainSession->lastContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an attribute in a SimpleXMLElement object by name.
|
||||
* @param SimpleXMLElement object
|
||||
* @param string $attribute Name of attribute to find
|
||||
* @return SimpleXMLElement object of the attribute
|
||||
*/
|
||||
function findAttribute($object, $attribute) {
|
||||
$found = false;
|
||||
foreach($object->attributes() as $a => $b) {
|
||||
if($a == $attribute) {
|
||||
$found = $b;
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a CSSContentParser for the most recent content.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user