Exemplo n.º 1
0
 /**
  * Test that listing() returns a comma separate list of items as a string.
  */
 public function testListing()
 {
     $this->assertEquals('red, blue & green', String::listing(array('red', 'blue', 'green')));
     $this->assertEquals('red & green', String::listing(array('red', 'green')));
     $this->assertEquals('blue', String::listing(array('blue')));
     $this->assertEquals('green', String::listing('green'));
     // custom
     $this->assertEquals('red, blue, and green', String::listing(array('red', 'blue', 'green'), ', and '));
     $this->assertEquals('red - blue and green', String::listing(array('red', 'blue', 'green'), ' and ', ' - '));
 }
Exemplo n.º 2
0
 function str_listing($items, $glue = ' & ', $sep = ', ')
 {
     return String::listing($items, $glue, $sep);
 }