Beispiel #1
0
 public function testEquals()
 {
     $str1 = new Str("Hello, world.");
     $str2 = new Str("HELLO, WORLD.");
     $str3 = new Str("HELLO, WORLD.");
     $this->assertTrue($str1->equals($str1));
     $this->assertFalse($str1->equals($str2));
     $this->assertTrue($str2->equals($str3));
     $str4 = new Str("1234");
     try {
         $this->assertFalse($str4->equals(1234));
     } catch (StrInvalidArgumentException $ex) {
         $this->assertEquals(get_class($ex), 'Str\\StrInvalidArgumentException');
     }
     $this->assertTrue($str1->equalsIgnoreCase(new Str("HELLO, WORLD.")));
     $this->assertTrue($str2->equalsIgnoreCase(new Str("Hello, world.")));
 }