コード例 #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'));
 }
コード例 #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'));
 }
コード例 #3
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     CsrfProtection::setEngine($engine);
     $this->assertSame($engine, CsrfProtection::getEngine());
     $this->assertSame($engine, Registry::get('hyperframework.web.csrf_protection_engine'));
 }
コード例 #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('');
 }
コード例 #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();
 }
コード例 #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'));
 }
コード例 #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;
 }
コード例 #8
0
 public function testSetEngine()
 {
     $engine = new stdClass();
     Config::setEngine($engine);
     $this->assertSame($engine, Registry::get('hyperframework.config_engine'));
 }
コード例 #9
0
ファイル: App.php プロジェクト: hyperframework/hyperframework
 protected static function createApp()
 {
     return Registry::get('hyperframework.web.test.app');
 }
コード例 #10
0
ファイル: App.php プロジェクト: hyperframework/hyperframework
 protected static function createApp($appRootPath)
 {
     return Registry::get('hyperframework.cli.test.app');
 }
コード例 #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'));
 }
コード例 #12
0
 /**
  * @param DbClientEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.db.client_engine', $engine);
 }
コード例 #13
0
 /**
  * @param CsrfProtectionEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.web.csrf_protection_engine', $engine);
 }
コード例 #14
0
 /**
  * @param RequestEngine $engine
  * @return void
  */
 public static function setEngine($engine)
 {
     Registry::set('hyperframework.web.request_engine', $engine);
 }
コード例 #15
0
 protected function tearDown()
 {
     Registry::clear();
 }