Skip to content

Commit

Permalink
Merge pull request #535 from magento/MQE-1513
Browse files Browse the repository at this point in the history
MQE-1513: createData throws a useless error message during runtime wh…
  • Loading branch information
soumyau authored Jan 6, 2020
2 parents 9bc59f8 + 188d6ba commit 052576d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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

0 comments on commit 052576d

Please sign in to comment.