コード例 #1
0
 public function testIsCallingSubstr()
 {
     $string = new String('Lechuga Ipsum Dolor');
     $result = $string->substr(6, 10);
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('a Ipsum Do', $string->toString());
 }
コード例 #2
0
 public function testIsEscapingUrl()
 {
     $string = new String('Lorem! Ipsum! $dolor');
     $result = $string->escapeUrl();
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('Lorem%21+Ipsum%21+%24dolor', $result->toString());
 }
コード例 #3
0
 public function testIsEmpty()
 {
     $string = new String('abcdef');
     $this->assertEquals(false, $string->isEmpty());
     $string = new String('');
     $this->assertEquals(true, $string->isEmpty());
 }
コード例 #4
0
 public function testIsRemovingDelimiters()
 {
     $string = new String('Lorem ipsum, dolor sit-amet!');
     $result = $string->removeDelimiters();
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('Loremipsumdolorsitamet', $result->toString());
 }
コード例 #5
0
 public function testIsCountingWords()
 {
     $string = new String('Lorem ipsum Dolor amet lore');
     $this->assertEquals(5, $string->words());
     $string = new String('Lorem');
     $this->assertEquals(1, $string->words());
     $string = new String('    ');
     $this->assertEquals(0, $string->words());
 }
コード例 #6
0
 public function testIsCensoring()
 {
     $string = new String('Lorem ipsum dolor');
     $result = $string->censor('ipsum');
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('Lorem ***** dolor', $result->toString());
     $string = new String('Lorem ipsum dolor');
     $result = $string->censor(array('Lorem', 'dolor'));
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('***** ipsum *****', $result->toString());
 }
コード例 #7
0
 public function testIsConvertingToCleanUrl()
 {
     $string = new String('Your mother is so ugly, glCullFace always returns TRUE.');
     $result = $string->toCleanUrl();
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('your-mother-is-so-ugly-glcullface-always-returns-true', $result->toString());
     $string = new String('Your mother is so ugly, glCullFace always returns TRUE.');
     $result = $string->toCleanUrl('_');
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('your_mother_is_so_ugly_glcullface_always_returns_true', $result->toString());
     $string = new String('Acentos serão reconhecidos e substituídos.');
     $result = $string->toCleanUrl();
     $this->assertInstanceOf('Simple\\Type\\String', $result);
     $this->assertEquals('acentos-serao-reconhecidos-e-substituidos', $result->toString());
 }