create test directory

This commit is contained in:
2024-03-02 11:16:57 +03:30
parent f90afbb406
commit 908c6c8024
4 changed files with 76 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Application;
trait CreatesApplication
{
/**
* Creates the application.
*/
public function createApplication(): Application
{
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Tests\Feature\Services;
use App\Services\NominatimService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class NominatimTest extends TestCase
{
use RefreshDatabase, WithFaker;
/**
* A basic feature test example.
*/
public function test_nominatim_service_return_0_if_the_environment_is_not_production(): void
{
$wayId = (new NominatimService())->get_way_id_from_nominatim();
$this->assertEquals($wayId, 0);
}
}

10
tests/TestCase.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}