laravel-easypanel icon indicating copy to clipboard operation
laravel-easypanel copied to clipboard

Testing messed out

Open mohamedhafizelhaj opened this issue 3 years ago • 3 comments

After installing the package, whenever I run my tests that involves my user model, I get this Class "EasyPanelTest/Dependencies/User" not found

mohamedhafizelhaj avatar Jun 01 '22 17:06 mohamedhafizelhaj

Could you please share your tests with their imported namespaces?

reziamini avatar Jun 03 '22 07:06 reziamini

Here is a snapshot of some of the tests that causes the issue, of course others that uses the user model also causes the same issue.

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;

class UserTest extends TestCase
{
    use RefreshDatabase, WithFaker;

    public function test_user_can_logout_via_api()
    {
        Sanctum::actingAs(
            User::factory()->create()
        );

        $response = $this->postJson('/api/logout');

        $response->assertStatus(200);
    }

    public function test_user_can_update_fields()
    {
        Sanctum::actingAs(
            User::factory()->create()
        );

        $data = [
            'field' => 'name',
            'value' => 'testUpdate'
        ];

        $response = $this->postJson('/api/profile/update', $data);

        $response->assertStatus(200);
    }

    public function test_user_can_update_email()
    {
        Sanctum::actingAs(
            User::factory()->create()
        );

        $data = [
            'field' => 'email',
            'value' => '[email protected]'
        ];

        $response = $this->postJson('/api/profile/update', $data);

        $response->assertStatus(200);
    }
}

mohamedhafizelhaj avatar Jun 09 '22 13:06 mohamedhafizelhaj

Any news?

mohamedhafizelhaj avatar Sep 02 '22 19:09 mohamedhafizelhaj