PHP

Testing in Laravel

Në shqip: Testimi në Laravel

ShpjegimiSQ

Laravel-i vjen gati për teste: me Pest ose PHPUnit shkruan „feature tests“ që dërgojnë kërkesa ($this->get('/')), përdorin databazë testi (RefreshDatabase) dhe hyjnë si përdorues (actingAs).

EnglishEN

Laravel comes test-ready: with Pest or PHPUnit you write “feature tests” that send requests ($this->get('/')), use a test database (RefreshDatabase) and log in as a user (actingAs).

Si ta mendosh

Si një provë gjenerale me aktorë të vërtetë.

Lexoje në anglisht

Like a dress rehearsal with real actors.

Shembull kodiphp

it('shfaq profilin', function () {
    $u = User::factory()->create();
    $this->actingAs($u)->get('/profili')->assertOk();
});

Terma të lidhur