1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 17:14:42 +02:00

Suppress uncaught Hybridauth exceptions in e_user_provider

And add a check for those exceptions in
`social_ui::generateSocialLoginSection()`

Fixes: #4192
This commit is contained in:
Nick Liu
2021-12-28 11:51:20 +01:00
parent b40288d665
commit 3f59b3bc14
3 changed files with 64 additions and 8 deletions

View File

@@ -115,4 +115,32 @@ class e_user_providerTest extends \Codeception\Test\Unit
$result = e_user_provider::getSupplementalFieldsOf("Vkontakte");
$this->assertTrue(array_key_exists('photo_size', $result));
}
public function testNewSuppressExceptions()
{
$this->assertInstanceOf(
e_user_provider::class,
new e_user_provider("Facebook", ["providers" => ["Facebook", ["enabled" => true]]])
);
}
public function testNewNoSuppressConfigurationException()
{
$this->expectException(\Hybridauth\Exception\InvalidArgumentException::class);
new e_user_provider(
"Facebook",
["providers" => ["Facebook" => ["enabled" => true]]],
false
);
}
public function testNewNoSuppressDisabledException()
{
$this->expectException(\Hybridauth\Exception\UnexpectedValueException::class);
new e_user_provider(
"Facebook",
["providers" => ["Facebook" => ["enabled" => false]]],
false
);
}
}