Skip to content

Commit 936aa66

Browse files
committed
Merge branch 'feature-more-built-in-0.1'
2 parents a9249ca + 6027624 commit 936aa66

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/Loaders/LoaderManager.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public function createFileDriver()
9191
*/
9292
protected function createDriver($driver)
9393
{
94-
if (empty($driver)) {
95-
throw new InvalidArgumentException("Unsupported empty model loader type.");
96-
}
97-
9894
if (isset($this->customCreators[$driver])) {
9995
return $this->callCustomCreator($driver);
10096
}

tests/ModelLoaderTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ public function testEmptyLoaderType(): void
6868
$this->assertFalse(Enforcer::enforce('alice', 'data', 'read'));
6969
}
7070

71+
public function testNotExistLoaderType(): void
72+
{
73+
$this->app['config']->set('lauthz.basic.model.config_type', 'not_exist');
74+
$this->expectException(InvalidArgumentException::class);
75+
76+
$this->assertFalse(Enforcer::enforce('alice', 'data', 'read'));
77+
}
78+
7179
public function testBadUrlConnection(): void
7280
{
7381
$this->initUrlConfig();
@@ -105,9 +113,12 @@ protected function initCustomConfig(): void
105113

106114
$config = $this->app['config']->get('lauthz.second');
107115
$loader = $this->app->make(LoaderManager::class);
116+
<<<<<<< HEAD
108117

109118
$this->expectException(InvalidArgumentException::class);
110119
Enforcer::guard('second');
120+
=======
121+
>>>>>>> feature-more-built-in-0.1
111122

112123
$loader->extend('custom', function () use ($config) {
113124
return new \Lauthz\Loaders\TextLoader($config);

tests/RequestMiddlewareTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function testAfterLogin()
4545
$this->assertEquals($this->middleware(Request::create('/proxy', 'GET'), 'second'), 'Unauthorized Exception');
4646
}
4747

48-
protected function middleware($request, $guard = null)
48+
protected function middleware($request, ...$guards)
4949
{
50-
return parent::runMiddleware(RequestMiddleware::class, $request, $guard);
50+
return parent::runMiddleware(RequestMiddleware::class, $request, ...$guards);
5151
}
5252

5353
protected function initConfig()

0 commit comments

Comments
 (0)