Skip to content

Commit 0624e5f

Browse files
committed
add testFieldProviderThrowsAnException test
1 parent 8de6869 commit 0624e5f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/FieldProviderTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testExtend()
2929

3030
$this->assertSame($value, $fieldProvider->{$method}());
3131
}
32-
32+
3333
public function testLaravelAuth()
3434
{
3535
$userId = 23452345;
@@ -71,6 +71,18 @@ public function testSentryGetUser()
7171
$this->assertSame($user->id, $currentUserId);
7272
}
7373

74+
public function testFieldProviderThrowsAnException()
75+
{
76+
$loader = AliasLoader::getInstance();
77+
$loader->alias('Sentry', '\Illuminate\Support\Facades\Auth');
78+
79+
\Illuminate\Support\Facades\Auth::shouldReceive('getUser')->andThrow('Exception');
80+
81+
$currentUserId = $this->app['understand.fieldProvider']->getUserId();
82+
83+
$this->assertNull($currentUserId);
84+
}
85+
7486
public function testQueryCount()
7587
{
7688
$this->app['understand.dataCollector']->set('sql_queries', range(1, 1000));

0 commit comments

Comments
 (0)