Hi. This worked for me:
namespace Modules\Administration\Tests\Entities\ArrayRepository;
use Tests\TestCase;
use Illuminate\Container\Container;
class UserEntityTest extends TestCase
{
public function setUp()
{
parent::setUp();
$app = Container::getInstance();
$this->app->bind('Modules\Administration\Entities\User',
'Modules\Administration\Repositories\ArrayRepository\User');
}
public function test_create_User_Entity()
{
/**
* Thing to do in order to resolve this Entity from Array Repository
*
* 1. Make an interface Modules\Administration\Entities\User
* 2. Make an implementation Modules\Administration\Repositories\ArrayRepository\User
* 3. Bind the implementation to the interface
*/
$user = resolve('Modules\Administration\Entities\User');
$this->assertNotNull($user, 'Can not create Administration\Entities\User');
}
}
Good luck!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community