mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-03 10:08:33 +01:00
31 lines
689 B
PHP
31 lines
689 B
PHP
<?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));
|
|
}
|
|
|
|
/**
|
|
* @return Generator<int, array{0: bool, 1: string, 2: string}, mixed, void>
|
|
*/
|
|
public function provideEqualsData(): Generator
|
|
{
|
|
yield [true, 'hello', 'hello'];
|
|
yield [false, 'hey', 'hello'];
|
|
yield [false, 'hello', 'hey'];
|
|
}
|
|
}
|