assertSame('f...', truncate('foo', 1)); $this->assertSame('fo...', truncate('foo', 2)); $this->assertSame('foo', truncate('foo', 3)); $this->assertSame('foo', truncate('foo', 4)); $this->assertSame('fo[...]', truncate('foo', 2, '[...]')); } }