public function testSetEngine() { $engine = new stdClass(); Logger::setEngine($engine); $this->assertSame($engine, Logger::getEngine()); $this->assertSame($engine, Registry::get('hyperframework.logging.logger_engine')); }
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')); }
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(''); }
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(); }
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')); }
/** * @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; }
public function testSetEngine() { $engine = new stdClass(); Config::setEngine($engine); $this->assertSame($engine, Registry::get('hyperframework.config_engine')); }
protected static function createApp() { return Registry::get('hyperframework.web.test.app'); }
protected static function createApp($appRootPath) { return Registry::get('hyperframework.cli.test.app'); }
public function testSetEngine() { $engine = new stdClass(); DbClient::setEngine($engine); $this->assertSame($engine, DbClient::getEngine()); $this->assertSame($engine, Registry::get('hyperframework.db.client_engine')); }
/** * @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); }
/** * @param RequestEngine $engine * @return void */ public static function setEngine($engine) { Registry::set('hyperframework.web.request_engine', $engine); }
protected function tearDown() { Registry::clear(); }