Exemplo n.º 1
0
 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);
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 public function init()
 {
     \PMVC\option('set', 'test', 'app1');
 }
Exemplo n.º 5
0
 public function onTest()
 {
     \PMVC\option('set', 'test', 'ontest');
 }
Exemplo n.º 6
0
 function dump($p, $type = '')
 {
     \PMVC\option('set', 'test', [$p, $type]);
 }
Exemplo n.º 7
0
 function stop($bool = null)
 {
     if (is_null($bool)) {
         return \PMVC\getOption(\PMVC\PAUSE);
     } else {
         return \PMVC\option('set', \PMVC\PAUSE, $bool);
     }
 }
Exemplo n.º 8
0
 function process()
 {
     \PMVC\option('set', 'v', 1);
 }
Exemplo n.º 9
0
 public function validate()
 {
     \PMVC\option('set', 'fakeDefaultForm', 'aaa');
     return true;
 }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
0
 function setup()
 {
     $view = \PMVC\plug('view_fake', array(_CLASS => 'FakeTemplate'));
     PMVC\option('set', _VIEW_ENGINE, 'fake');
 }
Exemplo n.º 12
0
 public function setup()
 {
     \PMVC\option('set', 'test', null);
 }