Skip to content

Commit

Permalink
Unset app when test is done
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Mar 20, 2022
1 parent 77db8c3 commit 28c020d
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/Testing/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,53 @@ class TestCase extends BaseTestCase
protected string $mainSprinkle;

/**
* Setup the test environment.
* This method is called before each test.
*
* @codeCoverageIgnore
*/
protected function setUp(): void
{
parent::setUp();

$this->refreshApplication();
$this->createApplication();
}

/**
* Refresh the application instance by setting up a basic UF app.
* This method is called after each test.
*
* @codeCoverageIgnore
*/
protected function refreshApplication(): void
protected function tearDown(): void
{
parent::tearDown();

$this->deleteApplication();
}

/**
* Create the application instance by setting up a basic UF app.
*
* @codeCoverageIgnore
*/
protected function createApplication(): void
{
$this->userfrosting = new UserFrosting($this->mainSprinkle);
$this->app = $this->userfrosting->getApp();
$this->ci = $this->userfrosting->getContainer();
}

/**
* Unset the application instances (UF, Slim App and Container).
*
* @codeCoverageIgnore
*/
protected function deleteApplication(): void
{
unset($this->userfrosting);
unset($this->app);
unset($this->ci);
}

/**
* Create a server request.
*
Expand Down

0 comments on commit 28c020d

Please sign in to comment.