Skip to content

Commit dbe372d

Browse files
committed
Merge pull request #5382 from faridmovsumov/bug/added-unit-tests-for-str-class
Added some unit tests for quickRandom and random methods in SupportStrTest.php
2 parents 4b6ff60 + dfdf77b commit dbe372d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Support/SupportStrTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,22 @@ public function testIs()
105105
$this->assertTrue(Str::is('*/foo', 'blah/baz/foo'));
106106
}
107107

108+
109+
public function testQuickRandom()
110+
{
111+
$randomInteger = mt_rand(1, 100);
112+
$this->assertEquals($randomInteger, strlen(Str::quickRandom($randomInteger)));
113+
$this->assertInternalType('string', Str::quickRandom());
114+
$this->assertEquals(16, strlen(Str::quickRandom()));
115+
}
116+
117+
118+
public function testRandom()
119+
{
120+
$this->assertEquals(16, strlen(Str::random()));
121+
$randomInteger = mt_rand(1, 100);
122+
$this->assertEquals($randomInteger, strlen(Str::random($randomInteger)));
123+
$this->assertInternalType('string', Str::random());
124+
}
125+
108126
}

0 commit comments

Comments
 (0)