Ejemplo n.º 1
0
 /**
  * @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'));
 }
Ejemplo n.º 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);
 }