Fixes to ensure testing works again

Added LDIF Import testing
This commit is contained in:
2025-05-24 12:35:21 +10:00
parent 2ce0ed8974
commit 6c501cc29d
6 changed files with 167 additions and 50 deletions

View File

@@ -3,10 +3,20 @@
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use App\Classes\LDAP\Server;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
use CreatesApplication;
protected function setUp(): void
{
parent::setUp();
Config::set('server',new Server());
}
/**
* Hack to get testing working
@@ -19,4 +29,15 @@ abstract class TestCase extends BaseTestCase
app()->instance('config', $config);
app()->instance('events', $events);
}
protected function login(): bool
{
//$username = 'cn=AdminUser,dc=Test';
$username = 'admin';
$password = 'password';
$this->post('/login',['uid'=>$username,'password'=>$password]);
return Auth::check() && (Auth::user()->getDN() === 'cn=AdminUser,dc=Test');
}
}