Merge pull request #250 from creative-commoners/pulls/4.11/extensions

NEW Assert element attributes
This commit is contained in:
Sabina Talipova 2023-09-14 19:06:42 +12:00 committed by GitHub
commit 6c962ef294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -545,6 +545,17 @@ JS;
$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$/
* @param string $expected

View File

@ -30,6 +30,7 @@ use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Core\Config\Config;
/**
* Context used to create fixtures in the SilverStripe ORM.
@ -659,7 +660,16 @@ class FixtureContext implements Context
// Add the extension to the CLI context
/** @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);
// Write config for this extension too...