/** * @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')); }
/** * @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", "`")); }