ramonhollands's avatar

use App\Model in test dir trait

Hi,

I created a Trait in the test directory which is used by multiple tests.

In the Trait I try to import the User model: use App\User;

<?php

trait TestPrepareQuestionnaire
{
    use App\User;
    ...
  
    public function create_user_team_and_members()
    {
         ....
    }
}

This gives the error: Tests\TestPrepareQuestionnaire cannot use App\User - it is not a trait in /project/tests/TestPrepareQuestionnaire.php on line 6

Any idea how to solve this issue?

Thanks in advance!

0 likes
1 reply
Thijmen's avatar

It should not be in the trait but above.

1 like

Please or to participate in this conversation.