public function testReplace() { $text = new Text('foobar'); $this->assertEquals('fooBAR', $text->replace('/bar/', 'BAR')); $text = new Text('foobar'); $text->replace('/bar/', function (Text $bar) { return $bar->upper(); }); $this->assertEquals('fooBAR', $text); }