Ejemplo n.º 1
0
 public function testWrappers()
 {
     $input = 'Ąbć dęfć';
     $this->assertEquals(8, Str::len($input));
     $this->assertEquals('dęfć', Str::sub($input, 4));
     $this->assertEquals('bć dę', Str::sub($input, 1, 5));
     // pos and related
     $this->assertEquals(2, Str::pos($input, 'ć'));
     $this->assertEquals(7, Str::pos($input, 'ć', 4));
     $this->assertTrue(Str::contains($input, 'ć'));
     $this->assertFalse(Str::contains($input, 'ź'));
     $this->assertTrue(Str::startsWith($input, 'Ą'));
     $this->assertTrue(Str::startsWith($input, 'Ąbć'));
     $this->assertFalse(Str::startsWith($input, 'Abc'));
     $this->assertTrue(Str::endsWith($input, 'ć'));
     $this->assertTrue(Str::endsWith($input, 'ęfć'));
     $this->assertFalse(Str::endsWith($input, 'f'));
     // case-related
     $this->assertEquals('ĄBĆ DĘFĆ', Str::upper($input));
     $this->assertEquals('ąbć dęfć', Str::lower($input));
     $this->assertEquals('Ąbć Dęfć', Str::ucwords($input));
     $this->assertEquals('Ąć', Str::ucfirst('ąć'));
 }