Completed
Push — master ( b8ee44...86e435 )
by Jim
02:27
created

StrTest::testLower()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: lenovo
5
 * Date: 6/15/2018
6
 * Time: 11:20 AM
7
 */
8
9
namespace TimSDK\Tests\Support;
10
11
use TimSDK\Support\Str;
12
use TimSDK\Tests\TestCase;
13
14
class StrTest extends TestCase
15
{
16
    public function testStartsWith()
17
    {
18
        $this->assertTrue(Str::startsWith('Hello World', ['foo', 'Hello']));
19
        $this->assertTrue(Str::startsWith('Hello World', 'Hello'));
20
        $this->assertFalse(Str::startsWith('Hello World', 'foo'));
21
    }
22
23
    public function testEndsWith()
24
    {
25
        $this->assertTrue(Str::endsWith('Hello World', ['Worlds', 'World']));
26
        $this->assertTrue(Str::endsWith('Hello World', 'World'));
27
        $this->assertFalse(Str::endsWith('Hello World', 'Worlds'));
28
    }
29
30
    public function testUpper()
31
    {
32
        $this->assertSame('HELLOWORLD', Str::upper('HelloWorld'));
33
    }
34
    
35
    public function testLower()
36
    {
37
        $this->assertSame('helloworld', Str::lower('HelloWorld'));
38
    }
39
    
40
    public function testSnake()
41
    {
42
        $this->assertSame('foo_bar', Str::snake('fooBar'));
43
        $this->assertSame('foo_bar', Str::snake('FooBar'));
44
        $this->assertSame('foo-bar', Str::snake('fooBar', '-'));
45
    }
46
}
47