Exemple #1
0
 public function testconcatenate()
 {
     $my_string = "Hello";
     $right_string = " World";
     $string = new williamknauss\String($my_string);
     $string->concatenate($right_string);
     //assert 1
     $this->assertEquals($my_string . $right_string, $string->__toString());
     $my_string = "World";
     $left_string = "Hello ";
     $string = new williamknauss\String($my_string);
     $string->concatenate($left_string, "LEFT");
     //assert 2
     $this->assertEquals($left_string . $my_string, $string->__toString());
     $my_string = "William";
     $right_string = "Knauss";
     $string = new williamknauss\String($my_string);
     $string->concatenate($right_string, "RIGHT");
     //assert 3
     $this->assertEquals($my_string . $right_string, $string->__toString());
     $my_string = "Teddy";
     $default_string = " Bear";
     $string = new williamknauss\String($my_string);
     $string->concatenate($default_string, "PURPLE");
     //assert 4
     $this->assertEquals($my_string . $default_string, $string->__toString());
 }