Skip to content

Commit

Permalink
Merge pull request #9 from interactive-solutions/add-entities-to-aliases
Browse files Browse the repository at this point in the history
Added a exposed method to add entity to alias from outside EntityFixt…
  • Loading branch information
noggan authored Jan 10, 2017
2 parents 9dd8bc6 + a98cb78 commit 3245391
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Context/EntityFixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ public function getEntityFromAlias(string $alias)
return $this->aliases[$alias];
}

/**
* @param $entity
* @param $alias
*/
public function addEntityToAlias($entity, $alias)
{
$this->aliases[$alias] = $entity;
}

/**
* Reset the alias list
*
Expand Down Expand Up @@ -265,7 +274,7 @@ public function anExistingTypeCreatedWithStaticMethodAndAlias($type, $staticMeth
{
$entity = $this->anExistingTypeCreatedWithStaticMethod($type, $staticMethodName);

$this->aliases[$alias] = $entity;
$this->addEntityToAlias($entity, $alias);
}

/**
Expand Down Expand Up @@ -318,7 +327,7 @@ public function anExistingAs($type, $alias)
{
$entity = $this->anExisting($type);

$this->aliases[$alias] = $entity;
$this->addEntityToAlias($entity, $alias);
}

/**
Expand All @@ -335,7 +344,7 @@ public function anExistingAsWithValues($type, $alias, TableNode $values)
{
$entity = $this->anExistingWithValues($type, $values);

$this->aliases[$alias] = $entity;
$this->addEntityToAlias($entity, $alias);
}

/**
Expand Down

0 comments on commit 3245391

Please sign in to comment.