lundi 7 octobre 2019

Laravel testing, working when filtered but not as group

I'm running the fallback option of adldap2 in laravel, I didnt override the setupUp or tearDown functions , my tests looks like this:

 /** @test */
    public function login_via_created_user_and_logout()
    {
        $user = factory(User::class)->create(['password' => bcrypt(123456)]);

        $response = $this->post('/api/auth/login', [
            'email' => $user->username,
            'password' => 123456
        ]);
        $response->dump();
        $this->assertAuthenticatedAs(User::where('email', $user->username)->first());

        $this->json('POST', '/api/auth/logout', ['Authorization' => 'Bearer ' . $response->original['access_token']]);
        $this->assertGuest();
    }

    /** @test */
    public function login_ldap_and_logout_user()
    {
        // need at static user
        $response = $this->post('/api/auth/login', [
            'email' => '[username]',
            'password' => '[password]'
        ]);
        $response->assertOk();
        $this->assertAuthenticatedAs(User::find(1));

        $this->json('POST', '/api/auth/logout', ['Authorization' => 'Bearer ' . $response->original['access_token']]);

        $this->assertGuest();
    }

When is run them clear && php artisan config:clear && phpunit --filter=login_ldap_and_logout_user they pass through, but when i run them without filtering they fail on testing.ERROR: Class config does not exist {"exception":"[object] (ReflectionException(code: -1): Class config does not exist at

Aucun commentaire:

Enregistrer un commentaire