function testSetHeader() { $now = time(); \PMVC\option('set', _ROUTER, 'fake_router'); $router = \PMVC\plug('fake_router', [_CLASS => __NAMESPACE__ . '\\fakePlugIn']); $pCache = \PMVC\plug($this->_plug, [[10, 'public', $now]]); $expected = ['Cache-Control: max-age=10, public', 'Last-Modified: ' . $pCache->getGmt($now), 'Expires: ' . $pCache->getGmt($now + 10)]; $this->assertEquals($expected, $router['headers']); }
public function onB4ProcessView() { $dot = \PMVC\plug('dotenv'); $view = \PMVC\plug('view'); $dotView = '.env.view'; if ($dot->fileExists($dotView)) { $configs = $dot->getUnderscoreToArray($dotView); } else { $configs = []; } $globalView = \PMVC\getOption('VIEW'); if ($globalView) { $configs = array_replace_recursive($configs, $globalView); \PMVC\option('set', 'VIEW', null); } $i18n = \PMVC\getOption('I18N', []); $configs = array_replace_recursive($configs, ['I18N' => $i18n]); \PMVC\option('set', 'I18N', null); $view->set($configs); }
public function getDimension() { $url = \PMVC\plug('url')->getUrl($this['dimensionUrl']); $url->query = $this['dimensionQuery']; $curl = \PMVC\plug('curl'); $curl->get($url, function ($r) { $json = \PMVC\fromJson($r->body, true); if (is_array($json)) { $this->unsetCli($json); \PMVC\dev(function () use($json) { return $json; }, 'dimension'); \PMVC\option('set', $json); } else { $dot = \PMVC\plug('dotenv'); if ($dot->fileExists($this['env'])) { $dot->toPMVC($this['env']); } } })->set([CURLOPT_CONNECTTIMEOUT => 1]); $curl->process(); }
public function init() { \PMVC\option('set', 'test', 'app1'); }
public function onTest() { \PMVC\option('set', 'test', 'ontest'); }
function dump($p, $type = '') { \PMVC\option('set', 'test', [$p, $type]); }
function stop($bool = null) { if (is_null($bool)) { return \PMVC\getOption(\PMVC\PAUSE); } else { return \PMVC\option('set', \PMVC\PAUSE, $bool); } }
function process() { \PMVC\option('set', 'v', 1); }
public function validate() { \PMVC\option('set', 'fakeDefaultForm', 'aaa'); return true; }
function testView() { $view = \PMVC\plug('view_fake', array(_CLASS => 'FakeTemplate')); PMVC\option('set', _VIEW_ENGINE, 'fake'); $this->assertContains('view_fake', var_export(PMVC\plug('view'), true)); }
function setup() { $view = \PMVC\plug('view_fake', array(_CLASS => 'FakeTemplate')); PMVC\option('set', _VIEW_ENGINE, 'fake'); }
public function setup() { \PMVC\option('set', 'test', null); }