diff --git a/src/Context/BasicContext.php b/src/Context/BasicContext.php index 203c23d3..c115eef1 100644 --- a/src/Context/BasicContext.php +++ b/src/Context/BasicContext.php @@ -545,6 +545,17 @@ public function iClickInTheElementDismissingTheDialog($clickType, $text, $select $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 diff --git a/src/Context/FixtureContext.php b/src/Context/FixtureContext.php index a90c9929..15abc392 100644 --- a/src/Context/FixtureContext.php +++ b/src/Context/FixtureContext.php @@ -30,6 +30,7 @@ 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. @@ -664,7 +665,16 @@ class_exists($extension ?? '') && is_subclass_of($extension, Extension::class), // 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); if (!array_key_exists($targetClass, $this->addedExtensions)) { $this->addedExtensions[$targetClass] = [];