Skip to content

Commit 3d9f911

Browse files
committed
Fixed setting cache store
Closes #78
1 parent 1ac927e commit 3d9f911

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/LdapServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function boot()
4343

4444
if (config('ldap.cache.enabled', false)) {
4545
$connection->setCache(
46-
cache()->repository(config('ldap.cache.driver'))
46+
cache()->driver(config('ldap.cache.driver'))
4747
);
4848
}
4949

tests/LdapServiceProviderTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace LdapRecord\Laravel\Tests;
4+
5+
use Illuminate\Log\LogManager;
6+
use LdapRecord\Container;
7+
use LdapRecord\Query\Cache;
8+
9+
class LdapServiceProviderTest extends TestCase
10+
{
11+
protected function getEnvironmentSetup($app)
12+
{
13+
parent::getEnvironmentSetup($app);
14+
15+
$app['config']->set('ldap.logging', true);
16+
$app['config']->set('ldap.cache.enabled', true);
17+
}
18+
19+
public function test_logger_is_set_on_container_when_enabled()
20+
{
21+
$this->assertInstanceOf(LogManager::class, Container::getLogger());
22+
}
23+
24+
public function test_cache_is_set_on_connection_when_enabled()
25+
{
26+
foreach (Container::getInstance()->all() as $connection) {
27+
$this->assertInstanceOf(Cache::class, $connection->getCache());
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)