Skip to content

Commit

Permalink
修复测试
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/unit/Component/Tests/Util/RandomTest.php
  • Loading branch information
Yurunsoft committed Oct 28, 2022
1 parent 2c8f692 commit 2d12ae7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/Component/Tests/Util/RandomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ public function testText(): void
$this->assertEquals('aaaaa', $val);

$val = Random::text('abc', 10, 20);
$this->assertTrue(preg_match('/^[abc]{10, 20}$/', $val) >= 0);
$this->assertEquals(1, preg_match('/^[abc]{10,20}$/', $val));
}

public function testLetter(): void
{
$val = Random::letter(10, 20);
$this->assertTrue(preg_match('/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]{10, 20}$/', $val) >= 0);
$this->assertEquals(1, preg_match('/^[a-zA-Z]{10,20}$/', $val));

$this->assertEquals(5, \strlen(Random::letter(5)));
}

public function testDigital(): void
{
$val = Random::digital(10, 20);
$this->assertTrue(preg_match('/^[0123456789]{10, 20}$/', $val) >= 0);
$this->assertEquals(1, preg_match('/^\d{10,20}$/', $val));

$this->assertEquals(5, \strlen(Random::digital(5)));
}

public function testLetterAndNumber(): void
{
$val = Random::letterAndNumber(10, 20);
$this->assertTrue(preg_match('/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]{10, 20}$/', $val) >= 0);
$this->assertEquals(1, preg_match('/^[a-zA-Z\d]{10,20}$/', $val));

$this->assertEquals(5, \strlen(Random::letterAndNumber(5)));
}
Expand Down

0 comments on commit 2d12ae7

Please sign in to comment.