Skip to content

Commit

Permalink
Merge pull request #104 from lion-packages/bugs
Browse files Browse the repository at this point in the history
Added dependencies for migration helpers and seeds
  • Loading branch information
GabrielPalac authored Nov 29, 2024
2 parents ed0492e + 5d12b8c commit 844f08b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/LionBundle/Test/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
use Lion\Bundle\Helpers\Commands\Migrations\Migrations;
use Lion\Bundle\Helpers\Commands\Seeds\Seeds;
use Lion\Bundle\Interface\CapsuleInterface;
use Lion\Dependency\Injection\Container;
use Lion\Test\Test as Testing;

/**
* Extend testing functions
*
* @property Container|null $container [Dependency Injection Container Wrapper]
* @property Migrations|null $migrations [Manages the processes of creating or
* executing migrations]
* @property Seeds|null $seeds [Manages the processes of creating or executing
Expand All @@ -21,6 +23,13 @@
*/
class Test extends Testing
{
/**
* [Dependency Injection Container Wrapper]
*
* @var Container|null $container
*/
private ?Container $container = null;

/**
* [Manages the processes of creating or executing migrations]
*
Expand All @@ -44,8 +53,12 @@ class Test extends Testing
*/
protected function executeMigrationsGroup(array $migrations): void
{
if (NULL_VALUE === $this->container) {
$this->container = new Container();
}

if (NULL_VALUE === $this->migrations) {
$this->migrations = new Migrations();
$this->migrations = $this->container->resolve(Migrations::class);
}

$this->migrations->executeMigrationsGroup($migrations);
Expand All @@ -60,8 +73,12 @@ protected function executeMigrationsGroup(array $migrations): void
*/
protected function executeSeedsGroup(array $seeds): void
{
if (NULL_VALUE === $this->container) {
$this->container = new Container();
}

if (NULL_VALUE === $this->seeds) {
$this->seeds = new Seeds();
$this->seeds = $this->container->resolve(Seeds::class);
}

$this->seeds->executeSeedsGroup($seeds);
Expand Down

0 comments on commit 844f08b

Please sign in to comment.