vendredi 31 mai 2019

Undefined method Class::create()

When I debug my test to see how the passport route work

<?php


namespace Tests\Feature\Auth;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Passport\Client;
use Tests\TestCase;
use App\Directory;
use App\Event;

class AuthTest extends TestCase
{
    use RefreshDatabase;
    /**
     * @test
     */
    public function can_authenticate()
    {
        $response = $this->json('POST', '/auth/token', [
            'email' => $this->create('User', [], false)->email,
            'password' => 'secret'
        ]);
        $response->assertStatus(200)
            ->assertJsonStructure(['token']);
    }
}

I receive the following error :

Error : Call to undefined method Tests\Feature\Auth\AuthTest::create() /home/amine/Apps/PassportV2/tests/Feature/Auth/AuthTest.php:28

how can I fix it?

thank you in advance

Aucun commentaire:

Enregistrer un commentaire