Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
#89 - unit tests init
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Sokolowska committed May 6, 2022
1 parent f3dee2c commit bd8c792
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
24 changes: 24 additions & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
Blumilk\Meetup\Core\Http\Kernel::class
);

$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
Blumilk\Meetup\Core\Console\Kernel::class
);

$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
Blumilk\Meetup\Core\Exceptions\Handler::class
);

return $app;
2 changes: 2 additions & 0 deletions bootstrap/cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
3 changes: 1 addition & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="APP_URL" value="localhost"/>
<server name="DB_CONNECTION" value="testing"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="MAIL_MAILER" value="array"/>
Expand Down
20 changes: 20 additions & 0 deletions tests/CreatesApplication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Application;

trait CreatesApplication
{
public function createApplication(): Application
{
$app = require __DIR__ . "/../bootstrap/app.php";

$app->make(Kernel::class)->bootstrap();

return $app;
}
}
12 changes: 12 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}

0 comments on commit bd8c792

Please sign in to comment.