2020-10-20 08:45:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Hash;
|
|
|
|
|
|
|
|
use Generator;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Psl\Hash;
|
|
|
|
|
|
|
|
final class EqualsTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @dataProvider provideEqualsData
|
|
|
|
*/
|
|
|
|
public function testEquals(bool $expected, string $known_string, string $user_string): void
|
|
|
|
{
|
|
|
|
static::assertSame($expected, Hash\equals($known_string, $user_string));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-10 00:12:23 +01:00
|
|
|
* @return Generator<int, array{0: bool, 1: string, 2: string}, mixed, void>
|
2020-10-20 08:45:30 +02:00
|
|
|
*/
|
|
|
|
public function provideEqualsData(): Generator
|
|
|
|
{
|
|
|
|
yield [true, 'hello', 'hello'];
|
|
|
|
yield [false, 'hey', 'hello'];
|
|
|
|
yield [false, 'hello', 'hey'];
|
|
|
|
}
|
|
|
|
}
|