public function testundo() { $my_string = "Is your name O'reilly?"; $string = new williamknauss\String($my_string); $string->addslashes(); $string->undo(); //assert 1 $this->assertEquals($my_string, $string->__toString()); $my_string = " Hello World"; $string = new williamknauss\String($my_string); $string->trim()->str_replace("Hello", "Goodbye")->str_replace("World", "Planet")->undo()->undo()->undo(); //assert 2 $this->assertEquals($my_string, $string->__toString()); }