Skip to content

MQE-1513: createData throws a useless error message during runtime wh… #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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 @@ -32,6 +32,30 @@ public function setUp()
TestLoggingUtil::getInstance()->setMockLoggingUtil();
}

public function testCreateEntityWithNonExistingName()
{
// Test Data and Variables
$entityName = "InvalidEntity";
$entityStepKey = "StepKey";
$scope = PersistedObjectHandler::TEST_SCOPE;

$exceptionMessage = "Entity \"" . $entityName . "\" does not exist." .
"\nException occurred executing action at StepKey \"" . $entityStepKey . "\"";

$this->expectException(TestReferenceException::class);

$this->expectExceptionMessage($exceptionMessage);

$handler = PersistedObjectHandler::getInstance();

// Call method
$handler->createEntity(
$entityStepKey,
$scope,
$entityName
);
}

public function testCreateSimpleEntity()
{
// Test Data and Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ public function createEntity(
}

$retrievedEntity = DataObjectHandler::getInstance()->getObject($entity);

if ($retrievedEntity === null) {
throw new TestReferenceException(
"Entity \"" . $entity . "\" does not exist." .
"\nException occurred executing action at StepKey \"" . $key . "\""
);
}

$persistedObject = new DataPersistenceHandler(
$retrievedEntity,
$retrievedDependentObjects,
Expand Down