Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function __construct()
* @param array $parsedSuiteData
* @return array
* @throws XmlException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function parseSuiteDataIntoObjects($parsedSuiteData)
{
Expand All @@ -65,6 +67,19 @@ public function parseSuiteDataIntoObjects($parsedSuiteData)

$suiteHooks = [];

//Check for collisions between suite name and existing group name
$suiteName = $parsedSuite[self::NAME];
$testGroupConflicts = TestObjectHandler::getInstance()->getTestsByGroup($suiteName);
if (!empty($testGroupConflicts)) {
$testGroupConflictsFileNames = "";
foreach ($testGroupConflicts as $test) {
$testGroupConflictsFileNames .= $test->getFilename() . "\n";
}
$exceptionmessage = "\"Suite names and Group names can not have the same value. \t\n" .
"Suite: \"{$suiteName}\" also exists as a group annotation in: \n{$testGroupConflictsFileNames}";
throw new XmlException($exceptionmessage);
}

//extract include and exclude references
$groupTestsToInclude = $parsedSuite[self::INCLUDE_TAG_NAME] ?? [];
$groupTestsToExclude = $parsedSuite[self::EXCLUDE_TAG_NAME] ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,29 @@ class TestObject
*/
private $hooks = [];

/**
* String of filename of test
*
* @var String
*/
private $filename;

/**
* TestObject constructor.
*
* @param string $name
* @param ActionObject[] $parsedSteps
* @param array $annotations
* @param TestHookObject[] $hooks
* @param String $filename
*/
public function __construct($name, $parsedSteps, $annotations, $hooks)
public function __construct($name, $parsedSteps, $annotations, $hooks, $filename = null)
{
$this->name = $name;
$this->parsedSteps = $parsedSteps;
$this->annotations = $annotations;
$this->hooks = $hooks;
$this->filename = $filename;
}

/**
Expand All @@ -69,6 +78,16 @@ public function getName()
return $this->name;
}

/**
* Getter for the Test Filename
*
* @return string
*/
public function getFilename()
{
return $this->filename;
}

/**
* Getter for Codeception format name
*
Expand Down