mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #250 from creative-commoners/pulls/4.11/extensions
NEW Assert element attributes
This commit is contained in:
commit
6c962ef294
@ -545,6 +545,17 @@ JS;
|
|||||||
$this->iDismissTheDialog();
|
$this->iDismissTheDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then /^the "([^"]+)" element "([^"]+)" attribute should be "([^"]*)"$/
|
||||||
|
*/
|
||||||
|
public function theElementAttributeShouldBe($selector, $attribute, $value)
|
||||||
|
{
|
||||||
|
$page = $this->getSession()->getPage();
|
||||||
|
$element = $page->find('css', $selector);
|
||||||
|
Assert::assertNotNull($element, sprintf('Element %s not found', $selector));
|
||||||
|
Assert::assertEquals($value, $element->getAttribute($attribute));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^I see the text "([^"]+)" in the alert$/
|
* @Given /^I see the text "([^"]+)" in the alert$/
|
||||||
* @param string $expected
|
* @param string $expected
|
||||||
|
@ -30,6 +30,7 @@ use SilverStripe\Security\Group;
|
|||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context used to create fixtures in the SilverStripe ORM.
|
* Context used to create fixtures in the SilverStripe ORM.
|
||||||
@ -659,7 +660,16 @@ class FixtureContext implements Context
|
|||||||
|
|
||||||
// Add the extension to the CLI context
|
// Add the extension to the CLI context
|
||||||
/** @var Extensible $targetClass */
|
/** @var Extensible $targetClass */
|
||||||
$targetClass = $this->convertTypeToClass($class);
|
try {
|
||||||
|
$targetClass = $this->convertTypeToClass($class);
|
||||||
|
} catch (InvalidArgumentException $e) {
|
||||||
|
// will end up here if the class is not a subclass of DataObject
|
||||||
|
if (class_exists($class)) {
|
||||||
|
$targetClass = $class;
|
||||||
|
} else {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
$targetClass::add_extension($extension);
|
$targetClass::add_extension($extension);
|
||||||
|
|
||||||
// Write config for this extension too...
|
// Write config for this extension too...
|
||||||
|
Loading…
Reference in New Issue
Block a user