-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathStrTest.php
More file actions
95 lines (76 loc) · 2.25 KB
/
Copy pathStrTest.php
File metadata and controls
95 lines (76 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
namespace Bow\Tests\Support;
use Bow\Support\Str;
class StrTest extends \PHPUnit\Framework\TestCase
{
public function test_upper()
{
$this->assertEquals(Str::upper('papac'), 'PAPAC');
}
public function test_lower()
{
$this->assertEquals(Str::lower('PAPAC'), 'papac');
}
public function test_len()
{
$this->assertEquals(Str::len('PAPAC'), 5);
}
public function test_is_lower()
{
$this->assertTrue(Str::isLower('papac'));
}
public function test_is_upper()
{
$this->assertTrue(Str::isUpper('PAPAC'));
}
public function test_is_numeric()
{
$this->assertTrue(Str::isNumeric('10'));
}
public function test_is_domain()
{
$this->assertTrue(Str::isDomain('https://www.github.com'));
$this->assertFalse(Str::isDomain('httpsgithub.'));
}
public function test_is_alpha()
{
$this->assertEquals(Str::isAlpha('12340papac'), false);
}
public function test_is_alpha_numeric()
{
$this->assertTrue(Str::isAlphaNum('12340papac'));
}
public function test_is_email()
{
$this->assertTrue(Str::isMail('john@doe.com'));
$this->assertFalse(Str::isMail('john@doe'));
}
public function test_is_slug()
{
$this->assertTrue(Str::isSlug('comment-faire-un-site-web-avec-php'));
}
public function test_to_slug()
{
$this->assertEquals(Str::slugify('comment faire un site web avec php'), 'comment-faire-un-site-web-avec-php');
}
public function test_to_camel()
{
$this->assertEquals(Str::camel('comment faire un site web avec php'), 'commentFaireUnSiteWebAvecPhp');
}
public function test_to_capitatize()
{
$this->assertEquals(Str::capitalize('comment faire un site web avec php'), 'Comment Faire Un Site Web Avec Php');
}
public function test_random()
{
$this->assertEquals(strlen(Str::random(10)), 10);
}
public function test_words()
{
$this->assertEquals(Str::words('comment faire un site web avce php', 2), 'comment faire');
}
public function test_contains()
{
$this->assertEquals(Str::contains('comment', 'comment faire un site web avce php'), 0);
}
}