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

Commit 97233a6

Browse files
committed
Added config option, added test
1 parent 71f515e commit 97233a6

File tree

5 files changed

+84
-5
lines changed

5 files changed

+84
-5
lines changed

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"laravel/framework": "5.*"
1111
},
1212
"require-dev": {
13-
"fzaninotto/faker": "~1.4",
14-
"mockery/mockery": "0.9.*",
15-
"phpunit/phpunit": "~4.0",
16-
"phpspec/phpspec": "~2.1"
13+
"orchestra/testbench": "~3.0"
1714
},
1815
"archive": {
1916
"exclude": ["/tests"]

src/AdldapServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function register()
4242
throw new ConfigurationMissingException($message);
4343
}
4444

45-
return new Adldap($config['connection_settings'], null, $config['auto_connect']);
45+
return new Adldap($config['connection_settings'], new $config['connection'], $config['auto_connect']);
4646
});
4747
}
4848

src/Config/config.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@
1414

1515
'auto_connect' => true,
1616

17+
/*
18+
|--------------------------------------------------------------------------
19+
| Connection
20+
|--------------------------------------------------------------------------
21+
|
22+
| The connection class to use to run operations on.
23+
|
24+
| Custom connection classes must implement \Adldap\Connections\ConnectionInterface
25+
|
26+
*/
27+
28+
'connection' => Adldap\Connections\Ldap::class,
29+
1730
/*
1831
|--------------------------------------------------------------------------
1932
| Connection Settings

tests/AdldapTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Adldap\Laravel\Tests;
4+
5+
use Adldap\Laravel\Exceptions\ConfigurationMissingException;
6+
use Illuminate\Support\Facades\App;
7+
use Adldap\Laravel\Facades\Adldap as AdldapFacade;
8+
use Adldap\Adldap;
9+
10+
class AdldapTest extends FunctionalTestCase
11+
{
12+
public function testConfigurationNotFoundException()
13+
{
14+
$this->setExpectedException(ConfigurationMissingException::class);
15+
16+
App::make('adldap');
17+
}
18+
19+
public function testIsBound()
20+
{
21+
22+
}
23+
}

tests/FunctionalTestCase.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace Adldap\Laravel\Tests;
4+
5+
use Adldap\Laravel\AdldapServiceProvider;
6+
use Adldap\Laravel\Facades\Adldap;
7+
use Orchestra\Testbench\TestCase;
8+
9+
class FunctionalTestCase extends TestCase
10+
{
11+
/**
12+
* Define the environment setup.
13+
*
14+
* @param \Illuminate\Foundation\Application $app
15+
*/
16+
protected function getEnvironmentSetup($app)
17+
{
18+
$app['config']->set('adldap', [
19+
'auto_connect' => false,
20+
]);
21+
}
22+
23+
/**
24+
* Get the package service providers required for testing.
25+
*
26+
* @return array
27+
*/
28+
protected function getPackageProviders()
29+
{
30+
return [
31+
AdldapServiceProvider::class,
32+
];
33+
}
34+
35+
/**
36+
* Get the package aliases for testing.
37+
*
38+
* @return array
39+
*/
40+
protected function getPackageAliases()
41+
{
42+
return [
43+
Adldap::class,
44+
];
45+
}
46+
}

0 commit comments

Comments
 (0)