PHPUnit Testing for API
Step 1 - Starting Docker Container
docker-compose upStep 2 - Seeding the database
./developer shellinstall-elentraStep 3 - Creating a PHP Unit Test
<?php
namespace Tests\Integration\Locations\Services;
use Entrada\Modules\Locations\Database\Seeds\ClinicalLocationsSeedData;
use Tests\TestCase;
class LocationsServiceTest extends TestCase
{
private $locationsService;
public function setUp(): void
{
parent::setUp();
$this->locationsService = $this->app->make('Entrada\Modules\Locations\Services\LocationsService');
}
/**
* @test
* @return void
*/
public function baseTest() : void {
$locations = $this->locationsService->listall();
$this->assertEquals($locations, ClinicalLocationsSeedData::getClinicalLocations());
}
}Step 4 - Running php unit
Troubleshooting
Last updated