예제 #1
0
파일: ArraysTest.php 프로젝트: headzoo/core
 /**
  * @covers ::conjunct
  */
 public function testConjunct()
 {
     $arr = ["headzoo", "joe", "sam"];
     $this->assertEquals("headzoo, joe, or sam", Arrays::conjunct($arr, "or"));
     $this->assertEquals("'headzoo', 'joe', or 'sam'", Arrays::conjunct($arr, "or", 'Headzoo\\Core\\Strings::quote'));
     $this->assertEquals("'headzoo', 'joe', " . Arrays::DEFAULT_CONJUNCTION . " 'sam'", Arrays::conjunct($arr, 'Headzoo\\Core\\Strings::quote'));
     $this->assertEquals("'headzoo', 'joe', " . Arrays::DEFAULT_CONJUNCTION . " 'sam'", Arrays::conjunct($arr, [new Strings(), "quote"]));
     $this->assertEquals("'headzoo', 'joe', " . Arrays::DEFAULT_CONJUNCTION . " 'sam'", Arrays::conjunct($arr, function ($str) {
         return Strings::quote($str);
     }));
     $arr = ["headzoo"];
     $this->assertEquals("'headzoo'", Arrays::conjunct($arr, "and", 'Headzoo\\Core\\Strings::quote'));
 }
예제 #2
0
 /**
  * @covers ::quote
  */
 public function testQuote()
 {
     $this->assertEquals("'Ticking away the moments that make up a dull day'", Strings::quote("Ticking away the moments that make up a dull day"));
     $this->assertEquals("`You fritter and waste the hours in an offhand way`", Strings::quote("You fritter and waste the hours in an offhand way", "`"));
 }