first commit
This commit is contained in:
38
bundles/KupShop/AdminBundle/Tests/AdminCredentialsTest.php
Normal file
38
bundles/KupShop/AdminBundle/Tests/AdminCredentialsTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user