/** * Let's do this ... * @param $template string The path or url to a tasty cheesecake template * @param $params array Optional parameters that are merged with existing * params from a cheesecake.json file :O * @param $options array Options */ public function __construct($template, array $params = [], array $options = []) { $this->template = $template; $this->templateType = $this->detectTemplateType($template); $this->params = $params; $this->output = $this->getoa($options, self::OPT_OUTPUT, '.'); $this->noInteraction = $this->getoa($options, self::OPT_NO_INTERACTION, false); $options = ['pragmas' => [\Mustache_Engine::PRAGMA_FILTERS]]; $this->mustache = new \Mustache_Engine($options); $this->mustache->addHelper('string', ['toLowerCase' => function ($value) { return Stringy::toLowerCase($value); }, 'toUpperCase' => function ($value) { return Stringy::toUpperCase($value); }, 'upperCaseFirst' => function ($value) { return Stringy::upperCaseFirst($value); }, 'lowerCaseFirst' => function ($value) { return Stringy::lowerCaseFirst($value); }, 'humanize' => function ($value) { return Stringy::humanize($value); }, 'camelize' => function ($value) { return Stringy::camelize($value); }, 'upperCamelize' => function ($value) { return Stringy::upperCamelize($value); }, 'slugify' => function ($value) { return Stringy::slugify($value); }]); $this->fs = new Filesystem(); }
/** * @dataProvider toLowerCaseProvider() */ public function testToLowerCase($expected, $str, $encoding = null) { $result = S::toLowerCase($str, $encoding); $this->assertInternalType('string', $result); $this->assertEquals($expected, $result); }
public function testInvocation() { $result = S::toLowerCase('FOOBAR'); $this->assertEquals('foobar', (string) $result); }
public function toLowerCase($string) { return Stringy::toLowerCase($string); }