Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit b99e377

Browse files
committed
Fix tests and use adldap instance as singleton
1 parent ae12c9f commit b99e377

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

src/AdldapServiceProvider.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313

1414
class AdldapServiceProvider extends ServiceProvider
1515
{
16-
/**
17-
* Indicates if loading of the provider is deferred.
18-
*
19-
* @var bool
20-
*/
21-
protected $defer = false;
22-
2316
/**
2417
* Run service provider boot operations.
2518
*/
@@ -40,7 +33,7 @@ public function boot()
4033
public function register()
4134
{
4235
// Bind the Adldap instance to the IoC
43-
$this->app->bind('adldap', function (Application $app) {
36+
$this->app->singleton('adldap', function (Application $app) {
4437
$config = $app->make('config')->get('adldap');
4538

4639
// Verify configuration exists.
@@ -58,12 +51,12 @@ public function register()
5851

5952
// Go through each connection and construct a Provider.
6053
foreach ($connections as $name => $settings) {
61-
$ldap = new $settings['connection']();
6254
$configuration = new Configuration($settings['connection_settings']);
55+
$connection = new $settings['connection']();
6356
$schema = new $settings['schema']();
6457

6558
// Construct a new connection Provider with its settings.
66-
$provider = new Provider($ldap, $configuration, $schema);
59+
$provider = new Provider($configuration, $connection, $schema);
6760

6861
if ($settings['auto_connect'] === true) {
6962
// Try connecting to the provider if `auto_connect` is true.
@@ -79,7 +72,7 @@ public function register()
7972

8073
// Bind the Adldap contract to the Adldap object
8174
// in the IoC for dependency injection.
82-
$this->app->bind(AdldapInterface::class, 'adldap');
75+
$this->app->singleton(AdldapInterface::class, 'adldap');
8376
}
8477

8578
/**

src/Config/config.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
|
4040
| The connection class to use to run operations on.
4141
|
42+
| You can also set this option to `null` to use the default connection class.
43+
|
4244
| Custom connection classes must implement \Adldap\Contracts\Connections\ConnectionInterface
4345
|
4446
*/
@@ -52,6 +54,8 @@
5254
|
5355
| The schema class to use for retrieving attributes and generating models.
5456
|
57+
| You can also set this option to `null` to use the default schema class.
58+
|
5559
| Custom schema classes must implement \Adldap\Contracts\Schemas\SchemaInterface
5660
|
5761
*/
@@ -187,18 +191,6 @@
187191
'use_ssl' => false,
188192
'use_tls' => false,
189193

190-
/*
191-
|--------------------------------------------------------------------------
192-
| SSO (Single Sign On)
193-
|--------------------------------------------------------------------------
194-
|
195-
| If you enable single sign on, be sure you've properly set it up
196-
| on your server before hand.
197-
|
198-
*/
199-
200-
'use_sso' => false,
201-
202194
],
203195

204196
],

0 commit comments

Comments
 (0)