1. Go to this page and download the library: Download tatter/imposter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
if ($user = service('auth')->user()) {
echo 'Logged in!';
}
helper('auth');
if ($userId = user_id()) {
return true;
}
throw new RuntimeException('You must be authenticated!');
$user = new \Tatter\Imposter\Entities\User();
$user->groups = ['Administrators', 'Editors'];
use CodeIgniter\Test\CIUnitTestCase;
use Tatter\Imposter\Factories\ImposterFactory;
use Tatter\Users\UserProvider;
final class UserWidgetTest extends CIUnitTestCase
{
public static function setUpBeforeClass(): void
{
UserProvider::addFactory(ImposterFactory::class, ImposterFactory::class);
}
...