Files
kupshop/bundles/KupShop/AdminBundle/Tests/AdminCredentialsTest.php
2025-08-02 16:30:27 +02:00

39 lines
1.0 KiB
PHP

<?php
namespace KupShop\AdminBundle\Tests;
use KupShop\AdminBundle\Util\LegacyAdminCredentials;
class AdminCredentialsTest extends \DatabaseTestCase
{
/** @var LegacyAdminCredentials */
private $legacyAdminCredentials;
protected function setUp(): void
{
parent::setUp();
$this->legacyAdminCredentials = $this->get(LegacyAdminCredentials::class);
}
/**
* @dataProvider data_testLoginByHash
*/
public function testLoginByHash(string $hash, bool $result): void
{
$loggedByHash = $this->legacyAdminCredentials->loginByHash($hash);
$logged = $this->legacyAdminCredentials->isLogged();
$this->assertEquals($result, (bool) $loggedByHash, 'Check that user was successfully logged in using hash');
$this->assertEquals($result, $logged, 'Check that user is logged globally');
}
public function data_testLoginByHash(): array
{
return [
['dasd115dsa1da2d', false],
['7b37429817eaed4', true],
];
}
}