예제 #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 ::transformCase
  * @dataProvider providerTransform
  */
 public function testTransform($str, $case, $expected)
 {
     $orig = $str;
     Strings::transform($str, $case);
     $this->assertEquals($expected, $str);
     Strings::setUseMultiByte(true);
     Strings::transform($orig, $case);
     $this->assertEquals($expected, $orig);
 }