Example #1
0
 public function testShouldParseQuotedString()
 {
     $expectedResult = '"quoted string parsed"';
     $grokParser = new Grok();
     $result = $grokParser->parse('%{QS:result}', '"quoted string parsed"');
     $this->assertEquals($expectedResult, $result['result']);
 }
Example #2
0
<?php

/**
 * Chippino Bootstrap
 **/
// dependency: grok
define('CHIPPINO_GROK_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'grok.php');
require_once CHIPPINO_GROK_PATH;
// Grok sets up Chippino to run
Grok::instance()->dispatch(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'chippino_core.php');
// all chippino functions are available now
// invokes the bootstrapping with the provided settings
function chippino($settings)
{
    // set defaults if not set
    $settings = array_merge(array('base_path' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'apps/chippino', 'chippino_class' => 'Chippino_Factory'), $settings);
    if (!isset($settings['config_path'])) {
        $settings['config_path'] = $settings['base_path'] . DIRECTORY_SEPARATOR . 'config';
    }
    // do any special formatting per setting
    foreach ($settings as $key => $value) {
        switch ($key) {
            case 'base_path':
            case 'config_path':
                $value = substr($value, strrpos($value, DIRECTORY_SEPARATOR)) === DIRECTORY_SEPARATOR ? $value : $value . DIRECTORY_SEPARATOR;
                $value = substr($value, 0, -1);
                $settings[$key] = $value;
                break;
        }
        // assign to framework config
        chippino_config()->{$key} = $value;