mirror of
https://github.com/e107inc/e107.git
synced 2025-08-14 02:24:08 +02:00
Merge pull request #4099 from Deltik/fix-3492
New 3rd-party PHP dependency manager for e107 core and HybridAuth upgrade.
This commit is contained in:
@@ -439,13 +439,15 @@ class e107Test extends \Codeception\Test\Unit
|
||||
$res = null;
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
*/
|
||||
|
||||
public function testGetHybridAuth()
|
||||
{
|
||||
$res = null;
|
||||
$this->assertTrue($res);
|
||||
$object = e107::getHybridAuth();
|
||||
$this->assertInstanceOf(Hybridauth\Hybridauth::class, $object);
|
||||
}
|
||||
|
||||
/*
|
||||
public function testGetUserClass()
|
||||
{
|
||||
$res = null;
|
||||
|
@@ -305,6 +305,8 @@ class e_fileTest extends \Codeception\Test\Unit
|
||||
'/CONTRIBUTING.md',
|
||||
'/LICENSE',
|
||||
'/README.md',
|
||||
'/composer.json',
|
||||
'/composer.lock',
|
||||
'/install.php',
|
||||
'/favicon.ico',
|
||||
]
|
||||
|
117
e107_tests/tests/unit/e_user_providerTest.php
Normal file
117
e107_tests/tests/unit/e_user_providerTest.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class e_user_providerTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/** @var e_user_provider */
|
||||
protected $e_user_provider;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
try
|
||||
{
|
||||
include_once(e_HANDLER . 'user_handler.php');
|
||||
$this->e_user_provider = $this->make('e_user_provider');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail("Couldn't load e_user_provider object: {$e}");
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetSupportedProviders()
|
||||
{
|
||||
$result = e_user_provider::getSupportedProviders();
|
||||
$this->assertIsArray($result);
|
||||
$this->assertContains("Facebook", $result);
|
||||
$this->assertContains("Twitter", $result);
|
||||
$this->assertCount(42, $result,
|
||||
"The number of Hybridauth providers has changed! If this is intentional, note the change " .
|
||||
"in Hybridauth providers in the release changelog and update the count in this test."
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetProviderType()
|
||||
{
|
||||
$result = e_user_provider::getTypeOf("NotARealProvider");
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = e_user_provider::getTypeOf("Steam");
|
||||
$this->assertEquals("OpenID", $result);
|
||||
|
||||
$result = e_user_provider::getTypeOf("StackExchangeOpenID");
|
||||
$this->assertEquals("OpenID", $result);
|
||||
|
||||
$result = e_user_provider::getTypeOf("Twitter");
|
||||
$this->assertEquals("OAuth1", $result);
|
||||
|
||||
$result = e_user_provider::getTypeOf("WordPress");
|
||||
$this->assertEquals("OAuth2", $result);
|
||||
}
|
||||
|
||||
public function testGetStandardFieldsOf()
|
||||
{
|
||||
$result = e_user_provider::getStandardFieldsOf("Facebook");
|
||||
$this->assertTrue(array_key_exists('id', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('secret', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('scope', $result));
|
||||
|
||||
$result = e_user_provider::getStandardFieldsOf("Steam");
|
||||
$this->assertTrue(array_key_exists('openid_identifier', $result));
|
||||
|
||||
$result = e_user_provider::getStandardFieldsOf("Telegram");
|
||||
$this->assertEmpty($result);
|
||||
|
||||
$result = e_user_provider::getStandardFieldsOf("Twitter");
|
||||
$this->assertTrue(array_key_exists('key', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('secret', $result['keys']));
|
||||
}
|
||||
|
||||
public function testGetSupplementalFieldsOf()
|
||||
{
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Facebook");
|
||||
$this->assertTrue(array_key_exists('photo_size', $result));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Foursquare");
|
||||
$this->assertTrue(array_key_exists('api_version', $result));
|
||||
$this->assertTrue(array_key_exists('photo_size', $result));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Google");
|
||||
$this->assertTrue(array_key_exists('photo_size', $result));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Odnoklassniki");
|
||||
$this->assertTrue(array_key_exists('key', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('secret', $result['keys']));
|
||||
$this->assertIsNotArray($result['keys']['key']);
|
||||
$this->assertIsNotArray($result['keys']['secret']);
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("StackExchange");
|
||||
$this->assertTrue(array_key_exists('api_key', $result));
|
||||
$this->assertTrue(array_key_exists('site', $result));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Steam");
|
||||
$this->assertFalse(array_key_exists('id', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('secret', $result['keys']));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Telegram");
|
||||
$this->assertTrue(array_key_exists('id', $result['keys']));
|
||||
$this->assertTrue(array_key_exists('secret', $result['keys']));
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Twitter");
|
||||
$this->assertTrue(array_key_exists('authorize', $result));
|
||||
$this->assertTrue(array_key_exists('photo_size', $result));
|
||||
$this->assertIsNotArray($result['photo_size']);
|
||||
|
||||
$result = e_user_provider::getSupplementalFieldsOf("Vkontakte");
|
||||
$this->assertTrue(array_key_exists('photo_size', $result));
|
||||
}
|
||||
}
|
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
use Codeception\Stub;
|
||||
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
|
||||
{
|
||||
/**
|
||||
* @var e_core_pref
|
||||
*/
|
||||
private $pref;
|
||||
/**
|
||||
* @var SocialLoginConfigManager
|
||||
*/
|
||||
private $manager;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function _before()
|
||||
{
|
||||
include_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
|
||||
|
||||
$this->pref = $this->make('e_pref');
|
||||
$this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, [
|
||||
'Twitter-OAuth1' => [
|
||||
'enabled' => true,
|
||||
'keys' => [
|
||||
'id' => 'ID',
|
||||
'secret' => 'SECRET',
|
||||
],
|
||||
],
|
||||
'StackExchange-OpenID' => [
|
||||
'enabled' => false,
|
||||
],
|
||||
'GitHub-OAuth2' => [
|
||||
'enabled' => true,
|
||||
'keys' => [
|
||||
'id' => 'ID',
|
||||
'secret' => 'SECRET',
|
||||
],
|
||||
'scope' => 'identity',
|
||||
],
|
||||
'OpenID' => [
|
||||
'enabled' => true,
|
||||
],
|
||||
]);
|
||||
$this->manager = new SocialLoginConfigManager($this->pref);
|
||||
}
|
||||
|
||||
public function testFlagSettingOff()
|
||||
{
|
||||
$this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_FLAGS, 0x0);
|
||||
$this->manager = new SocialLoginConfigManager($this->pref);
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
}
|
||||
|
||||
public function testFlagSettingGlobalOffPreventsOthersOn()
|
||||
{
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 0);
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 1);
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
}
|
||||
|
||||
public function testFlagSettingGlobalOnAllowsOtherToggles()
|
||||
{
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 1);
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 0);
|
||||
$this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 1);
|
||||
$this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't break existing client code that checks if social_login_active is 0 or not!
|
||||
* If the global bit is 0, all the other bits should be 0, too.
|
||||
*/
|
||||
public function testFlagGlobalOffTurnsAllOff()
|
||||
{
|
||||
$this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_FLAGS, ~0);
|
||||
$this->manager = new SocialLoginConfigManager($this->pref);
|
||||
$this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
|
||||
$this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 0);
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
|
||||
$this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
|
||||
}
|
||||
|
||||
public function testIsProviderEnabled()
|
||||
{
|
||||
$this->assertTrue($this->manager->isProviderEnabled('Twitter'));
|
||||
$this->assertFalse($this->manager->isProviderEnabled('StackExchangeOpenID'));
|
||||
$this->assertTrue($this->manager->isProviderEnabled('GitHub'));
|
||||
$this->assertTrue($this->manager->isProviderEnabled('OpenID'));
|
||||
}
|
||||
|
||||
public function testForgetProvider()
|
||||
{
|
||||
$this->manager->forgetProvider('OpenID');
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->manager->forgetProvider('StackExchangeOpenID');
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertCount(2, $result);
|
||||
|
||||
$this->manager->forgetProvider('FakeProvider');
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertCount(2, $result);
|
||||
}
|
||||
|
||||
public function testSetProviderConfig()
|
||||
{
|
||||
$this->manager->setProviderConfig('MyEnabledProvider', ['enabled' => true]);
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertContains('MyEnabledProvider', $result);
|
||||
$this->assertTrue($this->manager->isProviderEnabled('MyEnabledProvider'));
|
||||
|
||||
$this->manager->setProviderConfig('MyDisabledProvider', ['garbage' => 'nonsense']);
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertContains('MyDisabledProvider', $result);
|
||||
$this->assertFalse($this->manager->isProviderEnabled('MyDisabledProvider'));
|
||||
}
|
||||
|
||||
public function testSetProviderConfigForgetsProviderIfEmpty()
|
||||
{
|
||||
$this->manager->setProviderConfig('EmptyProvider', [
|
||||
'enabled' => null,
|
||||
'keys' => [
|
||||
'id' => '',
|
||||
'secret' => 0,
|
||||
],
|
||||
'scope' => false,
|
||||
]);
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
$this->assertNotContains('EmptyProvider', $result);
|
||||
}
|
||||
|
||||
public function testSetProviderConfigDiscardsEmptyOptions()
|
||||
{
|
||||
$this->manager->setProviderConfig('MiscProvider', [
|
||||
'enabled' => true,
|
||||
'openid_identifier' => '',
|
||||
'keys' => [
|
||||
'id' => null,
|
||||
'secret' => 0,
|
||||
],
|
||||
'scope' => false,
|
||||
]);
|
||||
$result = $this->manager->getProviderConfig('MiscProvider');
|
||||
$this->assertEquals(['enabled' => true], $result);
|
||||
}
|
||||
|
||||
public function testSetProviderConfigOverwritesNonArray()
|
||||
{
|
||||
$this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, 'bad string!');
|
||||
$manager = new SocialLoginConfigManager($this->pref);
|
||||
$expected = ['enabled' => true];
|
||||
|
||||
$manager->setProviderConfig('FirstProvider', $expected);
|
||||
$result = $manager->getProviderConfig('FirstProvider');
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testGetProviderConfig()
|
||||
{
|
||||
$result = $this->manager->getProviderConfig('Twitter');
|
||||
$this->assertTrue($result['enabled']);
|
||||
$this->assertArrayHasKey('keys', $result);
|
||||
$this->assertArrayNotHasKey('scope', $result);
|
||||
|
||||
$result = $this->manager->getProviderConfig('Twitter', 'keys/id');
|
||||
$this->assertEquals('ID', $result);
|
||||
|
||||
$result = $this->manager->getProviderConfig('Twitter', '/keys/secret');
|
||||
$this->assertEquals('SECRET', $result);
|
||||
|
||||
$result = $this->manager->getProviderConfig('Twitter', '/fake');
|
||||
$this->assertNull($result);
|
||||
|
||||
$result = $this->manager->getProviderConfig('StackExchangeOpenID');
|
||||
$this->assertFalse($result['enabled']);
|
||||
$this->assertArrayNotHasKey('keys', $result);
|
||||
$this->assertArrayNotHasKey('scope', $result);
|
||||
|
||||
$result = $this->manager->getProviderConfig('GitHub');
|
||||
$this->assertEquals('identity', $result['scope']);
|
||||
}
|
||||
|
||||
public function testGetConfiguredProviders()
|
||||
{
|
||||
$result = $this->manager->getConfiguredProviders();
|
||||
|
||||
$this->assertCount(4, $result);
|
||||
$this->assertContains('Twitter', $result);
|
||||
$this->assertContains('StackExchangeOpenID', $result);
|
||||
$this->assertContains('GitHub', $result);
|
||||
$this->assertContains('OpenID', $result);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNameFixesCapitalization()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("Github");
|
||||
$this->assertEquals("GitHub-OAuth2", $output);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNamePassesThroughUnknownName()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("iPhone");
|
||||
$this->assertEquals("iPhone", $output);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNameRemovesTypeFromName()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("StackExchangeOpenID");
|
||||
$this->assertEquals("StackExchange-OpenID", $output);
|
||||
|
||||
$output = $this->manager->normalizeProviderName("aolOPENid");
|
||||
$this->assertEquals("AOL-OpenID", $output);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNameFindsCorrectType()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("StackExchange");
|
||||
$this->assertEquals("StackExchange-OAuth2", $output);
|
||||
|
||||
$output = $this->manager->normalizeProviderName("Telegram");
|
||||
$this->assertEquals("Telegram", $output);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNameGeneric()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("openid");
|
||||
$this->assertEquals("OpenID", $output);
|
||||
}
|
||||
|
||||
public function testNormalizeProviderNameFakeGeneric()
|
||||
{
|
||||
$output = $this->manager->normalizeProviderName("OAuth2");
|
||||
$this->assertEquals("OAuth2", $output);
|
||||
}
|
||||
|
||||
public function testDenormalizeProviderName()
|
||||
{
|
||||
$output = $this->manager->denormalizeProviderName("OpenID");
|
||||
$this->assertEquals("OpenID", $output);
|
||||
|
||||
$output = $this->manager->denormalizeProviderName("StackExchange-OAuth1");
|
||||
$this->assertEquals("StackExchangeOAuth1", $output);
|
||||
|
||||
$output = $this->manager->denormalizeProviderName("StackExchange-OAuth2");
|
||||
$this->assertEquals("StackExchange", $output);
|
||||
|
||||
$output = $this->manager->denormalizeProviderName("StackExchange-OpenID");
|
||||
$this->assertEquals("StackExchangeOpenID", $output);
|
||||
}
|
||||
}
|
187
e107_tests/tests/unit/plugins/social/social_setupTest.php
Normal file
187
e107_tests/tests/unit/plugins/social/social_setupTest.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2020 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
class social_setupTest extends \Codeception\Test\Unit
|
||||
{
|
||||
public function _before()
|
||||
{
|
||||
include_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
|
||||
include_once(e_PLUGIN . "social/social_setup.php");
|
||||
}
|
||||
|
||||
public function testUpgradeProviderNameNormalization()
|
||||
{
|
||||
e107::getConfig()->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, SOCIAL_LOGIN_LEGACY_DATA);
|
||||
$social_setup = new social_setup();
|
||||
$this->assertTrue($social_setup->upgrade_required());
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL"));
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Github"));
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Live"));
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/WindowsLive"));
|
||||
|
||||
$social_setup->upgrade_pre();
|
||||
$this->assertFalse($social_setup->upgrade_required());
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL"));
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Github"));
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
|
||||
$this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Live"));
|
||||
$this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/WindowsLive-OAuth2"));
|
||||
}
|
||||
|
||||
public function testUpgradeFixRenamedProvidersXup()
|
||||
{
|
||||
$renamedProviders = social_setup::RENAMED_PROVIDERS;
|
||||
foreach ($renamedProviders as $oldProviderName => $newProviderName)
|
||||
{
|
||||
$db = e107::getDb();
|
||||
$db->insert('user', [
|
||||
'user_loginname' => $oldProviderName . '012345',
|
||||
'user_name' => $oldProviderName . '012345',
|
||||
'user_password' => '559b3b2f2d54b647ae7a5beb5c8c36c3',
|
||||
'user_email' => '',
|
||||
'user_xup' => $oldProviderName . '_ThisSegmentDoesNotMatter',
|
||||
]);
|
||||
$insertId = $db->lastInsertId();
|
||||
|
||||
$social_setup = new social_setup();
|
||||
$this->assertTrue($social_setup->upgrade_required());
|
||||
$social_setup->upgrade_pre();
|
||||
|
||||
$result = $db->retrieve('user', '*', 'user_id=' . $insertId);
|
||||
$this->assertEquals($newProviderName . '_ThisSegmentDoesNotMatter', $result['user_xup']);
|
||||
$this->assertFalse($social_setup->upgrade_required());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/e107inc/e107/pull/4099#issuecomment-590579521
|
||||
*/
|
||||
public function testUpgradeFixSteamXupBug()
|
||||
{
|
||||
$db = e107::getDb();
|
||||
$db->insert('user', [
|
||||
'user_loginname' => 'SteambB8047',
|
||||
'user_name' => 'SteambB8047',
|
||||
'user_password' => '$2y$10$.u22u/U392cUhvJm2DJ57.wsKtxKKj3WsZ.x6LsXoUVHVuprZGgUu',
|
||||
'user_email' => '',
|
||||
'user_xup' => 'Steam_https://steamcommunity.com/openid/id/76561198006790310',
|
||||
]);
|
||||
$insertId = $db->lastInsertId();
|
||||
|
||||
$social_setup = new social_setup();
|
||||
$this->assertTrue($social_setup->upgrade_required());
|
||||
$social_setup->upgrade_pre();
|
||||
|
||||
$result = $db->retrieve('user', '*', 'user_id=' . $insertId);
|
||||
$this->assertEquals('Steam_76561198006790310', $result['user_xup']);
|
||||
$this->assertFalse($social_setup->upgrade_required());
|
||||
}
|
||||
}
|
||||
const SOCIAL_LOGIN_LEGACY_DATA =
|
||||
array(
|
||||
'FakeProviderNeverExisted' =>
|
||||
array(
|
||||
'enabled' => '1',
|
||||
),
|
||||
'AOL' =>
|
||||
array(
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Facebook' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'scope' => 'c',
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Foursquare' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Github' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'scope' => 'c',
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Google' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'scope' => 'c',
|
||||
'enabled' => '1',
|
||||
),
|
||||
'LinkedIn' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Live' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
'OpenID' =>
|
||||
array(
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Steam' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'key' => 'a',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Twitter' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'key' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
'Yahoo' =>
|
||||
array(
|
||||
'keys' =>
|
||||
array(
|
||||
'id' => 'a',
|
||||
'secret' => 'b',
|
||||
),
|
||||
'enabled' => '1',
|
||||
),
|
||||
);
|
Reference in New Issue
Block a user