Ejemplo n.º 1
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     Logger::setEngine($engine);
     $this->assertSame($engine, Logger::getEngine());
     $this->assertSame($engine, Registry::get('hyperframework.logging.logger_engine'));
 }
Ejemplo n.º 2
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     Response::setEngine($engine);
     $this->assertSame($engine, Response::getEngine());
     $this->assertSame($engine, Registry::get('hyperframework.web.response_engine'));
 }
 public function testSetEngine()
 {
     $engine = new stdClass();
     CsrfProtection::setEngine($engine);
     $this->assertSame($engine, CsrfProtection::getEngine());
     $this->assertSame($engine, Registry::get('hyperframework.web.csrf_protection_engine'));
 }
Ejemplo n.º 4
0
 public function testRun()
 {
     $app = $this->getMockBuilder('Hyperframework\\Cli\\App')->disableOriginalConstructor()->setMethods(['executeCommand', 'finalize'])->getMock();
     $app->expects($this->once())->method('executeCommand');
     $app->expects($this->once())->method('finalize');
     Registry::set('hyperframework.cli.test.app', $app);
     App::run('');
 }
Ejemplo n.º 5
0
 public function testRun()
 {
     $app = $this->getMockBuilder('Hyperframework\\Web\\App')->setConstructorArgs([dirname(__DIR__)])->setMethods(['createController', 'finalize'])->getMock();
     $controller = $this->getMockBuilder('Hyperframework\\Web\\Test\\IndexController')->setConstructorArgs([$app])->getMock();
     $controller->expects($this->once())->method('run');
     $app->expects($this->once())->method('createController')->willReturn($controller);
     $app->expects($this->once())->method('finalize');
     Registry::set('hyperframework.web.test.app', $app);
     App::run();
 }
Ejemplo n.º 6
0
 public function test()
 {
     Registry::set('name', 'value');
     $this->assertSame('value', Registry::get('name'));
     Registry::remove('name');
     $this->assertFalse(Registry::has('name'));
     Registry::set('name', 'value');
     Registry::clear();
     $this->assertFalse(Registry::has('name'));
 }
Ejemplo n.º 7
0
 /**
  * @return LoggerEngine
  */
 public static function getEngine()
 {
     $engine = Registry::get('hyperframework.logging.logger_engine');
     if ($engine === null) {
         $class = Config::getClass('hyperframework.logging.logger_engine_class', LoggerEngine::class);
         $engine = new $class();
         static::setEngine($engine);
     }
     return $engine;
 }
Ejemplo n.º 8
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     Config::setEngine($engine);
     $this->assertSame($engine, Registry::get('hyperframework.config_engine'));
 }
Ejemplo n.º 9
0
 protected static function createApp()
 {
     return Registry::get('hyperframework.web.test.app');
 }
Ejemplo n.º 10
0
 protected static function createApp($appRootPath)
 {
     return Registry::get('hyperframework.cli.test.app');
 }
Ejemplo n.º 11
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     DbClient::setEngine($engine);
     $this->assertSame($engine, DbClient::getEngine());
     $this->assertSame($engine, Registry::get('hyperframework.db.client_engine'));
 }
Ejemplo n.º 12
0
 /**
  * @param DbClientEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.db.client_engine', $engine);
 }
 /**
  * @param CsrfProtectionEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.web.csrf_protection_engine', $engine);
 }
Ejemplo n.º 14
0
 /**
  * @param RequestEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.web.request_engine', $engine);
 }
Ejemplo n.º 15
0
 protected function tearDown()
 {
     Registry::clear();
 }